Don't track files outside repository

This commit is contained in:
Michael Käufl 2015-06-01 14:15:12 +02:00
parent ec756f6b15
commit 3145f2ddf0

@ -56,6 +56,12 @@ func trackCommand(cmd *cobra.Command, args []string) {
ArgsLoop:
for _, t := range args {
absT, relT := absRelPath(t, wd)
if !filepath.HasPrefix(absT, lfs.LocalWorkingDir) {
Print("%s is outside repository", t)
os.Exit(128)
}
for _, k := range knownPaths {
absK, _ := absRelPath(k.Path, filepath.Join(wd, filepath.Dir(k.Source)))
if absT == absK {