Commit Briefs

Stefan Sperling

simplify ancestry checks in checkout, update, rebase, and merge

No behaviour change as the end result of the rewritten checks should be the same as before. We are just doing less work where possible. Patch by James Cook



Omar Polo

got: flush stdout before printing the error in main()

Since standard error is unbuffered, it could happen that the error string is printed immediately while the output from the subcommand is stuck in a buffer and written later. So flush() standard output before printing the error message. Problem reported by naddy@, ok stsp@


Omar Polo

consistently close the struct repository on every cmd_*()

Spotted while looking for leaks using Otto' malloc() new leaks detection. Harmless in practice since we just forgot to call got_repo_close() when terminating in some cmd_*() functions, but still a leak. ok stsp@


Omar Polo

fix crash in got log due to NULL-deref in got_object_blob_close

Reported by Mikhail (thanks!), ok jamsek


Todd C. Miller

Close the message template file before calling edit_logmsg().

Fixes a race condition on NFS where the file's modify time may change while the file is being edited, causing the editor to complain. OK stsp


Omar Polo

histedit_parse_list: avoid needless free(line)

getline(3) allows to safely re-use the storage. While here rename `size' to `linesize', `len' to `linelen', and properly initialize `linesize' to zero; suggested by tb@ ok tb@


Stefan Sperling

fall back to vi(1) instead of ed(1) if neither EDITOR nor VISUAL are set

ed users are reading files with their minds rather then their eyes, and might therefore be missing important visual clues we write into files before the user gets to edit them. Use of vi(1) ensures that such clues will not be missed.


Omar Polo

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>


Omar Polo

fix 'got merge' so it parses gitconfig for author

cmd_merge is the only subcommand that may create commits that doesn't parse the git config files, thusly failing for users without GOT_AUTHOR defined. Problem reported by James Cook who also provided an initial test case, thanks! ok jamsek


Mark Jamsek

add ci/he/mg/rb -C option to commit unresolved conflicts

As per stsp's suggestion and building on his initial diff, add the -C option to enable creating commits with unresolved conflicts to the commit, histedit, merge, and rebase commands to allow continuing the operation despite files in conflict status. Also, only search for conflict markers in newly added lines to enable working with files already under version control that may have conflict markers embedded verbatim. lots of tweaks, improvements, and initial diff + ok stsp@


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@



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@