commands: fetch now defaults to origin remote

This commit is contained in:
rick olson 2017-10-27 16:05:22 -06:00
parent 77ebffe6f1
commit 079c21b6d4
2 changed files with 0 additions and 18 deletions

@ -43,8 +43,6 @@ func fetchCommand(cmd *cobra.Command, args []string) {
Exit("Invalid remote name %q", args[0]) Exit("Invalid remote name %q", args[0])
} }
cfg.SetRemote(args[0]) cfg.SetRemote(args[0])
} else {
cfg.SetRemote("")
} }
if len(args) > 1 { if len(args) > 1 {
@ -268,16 +266,6 @@ func scanAll() []*lfs.WrappedPointer {
// Fetch and report completion of each OID to a channel (optional, pass nil to skip) // Fetch and report completion of each OID to a channel (optional, pass nil to skip)
// Returns true if all completed with no errors, false if errors were written to stderr/log // Returns true if all completed with no errors, false if errors were written to stderr/log
func fetchAndReportToChan(allpointers []*lfs.WrappedPointer, filter *filepathfilter.Filter, out chan<- *lfs.WrappedPointer) bool { func fetchAndReportToChan(allpointers []*lfs.WrappedPointer, filter *filepathfilter.Filter, out chan<- *lfs.WrappedPointer) bool {
// Lazily initialize the current remote.
if len(cfg.Remote()) == 0 {
// Actively find the default remote, don't just assume origin
defaultRemote, err := cfg.GitConfig().DefaultRemote()
if err != nil {
Exit("No default remote")
}
cfg.SetRemote(defaultRemote)
}
ready, pointers, meter := readyAndMissingPointers(allpointers, filter) ready, pointers, meter := readyAndMissingPointers(allpointers, filter)
q := newDownloadQueue( q := newDownloadQueue(
getTransferManifestOperationRemote("download", cfg.Remote()), getTransferManifestOperationRemote("download", cfg.Remote()),

@ -440,12 +440,6 @@ begin_test "fetch with no origin remote"
# and no origin, but only 1 remote, should pick the only one as default # and no origin, but only 1 remote, should pick the only one as default
git lfs fetch git lfs fetch
assert_local_object "$contents_oid" 1 assert_local_object "$contents_oid" 1
# delete again, now add a second remote, also non-origin
rm -rf .git/lfs
git remote add something2 "$GITSERVER/$reponame"
git lfs fetch 2>&1 | grep "No default remote"
refute_local_object "$contents_oid"
) )
end_test end_test