Commits


prevent tog segfault upon unexpected object type in ref list view If an unexpected object type is found while resolving a reference in the ref view, have tog exit with an "unknown object type" error instead of crashing. Found while playing with a repo which contains tags that tag tags.


set pointers to NULL after freeing in tog's view_close()


tog: show shortened "id1 -> id2" as path in diffstat when diffing blobs This matches the output of "got diff -d". ok jamsek


tog: expand diffstat to all diff views Suggested by naddy: display diffstat in diff views of arbitrary commits. For the sake of consistency, show it in tree and blob diffs now too. Adjust and grow regress to cover the change. ok stsp@


tog diff 'p' keymap: show id prefix in diff filename This helps identify diffs when several have been written. Suggested by stsp on IRC. ok stsp@


tog: add diff view 'p' keymap to write the diff to file Write the current diff view to a temporary patch file in /tmp and report the pathname to the status line. discussed with naddy input and ok stsp@


zap redundant free This pointer is owned by the caller and is freed in error paths via close_diff_view() ok stsp@


use local temporary convenience pointer missed in 28c5a8280b ok stsp@


add tog log 'm' keymap to mark arbitrary commits to diff Enable "marking" an arbitrary commit in the log view to open a diff view showing the changes between it and the next commit selected with 'return'. Entering 'm' on an already marked commit unmarks it. input from and ok stsp@


backout 4f73a04b63 "Remove unnecessary sched_yield(2)" this made tog regress hang in an infinite loop, reported by naddy. Remove unnecessary sched_yield(2). Re-applies commit 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491 which was reverted in commit 82954512f323c8a2d4f89d51be1e6b0f707b6c3a because at the time the change broke the 'search' feature. Quick testing suggests search is now working fine, so let's try again.


tog: squish horizontal scroll bug that draws trailing '.' When calling span_wline() to compute the number of columns to skip on a string with a column length less than or equal to the number of columns we want to skip (i.e., that the user has scrolled right), the call to wcwidth(3) returns -1 for a '\n', which we replace with a '.' character. Trim trailing newlines before calling span_wline(). ok op@


fix diff view J keymap to diff the next commit in the log When the last visible commit in the log view is selected while in a log/diff horizontal split, and fullscreen is then toggled in the diff view, the user cannot scroll to the next commit with the diff view J keymap due to a bad predicate guarding a clamp to prevent scrolling off-screen that should only be applied when in the horizontally split log view and not when scrolling from the diff view. The fix also reveals an off-by-one that's only applicable in the hsplit case in the subsequent commit loading logic that also breaks J when attempting to scroll beyond the last loaded commit. New regress added to cover these cases. ok op@ (caveated that he's unsure exactly why the OB1 fix works)


Remove unnecessary sched_yield(2). Re-applies commit 6b8a2b8fcd99c4365b1aa9513c0f0149beac2491 which was reverted in commit 82954512f323c8a2d4f89d51be1e6b0f707b6c3a because at the time the change broke the 'search' feature. Quick testing suggests search is now working fine, so let's try again.


replace date, strftime %G-%m-%d with %F Use the more predictable %F, aka %Y-%m-%d, instead of %G-%m-%d. %G follows the definition of ISO-8601 week-based year, which is weird. In particular, 2024 is one of such years with weird behaviour: $ date -jf %Y-%m-%d +"%F %G-%m-%d" 2024-12-30 2024-12-30 2025-12-30 Diff from Lucas Gabriel Vuotto (thanks!); stsp agrees


rename got_commit_graph_iter_start() to got_commit_graph_bfsort() This function begins a breadth-first traversal. The new name makes it easier to distinguish from got_commit_graph_toposort().


ensure tmp file is closed and fix UB in diff error path As reported by op, we fail to close a tmp file in some diff failure case. Also spotted by op and stsp, set FILE pointer to NULL after fclose(3) failure so we no longer attempt to access the stream or close it again in close_diff_view(). fix plus ok op@ and stsp@


plug leak of commit object in 'tog diff' error path tweaked by + ok op@


tog: plug object id leak in diff view; ok op@


tog: plug commit object leak in 'tog tree'; ok op@


tog: plug colors memleak in log view; ok op@


make 'tog diff' release the work tree lock earlier Avoids 'work tree is already locked' errors from got commands while the 'tog diff' command remains running.


tog: make patience the default diff algorithm As discussed on IRC. It makes nicer diffs and the performance hit should only be noticeable with the odd large diff. It might also be a motivator in trying to speed up the patience implementation. ok stsp@


tog: add basic regress for log limit and log search This required minor changes to tog.c to teach tog the new test instructions and feed it search terms when driven by the harness. More is needed for these features but this provides some basic coverage for the & and / log keymaps. ok stsp


plug line_offsets leak in tog blame view; ok op@


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.