Commits


attempt to kill http-server when tests exit abnormally


fix test dir name


add a basic test for HTTP protocol used with 'got fetch'


allow remotes without urls in git config Also, add tests. This change lets got and related tools work when the git config file has "remote" sections without urls, like this one in one of my git-annex git repositories: [remote "h0-rsync"] annex-rsyncurl = (some url) annex-uuid = (some uuid) skipFetchAll = true Running tog and many got commands there would previously result in: $ tog got-read-gitconfig: gitconfig syntax error tog: gitconfig syntax error The change to got-read-gitconfig.c is by stsp@, with ok from op@ (and now me). Tests ok stsp@.


replace "(cd path && git cmd)" with "git -C path cmd" This matches the existing use of "got -r path cmd" and "git_commit path args".


honor fetch_all_branches configuration again Fix a regression in db82695e31945b3ce001a5fb69674c3638622368 where the fetch_all_branches configuration setting from got.conf was dropped and always defaulted to "no". Add corresponding regression test. ok stsp


put actions in test_fetch_all into more logical order ok stsp


regress/cmdline: fix handling of unexpected success Diff from James Cook, thanks!


regress: replace "sed -i" with ed(1) for portable in-place editing "sed -i" is fundamentally unportable. GNU and OpenBSD sed(1) treat the extension for the backup file as an optional argument and use "sed -i" for no backup file. FreeBSD sed(1) treats the extension as an obligatory argument and uses "sed -i ''" for no backup file. There is no single syntax that works for both. ok stsp op


fix "got fetch" hang against out-of-date remote repositories Do not assume that remote repositories will always have our objects. In Git protocol terms: Do not wait for an ACK from the server before sending the final "done" message. Otherwise servers might be waiting for more have-lines from us in order to find a common ancestor, which will never be sent by us. Problem reported by James Cook who also provided an initial test case ok op@


update regress for fetch tweaks added in previous commit ok stsp@


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.


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


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@


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@


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@


fix interaction of 'got fetch -b', got.conf, and work tree Without branches in got.conf for a remote, and without -b/-R options, the fallback to HEAD would only work when not invoked in a work tree. With this fix 'got fetch' should behave as described in the man page. The -b option now overrides both got.conf and the fallback to the work tree's branch. And fallback to HEAD works as expected when invoked in a repository. Also, do not strictly require remote repositories to provide a branch from the refs/heads/ namespace. In such cases users should be able to use -R to select something to fetch. ok jamsek


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. ok jamsek


add test coverage for new 'got fetch' default behaviour


set `ret' in a few places where it was forgotten; ok tracey@


use test(1) -eq and -ne to compare integers, and reduce quoting This brings the rest of the regression test scripts in line with patch.sh.


fix a null-pointer deref in 'got fetch -d'; reported by Omar Polo


fix name of temporary directory used by test_fetch_delete_remote_refs


make "got branch -d" print reference name and value Also silence output of "got branch -d" in a regression test, from stsp. ok stsp


use POSIX [ s1 = s2 ] syntax instead of [ s1 == s2 ]