Merge branch 'jt/diff-pairs'

A post-processing filter for "diff --raw" output has been
introduced.

* jt/diff-pairs:
  builtin/diff-pairs: allow explicit diff queue flush
  builtin: introduce diff-pairs command
  diff: add option to skip resolving diff statuses
  diff: return diff_filepair from diff queue helpers
This commit is contained in:
Junio C Hamano
2025-03-26 16:26:09 +09:00
13 changed files with 449 additions and 21 deletions

33
diff.h
View File

@@ -353,6 +353,14 @@ struct diff_options {
/* to support internal diff recursion by --follow hack*/
int found_follow;
/*
* By default, diffcore_std() resolves the statuses for queued diff file
* pairs by calling diff_resolve_rename_copy(). If status information
* has already been manually set, this option prevents diffcore_std()
* from resetting statuses.
*/
int skip_resolving_statuses;
/* Callback which allows tweaking the options in diff_setup_done(). */
void (*set_default)(struct diff_options *);
@@ -508,6 +516,31 @@ void diff_set_default_prefix(struct diff_options *options);
int diff_can_quit_early(struct diff_options *);
/*
* Stages changes in the provided diff queue for file additions and deletions.
* If a file pair gets queued, it is returned.
*/
struct diff_filepair *diff_queue_addremove(struct diff_queue_struct *queue,
struct diff_options *,
int addremove, unsigned mode,
const struct object_id *oid,
int oid_valid, const char *fullpath,
unsigned dirty_submodule);
/*
* Stages changes in the provided diff queue for file modifications.
* If a file pair gets queued, it is returned.
*/
struct diff_filepair *diff_queue_change(struct diff_queue_struct *queue,
struct diff_options *,
unsigned mode1, unsigned mode2,
const struct object_id *old_oid,
const struct object_id *new_oid,
int old_oid_valid, int new_oid_valid,
const char *fullpath,
unsigned dirty_submodule1,
unsigned dirty_submodule2);
void diff_addremove(struct diff_options *,
int addremove,
unsigned mode,