Update the index when replacing files in the wd with get
This commit is contained in:
parent
740ba62254
commit
8d2d8264f7
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user