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

Commit

Permalink
Merge branch 'no_git_show_toplevel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Muller committed Mar 7, 2016
2 parents a0b6eae + 446e2f6 commit 91e0ec8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#v57 (2016/03/07)

* Don't use `git rev-parse --show-toplevel` to determine git repo roots as it resolves symlinks: https://github.com/tools/godep/pull/418

# v56 (2016/02/26)

* replace path comparisons with case insensitive pathEqual()
Expand Down
13 changes: 11 additions & 2 deletions vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var vcsGit = &VCS{
DescribeCmd: "describe --tags",
DiffCmd: "diff {rev}",
ListCmd: "ls-files --full-name",
RootCmd: "rev-parse --show-toplevel",
RootCmd: "rev-parse --show-cdup",

ExistsCmd: "cat-file -e {rev}",
}
Expand Down Expand Up @@ -96,9 +96,16 @@ func (v *VCS) identify(dir string) (string, error) {
return string(bytes.TrimSpace(out)), err
}

func absRoot(dir, out string) string {
if filepath.IsAbs(out) {
return filepath.Clean(out)
}
return filepath.Join(dir, out)
}

func (v *VCS) root(dir string) (string, error) {
out, err := v.runOutput(dir, v.RootCmd)
return filepath.Clean(string(bytes.TrimSpace(out))), err
return absRoot(dir, string(bytes.TrimSpace(out))), err
}

func (v *VCS) describe(dir, rev string) string {
Expand Down Expand Up @@ -146,7 +153,9 @@ func (vf vcsFiles) Contains(path string) bool {
// listFiles tracked by the VCS in the repo that contains dir, converted to absolute path.
func (v *VCS) listFiles(dir string) vcsFiles {
root, err := v.root(dir)
debugln("vcs dir", dir)
debugln("vcs root", root)
ppln(v)
if err != nil {
return nil
}
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 = 56
const version = 57

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

0 comments on commit 91e0ec8

Please sign in to comment.