diff --git a/commands/command_get.go b/commands/command_get.go index 96a189ec..362655ab 100644 --- a/commands/command_get.go +++ b/commands/command_get.go @@ -51,16 +51,21 @@ func getCommand(cmd *cobra.Command, args []string) { } if target == current { + // We just downloaded the files for the current ref, we can copy them into + // the working directory and update the git index for _, pointer := range pointers { file, err := os.Create(pointer.Name) if err != nil { Panic(err, "Could not create working directory file") } - err = lfs.PointerSmudge(file, pointer.Pointer, pointer.Name, nil) - if err != nil { + if err := lfs.PointerSmudge(file, pointer.Pointer, pointer.Name, nil); err != nil { Panic(err, "Could not write working directory file") } + + if err := git.UpdateIndex(pointer.Name); err != nil { + Panic(err, "Could not update index") + } } } } diff --git a/git/git.go b/git/git.go index a95397b0..77f31fa2 100644 --- a/git/git.go +++ b/git/git.go @@ -61,6 +61,11 @@ func CurrentRemote() (string, error) { return remote + "/" + branch, nil } +func UpdateIndex(file string) error { + _, err := simpleExec(nil, "git", "update-index", "-q", "--refresh", file) + return err +} + type gitConfig struct { }