1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Better logic for knowing which repo we're in

This commit is contained in:
Jesse Duffield
2023-07-17 14:38:08 +10:00
parent a06a5cadee
commit b73efb2c22
8 changed files with 54 additions and 24 deletions

View File

@ -3,9 +3,7 @@ package utils
import (
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"regexp"
"runtime"
"strconv"
@ -15,15 +13,6 @@ import (
"github.com/jesseduffield/gocui"
)
// GetCurrentRepoName gets the repo's base name
func GetCurrentRepoName() string {
pwd, err := os.Getwd()
if err != nil {
log.Fatalln(err.Error())
}
return filepath.Base(pwd)
}
// GetProjectRoot returns the path to the root of the project. Only to be used
// in testing contexts, as with binaries it's unlikely this path will exist on
// the machine