Download raw body.
improve got fetch error reporting
On 23-02-05 11:12PM, Stefan Sperling wrote: > On Sun, Feb 05, 2023 at 05:34:11PM +1100, Mark Jamsek wrote: > > On the topic of got's new fetch behaviour, do you think it would be a > > good idea to fallback to the branch resolved by the remote's HEAD ref > > if 'got fetch' is run in a work tree without -b? > > > > So, 'got fetch' will first attempt to fetch the work tree's current > > branch, but if not found it will fetch the remote repository's HEAD. > > Yes, I think that is indeed better than just erroring out. > Below is a new patch which includes your suggestion. > > However, while working on this I realized that our assumptions about > the intended default behaviour have been wrong. Please check the log > message and diff below. This now seems a lot more consistent to me. > > ----------------------------------------------- > > improve 'got fetch' behaviour when work tree's branch is not on server > > Only fetch the work tree's branch if the -b option is not specified. > This keeps -b functional as an override when invoked in a work tree. > > Our previous changes did not consider that got.conf is also a source > of lists of branches to fetch, and that -b is supposed to work as an > override of any default behaviour. We were implicitly appending the > work tree's branch as if it was mentioned as an override on the > command line, which was wrong and based on a misunderstanding of > the intended behaviour. > > Without -b on the command line we obtain a list of branches to fetch > from got.conf and use this list if it is not empty. The repository's > HEAD will be fetched only if neither the -b option, nor got.conf, nor > a work tree tell us what to fetch. > > Make the man page more clear by moving the explanation of the default > behaviour into the main section of 'got fetch', leaving the -a and -b > option descriptions free of such details. Yes, I like this much better! I was a little concerned by erroring out if fetching from a worktree with a checked-out branch that doesn't exist on the server. I prefer this behaviour. Thank you for unwrapping this :) ok -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
improve got fetch error reporting