Merge pull request #2463 from git-lfs/track-symlink-wd
commands/track: resolve symlinks before comparing attr paths
This commit is contained in:
commit
211e886290
@ -56,6 +56,7 @@ func trackCommand(cmd *cobra.Command, args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wd, _ := tools.Getwd()
|
wd, _ := tools.Getwd()
|
||||||
|
wd = tools.ResolveSymlinks(wd)
|
||||||
relpath, err := filepath.Rel(config.LocalWorkingDir, wd)
|
relpath, err := filepath.Rel(config.LocalWorkingDir, wd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Exit("Current directory %q outside of git working directory %q.", wd, config.LocalWorkingDir)
|
Exit("Current directory %q outside of git working directory %q.", wd, config.LocalWorkingDir)
|
||||||
|
@ -463,3 +463,28 @@ begin_test "track escaped pattern"
|
|||||||
assert_attributes_count "\\#" "filter=lfs" 1
|
assert_attributes_count "\\#" "filter=lfs" 1
|
||||||
)
|
)
|
||||||
end_test
|
end_test
|
||||||
|
|
||||||
|
begin_test "track (symlinked repository)"
|
||||||
|
(
|
||||||
|
set -e
|
||||||
|
|
||||||
|
reponame="tracked-symlinked-repository"
|
||||||
|
git init "$reponame"
|
||||||
|
cd "$reponame"
|
||||||
|
|
||||||
|
touch a.dat
|
||||||
|
|
||||||
|
pushd .. > /dev/null
|
||||||
|
dir="tracked-symlinked-repository-tmp"
|
||||||
|
|
||||||
|
mkdir -p "$dir"
|
||||||
|
|
||||||
|
ln -s "../$reponame" "./$dir"
|
||||||
|
|
||||||
|
cd "$dir/$reponame"
|
||||||
|
|
||||||
|
[ "Tracking \"a.dat\"" = "$(git lfs track "a.dat")" ]
|
||||||
|
[ "\"a.dat\" already supported" = "$(git lfs track "a.dat")" ]
|
||||||
|
popd > /dev/null
|
||||||
|
)
|
||||||
|
end_test
|
||||||
|
Loading…
Reference in New Issue
Block a user