Commits


provide functions to parse/serialize different hashes it abstracts over the hash type and ensures that object ids are zero'ed before their sha1 digest is written. Needed by the incoming sha256 support. ok stsp@


rename lib/sha1.c to lib/hash.c It will soon grow functions to deal with sha256 too. stsp@ agrees.


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>


fix previous; name must be initialized otherwise if binaryfilename fails to match the line, `name' may be left pointing to free'd memory.


got patch: handle the removal of binary files Diffs that remove binary files don't have hunks so got patch would skip over them, treating that part of the diff as "noise". Different programs outputs a slightly different diff for this kind of patches, but the "Binary files ... and /dev/null differ" is usually shown, so try to match it. The adedd regress test covers got diff, git diff, and OpenBSD' /usr/bin/diff. CVS diffs will currently fail because the guessed file name will be wrong. CVS prints the file name in the Index and RCS lines which got patch currently ignores, and shows an useless path in the "Binary files /tmp/cvs... and /dev/null differ" line. Discussed with and ok stsp@


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@


ensure got patch respects x-bit perms for new files Reported by stsp on IRC: got patch failed to set the x-bit for a new file despite got diff recording mode 755. Parse got and git diffs for this data and set file modes accordingly. Tweaked with hint from op. ok stsp@


use got_privsep_flush_imsg instead of reinventing it ok stsp@


refactor the patch parser Introduce a patch_start routine that finds the next "diff" header (if there is one); the idea is to persist some state (commit id and wether it's a "git diff") while processing the content of the diff. It's needed because in the case of 'got diff' some information like the commit id are only present once at the beginning. As a consequence, the patch parser becomes slightly more robust (concatenating diffs produced by different means shouldn't confuse it anymore) and drops the support for "old" got diffs, the ones previous the introduction of the "commit -/+" header. ok tracey@


got patch: handle git-style diffs for the 3-way merge too tweak and ok stsp@


handle blob ids without corresponding blob ids ok stsp@


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@


use the commitid in the patch diff3 conflict header suggested by and ok stsp@


got patch: use diff3 to merge the changes Parse the "blob -" metadata in diffs produced by 'got diff' and use the original file for patching. Then, use the diff3 with the current version of the file to merge the differences. This solves many failures automagically or at least turns them into a conflict. ok/improvements stsp@


got patch: use ints for line offsets instead of longs ints have the advantage that their size is more likely to be the same across the various architecture supported by OpenBSD, thus introducing less possible differences. INT_MAX is still (at least) a few order of magnitudes higher than the patches we dealt with (even abnormal ones.) suggested by stsp@