]> git.ipfire.org Git - thirdparty/git.git/commit
diff: return diff_filepair from diff queue helpers
authorJustin Tobler <jltobler@gmail.com>
Fri, 28 Feb 2025 21:33:43 +0000 (15:33 -0600)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Mar 2025 16:17:47 +0000 (08:17 -0800)
commit7c67d2a07055150b76e81efa8850221d52705305
treeca9025386e2626a82c032163e4c3e268ed0cd0ff
parent08bdfd453584e489d5a551aecbdcb77584e1b958
diff: return diff_filepair from diff queue helpers

The `diff_addremove()` and `diff_change()` functions set up and queue
diffs, but do not return the `diff_filepair` added to the queue. In a
subsequent commit, modifications to `diff_filepair` need to occur in
certain cases after being queued.

Since the existing `diff_addremove()` and `diff_change()` are also used
for callbacks in `diff_options` as types `add_remove_fn_t` and
`change_fn_t`, modifying the existing function signatures requires
further changes. The diff options for pruning use `file_add_remove()`
and `file_change()` where file pairs do not even get queued. Thus,
separate functions are implemented instead.

Split out the queuing operations into `diff_queue_addremove()` and
`diff_queue_change()` which also return a handle to the queued
`diff_filepair`. Both `diff_addremove()` and `diff_change()` are
reimplemented as thin wrappers around the new functions.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff.h