]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'zh/ref-filter-push-remote-fix'
authorJunio C Hamano <gitster@pobox.com>
Wed, 19 May 2021 23:55:00 +0000 (08:55 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 May 2021 23:55:00 +0000 (08:55 +0900)
The handling of "%(push)" formatting element of "for-each-ref" and
friends was broken when the same codepath started handling
"%(push:<what>)", which has been corrected.

* zh/ref-filter-push-remote-fix:
  ref-filter: fix read invalid union member bug

1  2 
ref-filter.c
t/t6302-for-each-ref-filter.sh

diff --cc ref-filter.c
Simple merge
index 9866b1b5736873bdd592574af7d78ec14fc3f1db,529ca556c8b4a097c0430d365b883f1d47ac824d..1537aa21798b669e30c0dbdc0d72aa3465c141b6
@@@ -117,9 -113,28 +117,28 @@@ test_expect_success '%(color) must fail
        test_must_fail git for-each-ref --format="%(color)%(refname)"
  '
  
+ test_expect_success '%(color:#aa22ac) must succeed' '
+       test_when_finished rm -rf test &&
+       git init test &&
+       (
+               cd test &&
+               test_commit initial &&
+               git branch -M main &&
+               cat >expect <<-\EOF &&
+               refs/heads/main
+               refs/tags/initial
+               EOF
+               git remote add origin nowhere &&
+               git config branch.main.remote origin &&
+               git config branch.main.merge refs/heads/main &&
+               git for-each-ref --format="%(color:#aa22ac)%(refname)" >actual &&
+               test_cmp expect actual
+       )
+ '
  test_expect_success 'left alignment is default' '
        cat >expect <<-\EOF &&
 -      refname is refs/heads/master  |refs/heads/master
 +      refname is refs/heads/main    |refs/heads/main
        refname is refs/heads/side    |refs/heads/side
        refname is refs/odd/spot      |refs/odd/spot
        refname is refs/tags/annotated-tag|refs/tags/annotated-tag