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

remove deprecated calls

This commit is contained in:
jiepeng
2022-09-13 18:11:03 +08:00
committed by Jesse Duffield
parent c81333fefe
commit b8900baf1a
21 changed files with 48 additions and 59 deletions

View File

@ -2,7 +2,6 @@ package gui
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -20,7 +19,7 @@ import (
func (gui *Gui) getCurrentBranch(path string) string {
readHeadFile := func(path string) (string, error) {
headFile, err := ioutil.ReadFile(filepath.Join(path, "HEAD"))
headFile, err := os.ReadFile(filepath.Join(path, "HEAD"))
if err == nil {
content := strings.TrimSpace(string(headFile))
refsPrefix := "ref: refs/heads/"
@ -47,7 +46,7 @@ func (gui *Gui) getCurrentBranch(path string) string {
}
} else {
// worktree
if worktreeGitDir, err := ioutil.ReadFile(gitDirPath); err == nil {
if worktreeGitDir, err := os.ReadFile(gitDirPath); err == nil {
content := strings.TrimSpace(string(worktreeGitDir))
worktreePath := strings.TrimPrefix(content, "gitdir: ")
if branch, err := readHeadFile(worktreePath); err == nil {