From 3145f2ddf0681a62e1d17eed10f8201fd466ac21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4ufl?= Date: Mon, 1 Jun 2015 14:15:12 +0200 Subject: [PATCH] Don't track files outside repository --- commands/command_track.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/command_track.go b/commands/command_track.go index d215b8ee..18f1f02f 100644 --- a/commands/command_track.go +++ b/commands/command_track.go @@ -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 {