Commit Briefs

be97ab03ef Thomas Adam

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@


92a5690723 Thomas Adam

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@


e80ef83ebe Thomas Adam

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@


53d03f970a Thomas Adam

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@


a6d62598bf Thomas Adam

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@


772fcad514 Thomas Adam

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@


6d054bb9e3 Thomas Adam

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@


3387ec827e Thomas Adam

tog: fix typo in diff nlines > 0 check

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


7e1f3a3d0f Thomas Adam

check for fprintf failure


82c78e96f1 Thomas Adam

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@


8b925c6ccd Thomas Adam

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.


25ec70067d Thomas Adam

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


dd2e2f52c1 Thomas Adam

move more opentemp out of diffreg.c

ok tracey


19a6a6b5ee Thomas Adam

move got_opentempfd() out of lib/diff.c again

ok tracey


f4ae6ddb59 Thomas Adam

move got_opentempfd out of open_blob. ok stsp@


0c6f49baf2 Thomas Adam

build with -Wwrite-strings

Throwing this into the mix for a while, we can always get rid of it again if it becomes annoying. No objections from stsp@


9b4458b410 Thomas Adam

always show commit or tree IDs in diff header, in order to help 'got patch'

The idea is that got patch can simply look for a line such as: commit - abcde1234567... to find the merge base commit ID to show in diff3 conflict markers. got log -p now displays commit IDs in its diff header, instead ofl tree or blob IDs. ok op@


1758cce789 Thomas Adam

reuse a temporary file across commits during got log -p -S

suggested by + ok op@


a0f32f336e Thomas Adam

move creation of tempfiles outside of lib/diff.c

ok tracey


4c71f93b66 Thomas Adam

sort paths in got log -Pp and tog's diff view the same way as in the diff

reported by and fix confirmed by naddy


cc8021afc2 Thomas Adam

implement 'got diff -c' for diffing commits with optional filtering by path

Need for filtering by path sugggested by kn@ ok naddy@


92a9e85d28 Thomas Adam

portable: add FreeBSD support

This adds the capability to compile got-portable on FreeBSD.


dd038bc6ec Thomas Adam

portable: initial Linux compilation

This commit modifies the GoT main branch to be able to compile it under linux.


56b63ca4ab Stefan Sperling

make fclose(3) failure checks consistent; check 'fclose() == EOF' everywhere

ok millert, naddy


9c659ea03e Stefan Sperling

do not forget to add an offset for line zero in diff_blobs()

Fixes a problem in 'tog diff' where the first line of the output was cut off.