Skip to content

Commit fa7b290

Browse files
committed
diff: remove often unused parameters from diff_unmerge()
e9c8409 (diff-index --cached --raw: show tree entry on the LHS for unmerged entries., 2007-01-05) added a <mode, object name> pair as parameters to this function, to store them in the pre-image side of an unmerged file pair. Now the function is fixed to return the filepair it queued, we can make the caller on the special case codepath to do so. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 76399c0 commit fa7b290

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

diff-lib.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
183183
* Show the diff for the 'ce' if we found the one
184184
* from the desired stage.
185185
*/
186-
diff_unmerge(&revs->diffopt, ce->name, 0, null_sha1);
186+
diff_unmerge(&revs->diffopt, ce->name);
187187
if (ce_stage(ce) != diff_unmerged_stage)
188188
continue;
189189
}
@@ -372,8 +372,9 @@ static void do_oneway_diff(struct unpack_trees_options *o,
372372
match_missing = !revs->ignore_merges;
373373

374374
if (cached && idx && ce_stage(idx)) {
375-
diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode,
376-
idx->sha1);
375+
struct diff_filepair *pair;
376+
pair = diff_unmerge(&revs->diffopt, idx->name);
377+
fill_filespec(pair->one, idx->sha1, idx->ce_mode);
377378
return;
378379
}
379380

diff.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4308,9 +4308,7 @@ void diff_change(struct diff_options *options,
43084308
DIFF_OPT_SET(options, HAS_CHANGES);
43094309
}
43104310

4311-
struct diff_filepair *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, const char *path)
43144312
{
43154313
struct diff_filepair *pair;
43164314
struct diff_filespec *one, *two;
@@ -4321,7 +4319,6 @@ struct diff_filepair *diff_unmerge(struct diff_options *options,
43214319

43224320
one = alloc_filespec(path);
43234321
two = alloc_filespec(path);
4324-
fill_filespec(one, sha1, mode);
43254322
pair = diff_queue(&diff_queued_diff, one, two);
43264323
pair->is_unmerged = 1;
43274324
return pair;

diff.h

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

212-
extern struct diff_filepair *diff_unmerge(struct diff_options *,
213-
const char *path,
214-
unsigned mode,
215-
const unsigned char *sha1);
212+
extern struct diff_filepair *diff_unmerge(struct diff_options *, const char *path);
216213

217214
#define DIFF_SETUP_REVERSE 1
218215
#define DIFF_SETUP_USE_CACHE 2

0 commit comments

Comments
 (0)