Merge branch 'jc/diff' into next

* jc/diff:
  Libified diff-index: backward compatibility fix.
This commit is contained in:
Junio C Hamano 2006-04-22 04:04:46 -07:00
commit 623ac4c896
3 changed files with 12 additions and 6 deletions

View File

@ -23,9 +23,7 @@ int main(int argc, const char **argv)
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
const char *arg = argv[i]; const char *arg = argv[i];
if (!strcmp(arg, "-m")) if (!strcmp(arg, "--cached"))
match_missing = 1;
else if (!strcmp(arg, "--cached"))
cached = 1; cached = 1;
else else
usage(diff_cache_usage); usage(diff_cache_usage);
@ -37,5 +35,5 @@ int main(int argc, const char **argv)
if (!rev.pending_objects || rev.pending_objects->next || if (!rev.pending_objects || rev.pending_objects->next ||
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1) rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
usage(diff_cache_usage); usage(diff_cache_usage);
return run_diff_index(&rev, cached, match_missing); return run_diff_index(&rev, cached);
} }

View File

@ -308,12 +308,20 @@ static void mark_merge_entries(void)
} }
} }
int run_diff_index(struct rev_info *revs, int cached, int match_missing) int run_diff_index(struct rev_info *revs, int cached)
{ {
int ret; int ret;
struct object *ent; struct object *ent;
struct tree *tree; struct tree *tree;
const char *tree_name; const char *tree_name;
int match_missing = 0;
/*
* Backward compatibility wart - "diff-index -m" does
* not mean "do not ignore merges", but totally different.
*/
if (!revs->ignore_merges)
match_missing = 1;
if (read_cache() < 0) { if (read_cache() < 0) {
perror("read_cache"); perror("read_cache");

2
diff.h
View File

@ -171,6 +171,6 @@ extern const char *diff_unique_abbrev(const unsigned char *, int);
extern int run_diff_files(struct rev_info *revs, int silent_on_removed); extern int run_diff_files(struct rev_info *revs, int silent_on_removed);
extern int run_diff_index(struct rev_info *revs, int cached, int match_missing); extern int run_diff_index(struct rev_info *revs, int cached);
#endif /* DIFF_H */ #endif /* DIFF_H */