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 <gitster@pobox.com>
Junio C Hamano committed
Apr 22, 2011 at 16:05 UTC
fa7b290895ba2c4407ae818911ba620eaca53bbd
3 files changed
+6
-11
diff-lib.c
+4
-3
@@ -183,7 +183,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
183
* Show the diff for the 'ce' if we found the one
184
* from the desired stage.
185
*/
186
- diff_unmerge(&revs->diffopt, ce->name, 0, null_sha1);
186
+ diff_unmerge(&revs->diffopt, ce->name);
187
if (ce_stage(ce) != diff_unmerged_stage)
188
continue;
189
}
@@ -372,8 +372,9 @@ static void do_oneway_diff(struct unpack_trees_options *o,
372
match_missing = !revs->ignore_merges;
373
374
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);
378
return;
379
}
380
diff.c
+1
-4
@@ -4308,9 +4308,7 @@ void diff_change(struct diff_options *options,
4308
DIFF_OPT_SET(options, HAS_CHANGES);
4309
}
4310
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)
4312
{
4313
struct diff_filepair *pair;
4314
struct diff_filespec *one, *two;
@@ -4321,7 +4319,6 @@ struct diff_filepair *diff_unmerge(struct diff_options *options,
4319
4320
one = alloc_filespec(path);
4321
two = alloc_filespec(path);
4324
- fill_filespec(one, sha1, mode);
4322
pair = diff_queue(&diff_queued_diff, one, two);
4323
pair->is_unmerged = 1;
4324
return pair;
diff.h
+1
-4
@@ -209,10 +209,7 @@ extern void diff_change(struct diff_options *,
209
const char *fullpath,
210
unsigned dirty_submodule1, unsigned dirty_submodule2);
211
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);
213
214
#define DIFF_SETUP_REVERSE 1
215
#define DIFF_SETUP_USE_CACHE 2