Skip to content

Commit 76399c0

Browse files
committed
diff.c: return filepair from diff_unmerge()
The underlying diff_queue() returns diff_filepair so that the caller can further add information to it, and the helper function diff_unmerge() utilizes the feature itself, but does not expose it to its callers, which was kind of selfish. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3749fde commit 76399c0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

diff.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,20 +4308,23 @@ void diff_change(struct diff_options *options,
43084308
DIFF_OPT_SET(options, HAS_CHANGES);
43094309
}
43104310

4311-
void diff_unmerge(struct diff_options *options,
4312-
const char *path,
4313-
unsigned mode, const unsigned char *sha1)
4311+
struct diff_filepair *diff_unmerge(struct diff_options *options,
4312+
const char *path,
4313+
unsigned mode, const unsigned char *sha1)
43144314
{
4315+
struct diff_filepair *pair;
43154316
struct diff_filespec *one, *two;
43164317

43174318
if (options->prefix &&
43184319
strncmp(path, options->prefix, options->prefix_length))
4319-
return;
4320+
return NULL;
43204321

43214322
one = alloc_filespec(path);
43224323
two = alloc_filespec(path);
43234324
fill_filespec(one, sha1, mode);
4324-
diff_queue(&diff_queued_diff, one, two)->is_unmerged = 1;
4325+
pair = diff_queue(&diff_queued_diff, one, two);
4326+
pair->is_unmerged = 1;
4327+
return pair;
43254328
}
43264329

43274330
static char *run_textconv(const char *pgm, struct diff_filespec *spec,

diff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ extern void diff_change(struct diff_options *,
209209
const char *fullpath,
210210
unsigned dirty_submodule1, unsigned dirty_submodule2);
211211

212-
extern void diff_unmerge(struct diff_options *,
212+
extern struct diff_filepair *diff_unmerge(struct diff_options *,
213213
const char *path,
214214
unsigned mode,
215215
const unsigned char *sha1);

0 commit comments

Comments
 (0)