-
Notifications
You must be signed in to change notification settings - Fork 821
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstaleIssues/PRs that are marked for closure due to inactivityIssues/PRs that are marked for closure due to inactivity
Description
Assuming my full path to repo is /Users/panteliskaramolegkos/myrepo
, I am going through the following steps to check the status of a specific file (code below is part of a specific function)
repo, err := git.PlainOpen(fullPathToRepo)
if err != nil {
return false, fmt.Errorf("ERROR: Unable to open repository %s\n%s", fullPathToRepo, err)
}
workTree, err := repo.Worktree()
if err != nil {
return false, fmt.Errorf("ERROR: Unable to open worktree for repository %s\n%s", fullPathToRepo, err)
}
workTreeStatus, err := workTree.Status()
if err != nil {
return false, fmt.Errorf("ERROR: Unable to retrieve worktree status for repository %s\n%s", fullPathToRepo, err)
}
fmt.Printf("%q\n", workTreeStatus.File("relative/path/to/file.yaml").Worktree)
fmt.Printf("%q\n", workTreeStatus.File("/Users/panteliskaramolegkos/full/path/to/file.yaml").Worktree)
In both cases (i.e. using full or relative path, the following gets printed out
'?'
'?'
According to the documentation, this corresponds to status Untracked
However the file is committed (and pushed to the remote, but I guess this is irrelevant)
dmoles, spiarh, nygymankussainov, kirkiris, dstrants and 6 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededstaleIssues/PRs that are marked for closure due to inactivityIssues/PRs that are marked for closure due to inactivity