Commit Briefs
CHANGES for 0.126 (tags/0.126)
always create initial Git config files when cloning
For SHA256 network support we must always create configuration files as soon as server-side capabilities have been announced. Otherwise we cannot reliably stamp the repository with the correct object format. test_clone_dangling_headref is triggering this condition. We don't have symrefs (only an explicit -b foo) so we never switch the repo to sha256 format. Requiring symrefs for creation of the initial Git config is no longer necessary. If the server does not send announce a HEAD symref as part of its capabilities then we have workarounds for this in got.c:cmd_clone(). The workarounds did not yet exist when the condition removed here was added.
got-fetch-pack: send_object_format() before send_fetch_symref()
otherwise we fail in fetch.c because we get zero (GOT_HASH_SHA1) as object format when we might not expect it.
initial sha256 support in the network protocol
fetch and send to/from sha256 repositories now actually works. many thanks to runxiyu on irc for making me realize that we don't actually need to support the Git protocol v2 for sha256, but just enable the capability, which is what this diff does. Clone still needs work. For now, a workaround is to create an empty sha256 repository locally, add the remote and fetch instead. No regress test enabled yet since they all depend on clone to work.
we cannot run test_checkout_bad_tree_entry with sha256 yet
This test would require an equivalent bundle file in sha256 format. Mark it as no-sha256 for now.
fix test failures with Git 2.54.
As of Git 2.54, the automatic maintenance strategy now defaults to "geometric repacking", which writes multi-pack-index (MIDX) files which Game of Trees lacks support for. If 'gotadmin cleanup' is run on repositories using MIDX files then 'git fsck' will complain. To keep test_cleanup_redundant_pack_files passing we can disable automatic maintenance on Git repositories used by the test suite. Which our test suite should have been doing anyway for predictable results. Problem first reported by naddy@ in https://marc.gameoftrees.org/mail/1778459401.3079_0.html Thanks to Patrik Steinhardt for explaining the Git-side changes to me.
fix serving a branch of unrelated history with gotd
Fix a case where gotd started sending pack progress output in response to the client sending 'done', without any ACK or NAK in-between. I saw this happen when trying to fetch an unrelated main branch from gotd, with completely different history and initial root commit, into an existing repository with a different main branch history. Add test cases covering 'got fetch' against a git-upload-pack server (is always passing), and 'got fetch' and 'git fetch' against gotd (was not passing, i.e. both got and git fail to fetch unless this fix is applied). ok op@
do not forget to add loose parent commits to pack files
Fixes problems where 'got send' omits some parent commits from history which ought to be sent to the server. ok op@
store repository test data in a bundle to avoid a dependency on xxd
pointed out by naddy, we cannot reasonably expect xxd to exist everywhere
CHANGES for 0.125 (tags/0.125)
prevent NULL pointer dereferences when empty tree objects are encountered
Found by me while investigating the issues reported by Runxi Yu. The test added here would trigger a crash in tog using a modified version of Runxi Yu's bug reproduction script.
avoid checking out tree entry names "." and "..", and names containing "/"
This would allow malicious repositories to perform arbitrary file overwrites with user permissions via crafted tree entry names. The regression test added here shows that such repositories can be trivially created with Git. On operating systems which lack unveil(2) any user-writable file could be created or changed. On OpenBSD, unveil(2) restricts arbitrary write access to the work tree itself and the /tmp directory. Problem reported me by Runxi Yu, along with a reproduction script I could use to write the regression test. Thanks!
reject attempts to put versioned files into .git, .got, or .cvg directories
Versioned files inside the work tree's meta-data .got directory could be created during 'got checkout' or changed during 'got update'. Files in the meta-data directory should never be under version control, yet the implementation unfortunately allowed this. Which provides a way for malicious repositories to configure remote servers stored in .got/got.conf which would then be used by the fetch and send commands. Problem spotted by Runxi Yu and reported to me on IRC. testing + ok Thomas Adam
cleanup: fix redundant pack file removal when repository contains symlinks
Add symlinks to the set of traversed object IDs during cleanup. Otherwise, packfiles which contain blobs that are symlinks will always be marked as containing unreferenced objects and 'gotadmin cleanup' will not remove them. This can result in an explosion of redundant packfiles if 'gotadmin cleanup' is run at regular intervals, and if the cleanup -a option is not used. I am unsure how to write a test case for this fix without making additional changes to the cleanup command. The tests run cleanup -a to bypass the mtime staleness safety check. This will never hit the problematic case fixed here. Reproducing the problem would require a test which waits for the (currently) hard-coded interval of 600 seconds before running cleanup. If we added a way to tweak the mtime threshold from tests then we could probably add a test case which covers this issue. Problem found because gothub.org backups were taking much more disk space than expected. ok runxi yu, op@
