Skip to content

Commit 1b58686

Browse files
dschogitster
authored andcommitted
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 9700fae commit 1b58686

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
@@ -675,4 +675,36 @@ test_expect_success 'Verify usage of %(symref:rstrip) atom' '
675675
test_cmp expected actual
676676
'
677677

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+
678710
test_done

0 commit comments

Comments
 (0)