0159f6c769
Now that we're not pretending to download objects we already have, we wouldn't check out objects missing in the working copy but which were already present. It's better to do exactly what it says on the tin anyway, identical to separate fetch & pull.
35 lines
832 B
Go
35 lines
832 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/github/git-lfs/git"
|
|
"github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
pullCmd = &cobra.Command{
|
|
Use: "pull",
|
|
Short: "Downloads LFS files for the current ref, and checks out",
|
|
Run: pullCommand,
|
|
}
|
|
)
|
|
|
|
func pullCommand(cmd *cobra.Command, args []string) {
|
|
|
|
ref, err := git.CurrentRef()
|
|
if err != nil {
|
|
Panic(err, "Could not pull")
|
|
}
|
|
|
|
// Previously we would only checkout files that were downloaded, as they
|
|
// were downloaded. However this would ignore files where the content was
|
|
// already present locally (since these are no longer included in transfer Q for
|
|
// better reporting purposes).
|
|
// So now we do exactly what we say on the tin, fetch then a separate checkout
|
|
fetchRef(ref)
|
|
checkoutAll()
|
|
}
|
|
|
|
func init() {
|
|
RootCmd.AddCommand(pullCmd)
|
|
}
|