Commit Briefs

Stefan Sperling

make diffing files which changed into dirs and vice-versa possible

Problem marked with a TODO comment by me ages ago and rediscovered by naddy@ ok op@


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

introduce got_object_id_hex to replace some got_sha1_digest_to_str()

It's an analogous to got_object_id_str but writes to the given buffer. ok + improvements by stsp@


Mark Jamsek

refactor got log -d and tog diffstat to compute diff once

This eliminates the previous performance cost by making 'got log -d' and tog diff view compute the diffstat while building the diff in a temp file like we do with 'got diff -d'. Also, keep the current 'got log -d' UI as per stsp's suggestion. ok stsp@


Mark Jamsek

got: style(9) and cleanup failure leaks lib/diff.c

Spotted while implementing diffstat plus one introduced with diffstat code. Don't leak 'change' on got_pathlist_append() error. And don't leak modestr{1,2} and l{1,2} char pointers in diff_blobs() and got_diff_tree(), respecitvely. Regarding modestr leaks, rather than free at all error return points, use op's suggestion to lift modestr vars to function scope. ok op@


Mark Jamsek

add regress for 'got diff -d' and minor output fix

Ensure an actual file path is displayed in the 'got diff -d -c commit path ...' case when one of the specified paths is a deleted file. Prior to this, the unhelpful "/dev/null" label was shown instead. Includes some copypasta fixes noted by op. ok stsp@ op@


Mark Jamsek

got: expand diffstat -d option to 'got diff'

Like got log -d, add the switch to 'got diff' to display a diffstat of changes; as per stsp's suggestion, we always include diff output with the diffstat. Disabled in gotwebd (for now :) Includes tweaks from op@ ok stsp@


Mark Jamsek

plug leak of got_diffreg_result on output failure

Move 'done' labels up so that if got_diffreg_output() fails we still call got_diffreg_result_free() instead of jumping straight over it. ok + fix from stsp@


Mark Jamsek

got: implement diffstat for got log and tog diff view

Add new got_diff_blob_cb() implementation to compute added/removed line metrics for a given diff. This enables displaying a diffstat with 'got log -d'. As per suggestion from stsp, change tog diff view to display the diffstat by default. ok stsp@


Mark Jamsek

show file mode for new added files in work tree diffs

Make work tree diffs of local changes on disk display the file mode of new added files like other versions of `got diff` currently do. ok stsp@


Mark Jamsek

tog: fix typo in diff nlines > 0 check

We want to check if *nlines is greater than zero here. ok op@ and stsp@


Omar Polo

check for fprintf failure


Mark Jamsek

tog: keymaps to jump to next/prev file/hunk in the diff

Add () and {} key maps to navigate to the previous and next file or hunk in the diff. This required changing Got's diff API to collect line type metadata in addition to the line offsets already produced as prompted by stsp. ok stsp@


Stefan Sperling

switch 'tog diff' and 'tog blame' to Myers diff for speed

Make the choice of diff algorithm configurable by diff API users. The got and gotweb programs keep using Patience diffs which are prettier than Myers. But tog should be as fast as possible since it is being used interactively. If performance of Patience diff gets improved later we can consider switching tog back over to it. ok tracey jamsek


Stefan Sperling

move more opentemp out of diffreg.c

ok tracey