summaryrefslogtreecommitdiff
path: root/builtin-diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-28 12:23:52 -0700
committerJunio C Hamano <junkio@cox.net>2006-07-28 12:23:52 -0700
commitf789f829933664dc4c3b0af7f1e2c5e37fc8621e (patch)
treed624439ae36dd19f37a2b8bb07a153b048953a19 /builtin-diff.c
parent5afa69b415fd020d6dd36751bdcf45fdbf07dd4a (diff)
parent9919f41c91e525fd813fd2cd006f8fdcf976a661 (diff)
downloadgit-f789f829933664dc4c3b0af7f1e2c5e37fc8621e.tar.gz
Merge branch 'jc/diff'
* jc/diff: git-diff A...B to (usually) mean "git-diff `git-merge-base A B` B"
Diffstat (limited to 'builtin-diff.c')
-rw-r--r--builtin-diff.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index 7d5ad6271e..dca223235d 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -347,7 +347,15 @@ int cmd_diff(int argc, const char **argv, char **envp)
return builtin_diff_index(&rev, argc, argv);
else if (ents == 2)
return builtin_diff_tree(&rev, argc, argv, ent);
+ else if ((ents == 3) && (ent[0].item->flags & UNINTERESTING)) {
+ /* diff A...B where there is one sane merge base between
+ * A and B. We have ent[0] == merge-base, ent[1] == A,
+ * and ent[2] == B. Show diff between the base and B.
+ */
+ return builtin_diff_tree(&rev, argc, argv, ent);
+ }
else
- return builtin_diff_combined(&rev, argc, argv, ent, ents);
+ return builtin_diff_combined(&rev, argc, argv,
+ ent, ents);
usage(builtin_diff_usage);
}