Skip to content

Commit eac8e50

Browse files
committed
Allow calling sync from within a subfolder of a repo
1 parent 1ef7809 commit eac8e50

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

common/fetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
)
77

88
func fetch(repoPath string) error {
9-
r, err := git.PlainOpen(repoPath)
9+
r, err := git.PlainOpenWithOptions(repoPath, &git.PlainOpenOptions{DetectDotGit: true})
1010
if err != nil {
1111
return tracerr.Wrap(err)
1212
}

common/ignore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func shouldIgnoreFile(repoPath string, fullFilePath string) (bool, error) {
4040
}
4141

4242
func isFileIgnoredByGit(repoPath string, filePath string) (bool, error) {
43-
repo, err := git.PlainOpen(repoPath)
43+
repo, err := git.PlainOpenWithOptions(repoPath, &git.PlainOpenOptions{DetectDotGit: true})
4444
if err != nil {
4545
return false, tracerr.Wrap(err)
4646
}

common/rebase.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type branchInfo struct {
5858
}
5959

6060
func fetchBranchInfo(repoPath string) (branchInfo, error) {
61-
repo, err := git.PlainOpen(repoPath)
61+
repo, err := git.PlainOpenWithOptions(repoPath, &git.PlainOpenOptions{DetectDotGit: true})
6262
if err != nil {
6363
return branchInfo{}, tracerr.Wrap(err)
6464
}

daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func isValidGitRepo(repoPath string) error {
7171
return tracerr.Errorf("%w - %s", errRepoPathInvalid, repoPath)
7272
}
7373

74-
_, err = git.PlainOpen(repoPath)
74+
_, err = git.PlainOpenWithOptions(repoPath, &git.PlainOpenOptions{DetectDotGit: true})
7575
if err != nil {
7676
return tracerr.Errorf("Not a valid git repo - %s\n%w", repoPath, err)
7777
}

0 commit comments

Comments
 (0)