Merge branch 'panic-fix' of https://github.com/michael-k/git-lfs into michael-k-panic-fix
This commit is contained in:
commit
d71ad5bec5
11
lfs/lfs.go
11
lfs/lfs.go
@ -160,7 +160,16 @@ func processDotGitFile(file string) (string, string, error) {
|
|||||||
wd, _ := os.Getwd()
|
wd, _ := os.Getwd()
|
||||||
if strings.HasPrefix(contents, gitPtrPrefix) {
|
if strings.HasPrefix(contents, gitPtrPrefix) {
|
||||||
dir := strings.TrimSpace(strings.Split(contents, gitPtrPrefix)[1])
|
dir := strings.TrimSpace(strings.Split(contents, gitPtrPrefix)[1])
|
||||||
absDir, _ := filepath.Abs(dir)
|
|
||||||
|
if filepath.IsAbs(dir) {
|
||||||
|
// The .git file contains an absolute path.
|
||||||
|
return wd, dir, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// The .git file contains a relative path.
|
||||||
|
// Create an absolute path based on the directory the .git file is located in.
|
||||||
|
absDir := filepath.Join(filepath.Dir(file), dir)
|
||||||
|
|
||||||
return wd, absDir, nil
|
return wd, absDir, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user