mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
Use filepath.Join instead of manual concat
This commit is contained in:
parent
966733240c
commit
767ef31661
@ -18,7 +18,7 @@ import (
|
|||||||
|
|
||||||
func (gui *Gui) getCurrentBranch(path string) string {
|
func (gui *Gui) getCurrentBranch(path string) string {
|
||||||
readHeadFile := func(path string) (string, error) {
|
readHeadFile := func(path string) (string, error) {
|
||||||
headFile, err := ioutil.ReadFile(fmt.Sprintf("%s%cHEAD", path, os.PathSeparator))
|
headFile, err := ioutil.ReadFile(filepath.Join(path, "HEAD"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
content := strings.TrimSpace(string(headFile))
|
content := strings.TrimSpace(string(headFile))
|
||||||
branch := strings.TrimPrefix(content, "ref: refs/heads/")
|
branch := strings.TrimPrefix(content, "ref: refs/heads/")
|
||||||
@ -27,7 +27,7 @@ func (gui *Gui) getCurrentBranch(path string) string {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
gitDirPath := fmt.Sprintf("%s%c.git", path, os.PathSeparator)
|
gitDirPath := filepath.Join(path, ".git")
|
||||||
|
|
||||||
if gitDir, err := os.Stat(gitDirPath); err == nil {
|
if gitDir, err := os.Stat(gitDirPath); err == nil {
|
||||||
if gitDir.IsDir() {
|
if gitDir.IsDir() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user