Merge branch 'jk/pending-keep-tag-name'
authorJunio C Hamano <gitster@pobox.com>
Mon, 28 Dec 2015 21:58:03 +0000 (13:58 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Dec 2015 21:58:04 +0000 (13:58 -0800)
History traversal with "git log --source" that starts with an
annotated tag failed to report the tag as "source", due to an
old regression in the command line parser back in v2.2 days.

* jk/pending-keep-tag-name:
revision.c: propagate tag names from pending array

revision.c
t/t4202-log.sh
index 9404a05eeb4adf7e8c1efeed7e16af2c2504aefa..0a282f533b3e225a996221d614de8bdc960092a3 100644 (file)
@@ -294,9 +294,8 @@ static struct commit *handle_commit(struct rev_info *revs,
                /*
                 * We'll handle the tagged object by looping or dropping
                 * through to the non-tag handlers below. Do not
-                * propagate data from the tag's pending entry.
+                * propagate path data from the tag's pending entry.
                 */
-               name = "";
                path = NULL;
                mode = 0;
        }
index 6ede0692f6de9f2da011dd8b7361bfc53aba7253..cb82eb7e66b4feb24086407019a812f46b715a34 100755 (executable)
@@ -908,4 +908,33 @@ test_expect_success 'log diagnoses bogus HEAD' '
        test_i18ngrep broken stderr
 '
 
+test_expect_success 'set up --source tests' '
+       git checkout --orphan source-a &&
+       test_commit one &&
+       test_commit two &&
+       git checkout -b source-b HEAD^ &&
+       test_commit three
+'
+
+test_expect_success 'log --source paints branch names' '
+       cat >expect <<-\EOF &&
+       09e12a9 source-b three
+       8e393e1 source-a two
+       1ac6c77 source-b one
+       EOF
+       git log --oneline --source source-a source-b >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'log --source paints tag names' '
+       git tag -m tagged source-tag &&
+       cat >expect <<-\EOF &&
+       09e12a9 source-tag three
+       8e393e1 source-a two
+       1ac6c77 source-tag one
+       EOF
+       git log --oneline --source source-tag source-a >actual &&
+       test_cmp expect actual
+'
+
 test_done