Merge branch 'jc/revision-range-unpeel'
authorJunio C Hamano <gitster@pobox.com>
Mon, 28 Oct 2013 17:43:16 +0000 (10:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Oct 2013 17:43:16 +0000 (10:43 -0700)
"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 0173e0148b850bd1a3e2e7e5c652050ade6d5ba4,7010aff817e3889dbdb6f99fdbdd8b18db8b6d2c..7e03e154f446d2c105150cecea8c50fdc8e5238a
@@@ -1438,11 -1164,34 +1426,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);