]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/revision-range-unpeel' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 7 Nov 2013 22:34:14 +0000 (14:34 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Nov 2013 22:34:14 +0000 (14:34 -0800)
"git rev-list --objects ^v1.0^ v1.0" gave v1.0 tag itself in the
output, but "git rev-list --objects v1.0^..v1.0" did not.

* jc/revision-range-unpeel:
  revision: do not peel tags used in range notation

1  2 
revision.c

diff --cc revision.c
index ac20d1aaed7b5e1a52682dfd196f87e2f94e87c7,7010aff817e3889dbdb6f99fdbdd8b18db8b6d2c..f82b833fbceada4c4b32e669fd33966c751249e8
@@@ -1439,11 -1164,34 +1427,37 @@@ int handle_revision_arg(const char *arg
                                verify_non_filename(revs->prefix, arg);
                        }
  
-                       if (symmetric) {
+                       a_obj = parse_object(from_sha1);
+                       b_obj = parse_object(sha1);
+                       if (!a_obj || !b_obj) {
+                       missing:
+                               if (revs->ignore_missing)
+                                       return 0;
+                               die(symmetric
+                                   ? "Invalid symmetric difference expression %s"
+                                   : "Invalid revision range %s", arg);
+                       }
+                       if (!symmetric) {
+                               /* just A..B */
+                               a_flags = flags_exclude;
+                       } else {
+                               /* A...B -- find merge bases between the two */
+                               struct commit *a, *b;
+                               struct commit_list *exclude;
+                               a = (a_obj->type == OBJ_COMMIT
+                                    ? (struct commit *)a_obj
+                                    : lookup_commit_reference(a_obj->sha1));
+                               b = (b_obj->type == OBJ_COMMIT
+                                    ? (struct commit *)b_obj
+                                    : lookup_commit_reference(b_obj->sha1));
+                               if (!a || !b)
+                                       goto missing;
                                exclude = get_merge_bases(a, b, 1);
 +                              add_rev_cmdline_list(revs, exclude,
 +                                                   REV_CMD_MERGE_BASE,
 +                                                   flags_exclude);
                                add_pending_commit_list(revs, exclude,
                                                        flags_exclude);
                                free_commit_list(exclude);