Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2015 18:41:16 +0000 (11:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Jul 2015 18:41:16 +0000 (11:41 -0700)
"git format-patch --ignore-if-upstream A..B" did not like to be fed
tags as boundary commits.

* jc/do-not-feed-tags-to-clear-commit-marks:
format-patch: do not feed tags to clear_commit_marks()

1  2 
builtin/log.c
t/t4014-format-patch.sh
diff --combined builtin/log.c
index 4c4e6be28c85756d73eaefa3c8be6264c795fdcc,39181e239f11fc93222e2239a5fd872a9c58ed84..7b343c1aaf03cbcf442217a46660f9297ae82263
@@@ -38,8 -38,8 +38,8 @@@ static const char *fmt_patch_subject_pr
  static const char *fmt_pretty;
  
  static const char * const builtin_log_usage[] = {
 -      N_("git log [<options>] [<revision range>] [[--] <path>...]\n")
 -      N_("   or: git show [options] <object>..."),
 +      N_("git log [<options>] [<revision-range>] [[--] <path>...]"),
 +      N_("git show [<options>] <object>..."),
        NULL
  };
  
@@@ -489,7 -489,7 +489,7 @@@ static int show_tag_object(const unsign
  }
  
  static int show_tree_object(const unsigned char *sha1,
 -              const char *base, int baselen,
 +              struct strbuf *base,
                const char *pathname, unsigned mode, int stage, void *context)
  {
        printf("%s%s\n", pathname, S_ISDIR(mode) ? "/" : "");
@@@ -705,7 -705,7 +705,7 @@@ static int git_format_config(const cha
                return 0;
        }
        if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff") ||
 -          !strcmp(var, "color.ui")) {
 +          !strcmp(var, "color.ui") || !strcmp(var, "diff.submodule")) {
                return 0;
        }
        if (!strcmp(var, "format.numbered")) {
@@@ -795,7 -795,7 +795,7 @@@ static int reopen_stdout(struct commit 
  static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
  {
        struct rev_info check_rev;
-       struct commit *commit;
+       struct commit *commit, *c1, *c2;
        struct object *o1, *o2;
        unsigned flags1, flags2;
  
                die(_("Need exactly one range."));
  
        o1 = rev->pending.objects[0].item;
-       flags1 = o1->flags;
        o2 = rev->pending.objects[1].item;
+       flags1 = o1->flags;
        flags2 = o2->flags;
+       c1 = lookup_commit_reference(o1->sha1);
+       c2 = lookup_commit_reference(o2->sha1);
  
        if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
                die(_("Not a range."));
        }
  
        /* reset for next revision walk */
-       clear_commit_marks((struct commit *)o1,
-                       SEEN | UNINTERESTING | SHOWN | ADDED);
-       clear_commit_marks((struct commit *)o2,
-                       SEEN | UNINTERESTING | SHOWN | ADDED);
+       clear_commit_marks(c1, SEEN | UNINTERESTING | SHOWN | ADDED);
+       clear_commit_marks(c2, SEEN | UNINTERESTING | SHOWN | ADDED);
        o1->flags = flags1;
        o2->flags = flags2;
  }
@@@ -1023,7 -1023,7 +1023,7 @@@ static const char *set_outdir(const cha
  }
  
  static const char * const builtin_format_patch_usage[] = {
 -      N_("git format-patch [options] [<since> | <revision range>]"),
 +      N_("git format-patch [<options>] [<since> | <revision-range>]"),
        NULL
  };
  
diff --combined t/t4014-format-patch.sh
index c39e50028f256b6850327b90aa1137bd8e35ef1a,2ea12dd088e2f09d800741201def2393796f30a2..890db1174f75172ee6b342e26cbbc58e3e4cd03f
@@@ -57,6 -57,14 +57,14 @@@ test_expect_success "format-patch --ign
  
  '
  
+ test_expect_success "format-patch --ignore-if-in-upstream handles tags" '
+       git tag -a v1 -m tag side &&
+       git tag -a v2 -m tag master &&
+       git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 &&
+       cnt=$(grep "^From " patch1 | wc -l) &&
+       test $cnt = 2
+ '
  test_expect_success "format-patch doesn't consider merge commits" '
  
        git checkout -b slave master &&
@@@ -802,7 -810,7 +810,7 @@@ test_expect_success '--no-signature sup
  '
  
  test_expect_success '--signature-file overrides format.signaturefile' '
 -      cat >other-mail-signature <<-\EOF
 +      cat >other-mail-signature <<-\EOF &&
        Use this other signature instead of mail-signature.
        EOF
        test_config format.signaturefile mail-signature &&