Commit Briefs

Thomas Adam

prevent a double-free in got_worktree_commit

If creating the /tmp display diff for a commitable item failed we would free the commitable item while it was already on the path list. Later on when the path list was freed in got_worktree_commit() a double-free would be detected and the program would be aborted. Found by gonzalo@ ok op@


Thomas Adam

make gotd flush pending messages before disconnecting the client upon success

This prevents gotd from closing the client connection before ref-update status reports have been sent. Seen while testing gotd on Linux, though I see no obvious reason why this race would not trigger on OpenBSD.



Thomas Adam

tog: don't show the base commit marker in limit view

The limit commit queue is invariably filled with different commits to the queue containing all commits, so the index of the work tree's base commit in the real queue corresponds to a different commit in the limit queue. As such, the marker is drawn on an incorrect commit. Rather than fix this to draw the marker on the correct commit if it happens to be in the limit queue, don't draw the marker at all in limit view. As pointed out by Mikhail on the list, this information is not wanted in the limit view. Patch and report by Mikhail.


Thomas Adam

gotsh: do not set POLLOUT flag when there is no data to send

Prevent an endless polling loop on Linux where POLLOUT and POLLHUP can both be reported via pollfd revents.


Thomas Adam

don't include sys/cdefs.h

"thou shalt not include sys/cdefs.h because it is not standardized", and in this case is not really needed either.


Thomas Adam

document that the log -d option implies log -P

We did consider making -d and -P options conflict but doing so would not be very helpful. Instead, document -d as a superset of -P. ok op, jamsek



Thomas Adam

gotwebd: fix branches modification time with show_repo_age off

If show_repo_age is set to off, got_get_repo_age() returns without setting the timestamp. got_get_repo_age() is also used by the branch listing to show how old they are however, and we end up rendering the stack garbage. Instead, respect `show_repo_age off' one layer above, and always return a timestamp in got_get_repo_age(). While here, initialize the timestamp to zero so it's set also in case of failures. Issue reported on IRC by xs, thanks!


Thomas Adam

tog: fix log view search infinite loop

When the current matched and selected entry is the last loaded commit, we keep looping the same code path because search_entry is always NULL. Before poking the log thread for more commits, set search_entry to the currently selected commit, which is where the search resumes. Patch by Mikhail



Thomas Adam

got: regress for log -x keyword and log -dPp combinations

Plus multiple copypasta fixes where I was cmp(1)ing stdout instead of stderr! Fortunately, we were doing the right thing despite not checking it properly. The log -dPp test is from op@. ok + tweaks op@


Thomas Adam

fix 'got log -dPp' diffstat duplication bug

Only collect changed paths once if both -d and -P are specified; we already checked for -d and -p. Reported by Lucas on IRC. Regress for this and the previous (got log -x keyword) commit still due. ok stsp@ and op@


Thomas Adam

got: allow 'got log -x' to accept keywords

Suggested by Lucas on IRC. ok stsp@ and op@


Thomas Adam

bump the deltify table resize step

By incrementing the resize step from 64 to 256 deltifying takes less time on modestly sized files; the resize is still a small number instead of a fraction of the current table size (which would be more usual for a hash table) since this code is also used in gotd. ok stsp


Thomas Adam

use INT32_MAX rather than INT_MAX for GOT_FILEIDX_MAX_ENTRIES

it's a different way to spell the same number, but it's more evocative since the on-disk format is 32 bits wide. ok stsp


Thomas Adam

speed up read_fileindex_path()

Use a local buffer instead of calling reallocarray() every 8 bytes; the speed up is measurable. The downside is that we're now limited to paths long at most PATH_MAX bytes, but since this is the fileindex it's not an issue in practice. ok jamsek stsp



Thomas Adam

allow modified files to be deleted during merges if content exists in the repo

This makes histedit folding work when a file is modified by commit A and then deleted in commit B, with A being folded into B. Problem reported by naddy@


Thomas Adam

fix occasional test failure in test_log_show_base_commit

Patch by jamsek with a request to commit. Thanks!


Thomas Adam

prevent ncurses signal handlers from being installed while using mock-io

Aborting tog regress with Ctrl-C would trigger a "tty" pledge violation via the built-in ncurses handler for SIGINT, installed by newterm(). Install tog's own signal handlers earlier to fix this.



Thomas Adam

rename a few pop_id to pop_idx

leftover from 79c49d8454.


Thomas Adam

fix some non-idiomatic calls of the cancellation callback

This callback could return any error code. Do not mask all such errors as cancellation.