Skip to content

Commit f3c2140

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 35982f9 commit f3c2140

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

t/t6300-for-each-ref.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,4 +766,36 @@ test_expect_success 'Verify usage of %(symref:rstrip) atom' '
766766
test_cmp expected actual
767767
'
768768

769+
test_expect_success ':remotename and :remoteref' '
770+
git init remote-tests &&
771+
(
772+
cd remote-tests &&
773+
test_commit initial &&
774+
git remote add from fifth.coffee:blub &&
775+
git config branch.master.remote from &&
776+
git config branch.master.merge refs/heads/stable &&
777+
git remote add to southridge.audio:repo &&
778+
git config remote.to.push "refs/heads/*:refs/heads/pushed/*" &&
779+
git config branch.master.pushRemote to &&
780+
for pair in "%(upstream)=refs/remotes/from/stable" \
781+
"%(upstream:remotename)=from" \
782+
"%(upstream:remoteref)=refs/heads/stable" \
783+
"%(push)=refs/remotes/to/pushed/master" \
784+
"%(push:remotename)=to" \
785+
"%(push:remoteref)=refs/heads/pushed/master"
786+
do
787+
echo "${pair#*=}" >expect &&
788+
git for-each-ref --format="${pair%=*}" \
789+
refs/heads/master >actual &&
790+
test_cmp expect actual
791+
done &&
792+
git branch push-simple &&
793+
git config branch.push-simple.pushRemote from &&
794+
actual="$(git for-each-ref \
795+
--format="%(push:remotename),%(push:remoteref)" \
796+
refs/heads/push-simple)" &&
797+
test from, = "$actual"
798+
)
799+
'
800+
769801
test_done

0 commit comments

Comments
 (0)