61
int silent_on_removed = option & DIFF_SILENT_ON_REMOVED;
62
unsigned ce_option = ((option & DIFF_RACY_IS_MODIFIED)
63
? CE_MATCH_RACY_IS_DIRTY : 0);
64
- char symcache[PATH_MAX];
64
65
diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/");
66
67
if (diff_unmerged_stage < 0)
68
diff_unmerged_stage = 2;
69
entries = active_nr;
71
- symcache[0] = '\0';
70
for (i = 0; i < entries; i++) {
71
struct stat st;
72
unsigned int oldmode, newmode;
196
* diff-index
197
*/
198
201
-struct oneway_unpack_data {
202
- struct rev_info *revs;
203
- char symcache[PATH_MAX];
204
-};
205
-
199
/* A file entry went away or appeared */
200
static void diff_index_show_file(struct rev_info *revs,
201
const char *prefix,
209
static int get_stat_data(struct cache_entry *ce,
210
const unsigned char **sha1p,
211
unsigned int *modep,
219
- int cached, int match_missing,
220
- struct oneway_unpack_data *cbdata)
212
+ int cached, int match_missing)
213
{
214
const unsigned char *sha1 = ce->sha1;
215
unsigned int mode = ce->ce_mode;
240
return 0;
241
}
242
251
-static void show_new_file(struct oneway_unpack_data *cbdata,
243
+static void show_new_file(struct rev_info *revs,
244
struct cache_entry *new,
245
int cached, int match_missing)
246
{
247
const unsigned char *sha1;
248
unsigned int mode;
257
- struct rev_info *revs = cbdata->revs;
249
250
/*
251
* New file in the index: it might actually be different in
252
* the working copy.
253
*/
263
- if (get_stat_data(new, &sha1, &mode, cached, match_missing, cbdata) < 0)
254
+ if (get_stat_data(new, &sha1, &mode, cached, match_missing) < 0)
255
return;
256
257
diff_index_show_file(revs, "+", new, sha1, mode);
258
}
259
269
-static int show_modified(struct oneway_unpack_data *cbdata,
260
+static int show_modified(struct rev_info *revs,
261
struct cache_entry *old,
262
struct cache_entry *new,
263
int report_missing,
265
{
266
unsigned int mode, oldmode;
267
const unsigned char *sha1;
277
- struct rev_info *revs = cbdata->revs;
268
279
- if (get_stat_data(new, &sha1, &mode, cached, match_missing, cbdata) < 0) {
269
+ if (get_stat_data(new, &sha1, &mode, cached, match_missing) < 0) {
270
if (report_missing)
271
diff_index_show_file(revs, "-", old,
272
old->sha1, old->ce_mode);
334
struct cache_entry *idx,
335
struct cache_entry *tree)
336
{
347
- struct oneway_unpack_data *cbdata = o->unpack_data;
348
- struct rev_info *revs = cbdata->revs;
337
+ struct rev_info *revs = o->unpack_data;
338
int match_missing, cached;
339
340
/*
357
* Something added to the tree?
358
*/
359
if (!tree) {
371
- show_new_file(cbdata, idx, cached, match_missing);
360
+ show_new_file(revs, idx, cached, match_missing);
361
return;
362
}
363
370
}
371
372
/* Show difference between old and new */
384
- show_modified(cbdata, tree, idx, 1, cached, match_missing);
373
+ show_modified(revs, tree, idx, 1, cached, match_missing);
374
}
375
376
static inline void skip_same_name(struct cache_entry *ce, struct unpack_trees_options *o)
407
{
408
struct cache_entry *idx = src[0];
409
struct cache_entry *tree = src[1];
421
- struct oneway_unpack_data *cbdata = o->unpack_data;
422
- struct rev_info *revs = cbdata->revs;
410
+ struct rev_info *revs = o->unpack_data;
411
412
if (idx && ce_stage(idx))
413
skip_same_name(idx, o);
434
const char *tree_name;
435
struct unpack_trees_options opts;
436
struct tree_desc t;
449
- struct oneway_unpack_data unpack_cb;
437
438
mark_merge_entries();
439
443
if (!tree)
444
return error("bad tree object %s", tree_name);
445
459
- unpack_cb.revs = revs;
460
- unpack_cb.symcache[0] = '\0';
446
memset(&opts, 0, sizeof(opts));
447
opts.head_idx = 1;
448
opts.index_only = cached;
449
opts.merge = 1;
450
opts.fn = oneway_diff;
466
- opts.unpack_data = &unpack_cb;
451
+ opts.unpack_data = revs;
452
opts.src_index = &the_index;
453
opts.dst_index = NULL;
454
471
struct cache_entry *last = NULL;
472
struct unpack_trees_options opts;
473
struct tree_desc t;
489
- struct oneway_unpack_data unpack_cb;
474
475
/*
476
* This is used by git-blame to run diff-cache internally;
499
if (!tree)
500
die("bad tree object %s", sha1_to_hex(tree_sha1));
501
518
- unpack_cb.revs = &revs;
519
- unpack_cb.symcache[0] = '\0';
502
memset(&opts, 0, sizeof(opts));
503
opts.head_idx = 1;
504
opts.index_only = 1;
505
opts.merge = 1;
506
opts.fn = oneway_diff;
525
- opts.unpack_data = &unpack_cb;
507
+ opts.unpack_data = &revs;
508
opts.src_index = &the_index;
509
opts.dst_index = &the_index;
510