Merge branch 'jc/diff'
authorJunio C Hamano <junkio@cox.net>
Fri, 28 Jul 2006 19:23:52 +0000 (12:23 -0700)
committerJunio C Hamano <junkio@cox.net>
Fri, 28 Jul 2006 19:23:52 +0000 (12:23 -0700)
* jc/diff:
git-diff A...B to (usually) mean "git-diff `git-merge-base A B` B"

1  2 
builtin-diff.c
diff --combined builtin-diff.c
index 7d5ad6271e8bdca5a70e8463d98663c41bbd879b,efd315240f0d8434bc378bf43b866588f6f4e42e..dca223235de6ef61407bd7e7625687ab71918186
@@@ -250,9 -250,8 +250,9 @@@ int cmd_diff(int argc, const char **arg
         * Other cases are errors.
         */
  
 -      git_config(git_diff_ui_config);
        init_revisions(&rev);
 +      git_config(git_diff_ui_config);
 +      diff_setup(&rev.diffopt);
  
        argc = setup_revisions(argc, argv, &rev, NULL);
        if (!rev.diffopt.output_format) {
                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);
  }