Commits
- Commit:
dc306c6bd88271ab911e205539974da98be82d17
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
back out "improve accuracy of function prototype in hunk headers"
which was commit 8993f42562696079866fc2dec7191877b6cc1f18
This commit introduced a regression where hunk headers would contain
lines taken from below or within a change. Reported by tb@ and sthen@.
There is some confusion around how the -p feature was documented:
-p With unified and context diffs, show with each change the first
40 characters of the last line before the context beginning with
a letter, an underscore or a dollar sign. For C source code
following standard layout conventions, this will show the
prototype of the function the change applies to.
The original behaviour matches "the last line before the context beginning
with a letter ...".
The new (reverted) behaviour sometimes matches "will show the prototype of
the function the change applies to". This did always happen as intended,
as seen when some .c files in the OpenBSD src tree were changed.
The new behaviour was also worse for Makefiles in the OpenBSD ports tree.
Let's revert to the traditional -p behaviour until a better fix is found.
Details:
https://marc.gameoftrees.org/mail/1692696001.69872_0.html
https://marc.info/?l=gameoftrees&m=169269624516330&w=2
ok tb@
- Commit:
f26db7cd2804ebc6a3f81e7e00e008450eb42228
- From:
- Mark Jamsek <mark@jamsek.dev>
- Date:
add public APIs to enable chunk byte offset retrieval
Prompted by changes to conflict marker detection in got.git, add chunk
offset getters for both left- and right-hand side files. This facilitates
more efficient caller diff_result use by directly seeking to a given chunk
rather than counting lines.
ok stsp@
- Commit:
4125b1eff8d9dfcd961dc70ebbd5d54c97bdc3f6
- From:
- Tom Jones <thj@freebsd.org>
- Via:
- tj <tj@enoti.me>
- Date:
diff: handle missing new lines in trailing context
If there is a missing new line in the context we currently miss it and
fail to print the warning. This trips up patch and leads to failures.
Catch these cases in for unidiff output and add a test case.
ok stsp@
- Commit:
8993f42562696079866fc2dec7191877b6cc1f18
- From:
- Mark Jamsek <mark@jamsek.dev>
- Date:
improve accuracy of function prototype in hunk headers
Initial diff by Tom Jones with fixes from stsp.
ok stsp@
- Commit:
9343b92549173e00690f24756a633423770f56d7
- From:
- Mark Jamsek <mark@jamsek.dev>
- Date:
collect line type metadata when generating diff
Similar to line offsets, create an array of line types (i.e., hunk, context,
minus, plus) for each line output in the diff.
ok stsp@
- Commit:
b72f51ffc39028023059fc994542565691b669fa
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
add missing line offset information for unidiff output
We forgot to generate line offset information for lines of the form:
"Binary files %s and %s differ"
Which is causing scrolling problems in tog's diff view.
ok thomas_adam
- Commit:
b3fd1fa284e6207b923bd3c887364d9eb93fb340
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
fix performance issues in the search for function prototypes
with + ok naddy
- Commit:
e4c510c1d83fe01247b6f59d855dffad81e4f26a
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
allow for telling the difference between empty and non-existent files
Adjust labels used in diff output accordingly; non-existent files
should have the label "/dev/null"
- Commit:
e51ebd83fa731d197ee4074ee2e94dbc0581078c
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
handle binary files like diff(1) does; new -a option forces text
- Commit:
fe6d58fb52ea8d1041a8eb65e28a04816df67c08
- From:
- Christian Weisgerber <naddy@mips.inka.de>
- Date:
add a missing include for uint8_t and switch from <inttypes.h> to <stdint.h>
ok millert stsp
- Commit:
e8eedebc88e40698d3d763e6f00601484d8cabf3
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
add some API functions which allow access to opaque struct diff_chunk
- Commit:
e638575c9295479520dc4db9d23e22c18d61f3fb
- From:
- Neels Hofmeyr <neels@hofmeyr.de>
- Date:
assertions fixup: unused var for non-debug
- Commit:
4861c9da86ada01cffa2ce3801f670587e896ce2
- From:
- Neels Hofmeyr <neels@hofmeyr.de>
- Date:
add sanity assertions around adding result chunks
uncovers errors related to placing minus chunks above already added plus
chunks.
- Commit:
9403a358855aa5ba3ec2f3f20943215e1d758496
- From:
- Neels Hofmeyr <neels@hofmeyr.de>
- Date:
debug fix after changing result->left,right to pointers
- Commit:
c16dde50bb5e92533dcbbc513875d726f0f9dd48
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
allow diff API users to atomize files separately
This is a breaking API change (not that we care about that at this point).
This can avoid redundant work spent on atomizing a file multiple times.
There are use cases where one particular file must be compared to other
files over and over again, such as when blaming file history.
The old API gave access to both versions of the file to the atomizer just
in case a future atomizer implementation needs this. This can still be
achieved by passing a second file via the atomizer's private data pointer.
- Commit:
f486745273f4d3c8f6b15d7041d7ab5b3e58b071
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
don't require both + and - chunks in diff_chunk_context_load_change()
- Commit:
13e2caa3edcc68a62e29b4d5503254cd5bf80b2b
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
add support for showing function prototypes in unidiff hunk headers
- Commit:
7187fe972091ffb934d90ab11967d006868f8d7c
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
add diff_chunk_context_load_change() for use with diff_output_unidiff_chunk()
- Commit:
2f26640c77e9b4d1a303b6c3c7776ff75ad51111
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
revert db941c24; callers would also need private structs for that idea to work
- Commit:
66ea8e5adfb496de581ba4b78479f3258692ee9e
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
avoid printing the --- +++ diff header in diff_output_unidiff_chunk()
- Commit:
db941c245fd5f7b8e8ca2f9b6ebaf0c3dcecda48
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
put functions required for using diff_output_unidiff_chunk() into public API
They will be needed to implement 'got stage -p' and 'got revert -p', etc.
Chunks stored in diff_result still need post-processing in order to be
displayed as expected by diff_output_unidiff_chunk().
Exposing these functions allows API consumers to implement the same chunk
merging loop as used internally by output_unidiff() and output_edscript().
(Perhaps, ideally, the public diff API would provide pre-merged chunks at
some point in the future? Then this commit could probably be reverted.)
Change return values from bool to int to avoid making stdbool.h a requirement
for the public diff API.
- Commit:
cbf93b702bb81f143354b53125c64579a5040fcc
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
expose chunk_context_empty() via diff_internal.h and use it in edscript output
- Commit:
7021523c6d7788c452572f0b48f0dcba23199dac
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
print "\ No newline at end of file" message like UNIX diff(1) does
Not adding new tests since this behaviour is covered by tests in Got.
- Commit:
26595c7df947f97507904fa391034b6a52bfca7d
- From:
- Stefan Sperling <stsp@stsp.name>
- Date:
in ed output mode, show changed lines as XXcYY etc. as UNIX diff(1) does
- Commit:
5ff759965efbabc96fecd514e208a9a1b7be72df
- From:
- Neels Hofmeyr <neels@hofmeyr.de>
- Date:
debug: diff_output_unidiff(): debug list all chunks