Commit Briefs

Mark Jamsek

got: further fetch tweaks to prevent unintended fetches

Implement stsp's suggestion to only fetch remote's HEAD if the symref refs/remote/*/HEAD exists, and its target no longer matches the remote HEAD. This ensures users tracking a project won't miss a change in HEAD, while also fixing the issue reported by naddy where HEAD was fetched by default even though a specific, potentially less active, branch is cloned, resulting in a repository with more commits than necessary. In addition, unless 'got fetch -b <branch>' is used, the remote HEAD branch will be fetched if branches are not set in got.conf and there is no work tree to ascertain a branch, or said branches are not found on the server. ok stsp@


Mark Jamsek

unbreak send.sh regress from recent ref-delta changes

fix argument order typo in flags passed to got_pack_create()






Omar Polo

regress: run gotadmin pack -D if $GOT_TEST_PACK=ref-delta

ok stsp


Omar Polo

gotadmin pack: add a -D flag to force using ref-delta

Intended mostly for the regress suite, so we'll be able to test also the ref-delta code paths. ok stsp@



Omar Polo

regress: allow to run only a subset of the test cases

This allows to run only the test cases named on the command line.



Mark Jamsek

keep regress testname copypasta fix from 2a19e2e21a

s/fetch_branch/fetch_honor_wt_conf_bflag so we don't report the wrong test in the case of failure. The incorrect testname was introduced in 1cb79834ea as the result of too much copypasta. It was subsequently fixed in 2a19e2e21a but then backed-out.


Stefan Sperling

backout got: always fetch remote HEAD except when -b is used

As pointed out by naddy, this behaviour is not ideal when users want to limit their repository to a particular branch which will diverge from HEAD over time, such as -stable branches. See https://marc.gameoftrees.org/mail/1676388048.8632_0.html


Mark Jamsek

got: always fetch remote HEAD except when -b is used

Rather than only fetch HEAD when there are no branches set in got.conf and there is no branch to be inferred from a work tree, or said branches don't exist on the server, always fetch HEAD unless 'got fetch -b branch' is used. ok stsp@



Mark Jamsek

got: drop commit -A $GOT_AUTHOR restriction

As discussed with op and stsp on irc, this prevents the valid case of changing a commit's author to yourself during a histedit operation, and potentially blocks other valid use cases too. ok stsp@ and op@


Omar Polo

got/tog/gotadmin: pledge earlier

In the case of tog move setlocale(3) before pledge(2), as suggested by stsp. ok stsp@



Mark Jamsek

make 'got fetch -b branch' error reporting more helpful

The patch to got-fetch-pack.c was written by stsp with only minor tweaks by me. Regress updated to account for the change in reporting. stsp's original got-fetch-pack.c diff ok op jamsek ok stsp@


Mark Jamsek

regress: fetch -b/got.conf/wt/remote HEAD interaction

The added test checks we honour the correct precedence of branches to be fetched, which is determined by: the -b flag; branches set in got.conf; the work tree's current branch; and the remote repository's HEAD branch. If a branch is specified with -b, only fetch this branch and if it does not exist, simply report to the user--do not fallback to other branches. Otherwise, if branches are either not set in got.conf or are set but do not exist on the server: - if invoked in a work tree, fallback to the work tree's current branch - if not in a work tree or the work tree's current branch does not exist on the server: - fallback to remote HEAD. With this, only the -b case can result in an unsuccessful fetch due to the requested branch(es) not existing on the server. All other cases will either fetch updates or report "Already up-to-date" (excepting errors). ok stsp@


Mark Jamsek

special case 'got fetch -b <branch>' to only fetch <branch>

As discussed on irc, this drops the implicit remote HEAD fetch when -b is used. got.1 has been updated to make the new fetch behaviour clear. ok stsp@


Omar Polo

style


Omar Polo

typo



Omar Polo

lib/object_create.c: calloc object ids

future fields added to the got_object_id will be implicitly zeroed instead of gibberish. ok stsp@