Commits


consistently use ten Xs in mkstemp(3) templates patch from Josiah Frentsos, thanks!


add missed `size' initialization for use with getline(3) ok tb@


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>


use mkstemps(3) instead of mkstemp(3) for opening named temporary files Allows 'got commit' to use a ".diff" suffix for temporary diff files. ok op@


switch diff output mode from "edscript" to "plain" for diff3 getchange() in diff3.c takes any line that starts with an integer and treats it as a hunk header. It doesn't actually require ed script instructions, and traditional ed script diff output would break it. Thus, changing Got's diff3 to rely on plain diff output mode paves the way for implementing traditional ed-script style output in diff.git. Patch by Tom Jones


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


inline struct got_object_id in struct got_object_qid Saves us from doing a malloc/free call for every item on the list. ok op@


wrap overlong lines


add "e" (close-on-exec) flag to fopen(3) calls suggested by millert ok thomas_adam


preverse binary files during updates and merges


set oldo.to in diff3.c's duplicate() even if the file contains no newlines


always initialize output parameter "n" of get_line() in diff3.c


fix another segfault in edscript() Same problem as fixed in 90de04bc7f1b85b9c491bcd124f6178fad005de1. ok stsp


fix a segfault in edscript() introduced by my previous commit Found by our cherrypick regression tests.


fix merging of files which contain a dot on a line by itself Annoying bug which we inherited from OpenRCS which inherited it from OpenBSD's diff3 program. ok tracey millert


indentation fixes


use Patience diff for merging during cherrypick/backout/histedit/rebase This has been shown to prevent mis-merges in some cases. It's probably not a final solution. We should look at what Git's "recursive merge" is doing and implement something similar. Keep using Myers during update/unstage. The advantage of Myers is that it produces smaller conflict chunks, and there are no known cases of mis-merges which affect update/unstage.


make merge_file() accept FILEs instead of paths for orig and deriv inputs


fix 3-way merge of files which lack a final \n problem found by jrick ok millert


use Myers diff instead of Patience diff when merging files with diff3 Myers diff tends to divide files into smaller diff chunks, while Patience diff attemps to maximize the size of diff chunks. Smaller diffs chunks generally result in a more managable presentation of merge conflicts.


make fclose(3) failure checks consistent; check 'fclose() == EOF' everywhere ok millert, naddy


use size_t for loop indices to avoid signedness warnings; from emaste@freebsd


consistently label removed files as "/dev/null" in diff headers


handle binary files in got/tog diff commands; add -a options to force text


merge new diff implementation from the git.gameoftrees.org diff.git repository This new diff implementation was started by Neels Hofmeyr during the u2k20 hackathon and now replaces diffreg.c code lifted from the OpenBSD base system. The integration of this code into Got was done by me. Got now uses the patience diff algorithm by default. The diff.git repository will remain the primary repository for the diff code, which already compiles and runs on other operating systems such as Linux. Any fixes and improvements for files inherited from the diff.git repository should be written against that repository and synced to got.git afterwards.