Commits


plug leak in got_fetch_pack error path set err and goto done instead of an early return that leaks various things. ok jrick


significantly reduce the amount of code linked into gitwrapper By moving got_serve_parse_command() from lib/serve.c into lib/dial.c as got_dial_parse_command(), we can significantly reduce the amount of symbols gitwrapper depends on indirectly. As a downside, gotsh now needs to link to dial.c. But it only uses the same parsing routine, and any other routines in dial.c would likely cause pledge violations in gotsh if used. No functional change.


portable: configure: split out dependencies Rather than assume all dependencies are required for all programs, split them out. This will make packaging easier, as well as splitting the code to use subprojects. Note that due to the use of config.h semantics, in most cases the got_compat.h header file is now at the top of the .c file it is included in, so that it can handle the system header inclusion properly.


portable: rework SHA detection Simply the SHA detection by not predicating on libcrypto, but instead checking individual header files.


portable: remove sha1.h; found portably Remove sha1.h as this is found portably across systems.


rename lib/sha1.c to lib/hash.c It will soon grow functions to deal with sha256 too. stsp@ agrees.


include sha2.h too where sha1.h is included In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


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@


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@


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


got: minor refactor of got_pathlist_free() API Accept flag parameter to optionally specify which pointers to free. This saves callers looping through the list to free pointers. ok + fix stsp@


use mkstemps(3) instead of mkstemp(3) for opening named temporary files Allows 'got commit' to use a ".diff" suffix for temporary diff files. ok op@


remove trailing whitespace; patch by Josiah Frentsos


portable: add back sys/queue.h Now that the handling of including sys/queue.h is better, there's no need to remove those lines from the source. Copy the location of those original sys/queue.h lines from upstream at the same line number, so as to avoid any conflicts in the future.


plug a memory leak in got_fetch_pack(); patch by Mikhail


portable: make UUID includes generic Move the detection of UUID header files to be included portably. This will have no functional effect until MacOS detection is put in place.


factorize imsg_clear calls after imsg_flush failures imsg_clear frees and closes resources allocated as part of enqueueing imsgs so it's a no-op after reads. discussed with and ok stsp@


fix fd leak in got_fetch_pack, ok stsp@


whitespace


portable: tree/queue header fixes sys/{tree,queue}.h are looked up via configure, and therefore are included via that mechanism.


use RB_TREE instead of STAILQ to manage packindex bloom filters; much faster


portable: update to handle bloom, etc Update portable to support changes for bloom, etc.


use RB_TREE instead of STAILQ to manage packindex bloom filters; much faster


let 'got fetch' send all references to the server to avoid redundant downloads Problem reported by naddy. ok naddy


fix 'got fetch' downloading too many objects in some cases Always announce all local references to the server when fetching changes. We used to do this only in mirror mode. In regular mode only refs/tags and refs/remotes/origin were announced, which could result in unnecessary downloads if relevant objects exist in refs/heads or elsewhere.