for-each-ref: test :remotename and :remoteref
This not only prevents regressions, but also serves as documentation what this new feature is expected to do. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Nov 7, 2017 at 17:31 UTC
1b586867dba322c911cc9b4441e2be130ba76cd5
1 file changed
+32
t/t6300-for-each-ref.sh
+32
@@ -675,4 +675,36 @@ test_expect_success 'Verify usage of %(symref:rstrip) atom' '
675
test_cmp expected actual
676
'
677
678
+test_expect_success ':remotename and :remoteref' '
679
+ git init remote-tests &&
680
+ (
681
+ cd remote-tests &&
682
+ test_commit initial &&
683
+ git remote add from fifth.coffee:blub &&
684
+ git config branch.master.remote from &&
685
+ git config branch.master.merge refs/heads/stable &&
686
+ git remote add to southridge.audio:repo &&
687
+ git config remote.to.push "refs/heads/*:refs/heads/pushed/*" &&
688
+ git config branch.master.pushRemote to &&
689
+ for pair in "%(upstream)=refs/remotes/from/stable" \
690
+ "%(upstream:remotename)=from" \
691
+ "%(upstream:remoteref)=refs/heads/stable" \
692
+ "%(push)=refs/remotes/to/pushed/master" \
693
+ "%(push:remotename)=to" \
694
+ "%(push:remoteref)=refs/heads/pushed/master"
695
+ do
696
+ echo "${pair#*=}" >expect &&
697
+ git for-each-ref --format="${pair%=*}" \
698
+ refs/heads/master >actual &&
699
+ test_cmp expect actual
700
+ done &&
701
+ git branch push-simple &&
702
+ git config branch.push-simple.pushRemote from &&
703
+ actual="$(git for-each-ref \
704
+ --format="%(push:remotename),%(push:remoteref)" \
705
+ refs/heads/push-simple)" &&
706
+ test from, = "$actual"
707
+ )
708
+'
709
+
710
test_done