Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

Commit

Permalink
EvalSymlinks in Contains() check
Browse files Browse the repository at this point in the history
git's root command (maybe others vcs as well) resolve symlinks, so try
that too.

PS: In git's case we can possible use rev-parse --show-cdup + extra
logic to find the root of the repo instead. Need to figure out what
other vcs root commands do as well.

Fixes #339
  • Loading branch information
Edward Muller committed Dec 2, 2015
1 parent cf33bd7 commit 8956568
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# v31 2015/12/2
# v32 2015/12/02

* Eval Symlinks in Contains() check.

# v31 2015/12/02

* In restore, mention which package had the problem -- @shurcool

Expand Down
9 changes: 9 additions & 0 deletions vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ func (vf vcsFiles) Contains(path string) bool {
if strings.EqualFold(f, path) {
return true
}
// git's root command (maybe other vcs as well) resolve symlinks, so try that too
// FIXME: rev-parse --show-cdup + extra logic will fix this for git but also need to validate the other vcs commands. This is maybe temporary.
p, err := filepath.EvalSymlinks(path)
if err != nil {
return false
}
if strings.EqualFold(f, p) {
return true
}
}

// No matches by either method
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
)

const version = 31
const version = 32

var cmdVersion = &Command{
Usage: "version",
Expand Down

0 comments on commit 8956568

Please sign in to comment.