as a first pass, wrap the existing code and check for a valid ref
This commit is contained in:
parent
5703b80822
commit
9d1d67f7a5
@ -85,17 +85,21 @@ func cloneCommand(cmd *cobra.Command, args []string) {
|
||||
remote = "origin"
|
||||
}
|
||||
|
||||
includeArg, excludeArg := getIncludeExcludeArgs(cmd)
|
||||
filter := buildFilepathFilter(cfg, includeArg, excludeArg)
|
||||
if cloneFlags.NoCheckout || cloneFlags.Bare {
|
||||
// If --no-checkout or --bare then we shouldn't check out, just fetch instead
|
||||
cfg.CurrentRemote = remote
|
||||
fetchRef("HEAD", filter)
|
||||
} else {
|
||||
pull(remote, filter)
|
||||
err := postCloneSubmodules(args)
|
||||
if err != nil {
|
||||
Exit("Error performing 'git lfs pull' for submodules: %v", err)
|
||||
ref, err := git.CurrentRef()
|
||||
|
||||
if ref != nil {
|
||||
includeArg, excludeArg := getIncludeExcludeArgs(cmd)
|
||||
filter := buildFilepathFilter(cfg, includeArg, excludeArg)
|
||||
if cloneFlags.NoCheckout || cloneFlags.Bare {
|
||||
// If --no-checkout or --bare then we shouldn't check out, just fetch instead
|
||||
cfg.CurrentRemote = remote
|
||||
fetchRef("HEAD", filter)
|
||||
} else {
|
||||
pull(remote, filter)
|
||||
err := postCloneSubmodules(args)
|
||||
if err != nil {
|
||||
Exit("Error performing 'git lfs pull' for submodules: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user