Merge pull request #1507 from sschuberth/fetch-without-remote

Allow fetch to run without a remote configured
This commit is contained in:
Taylor Blau 2016-09-06 11:38:10 -06:00 committed by GitHub
commit 9713ed84e0

@ -42,12 +42,7 @@ func fetchCommand(cmd *cobra.Command, args []string) {
} }
cfg.CurrentRemote = args[0] cfg.CurrentRemote = args[0]
} else { } else {
// Actively find the default remote, don't just assume origin cfg.CurrentRemote = ""
defaultRemote, err := git.DefaultRemote()
if err != nil {
Exit("No default remote")
}
cfg.CurrentRemote = defaultRemote
} }
if len(args) > 1 { if len(args) > 1 {
@ -246,6 +241,16 @@ func fetchPointers(pointers []*lfs.WrappedPointer, include, exclude []string) bo
// 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, include, exclude []string, out chan<- *lfs.WrappedPointer) bool { func fetchAndReportToChan(allpointers []*lfs.WrappedPointer, include, exclude []string, out chan<- *lfs.WrappedPointer) bool {
// Lazily initialize the current remote.
if len(cfg.CurrentRemote) == 0 {
// Actively find the default remote, don't just assume origin
defaultRemote, err := git.DefaultRemote()
if err != nil {
Exit("No default remote")
}
cfg.CurrentRemote = defaultRemote
}
ready, pointers, totalSize := readyAndMissingPointers(allpointers, include, exclude) ready, pointers, totalSize := readyAndMissingPointers(allpointers, include, exclude)
q := lfs.NewDownloadQueue(len(pointers), totalSize, false) q := lfs.NewDownloadQueue(len(pointers), totalSize, false)