mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-11 01:53:21 -05:00
t5540/t5541: avoid accessing a bare repository via -C <dir>
In the `test_http_push_nonff` function both of these test scripts call, there were two Git invocations that assume that bare repositories will always be discovered when the current working directory is inside one. This is unlikely to be true forever because at some stage, the `safe.bareRepository` config is prone to be modified to be safe by default. So let's be safe and specify the bare repository explicitly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c1e5cd1dda
commit
5513fb51b7
@@ -259,7 +259,7 @@ test_http_push_nonff () {
|
||||
|
||||
test_expect_success 'non-fast-forward push fails' '
|
||||
cd "$REMOTE_REPO" &&
|
||||
HEAD=$(git rev-parse --verify HEAD) &&
|
||||
HEAD=$(git --git-dir=. rev-parse --verify HEAD) &&
|
||||
|
||||
cd "$LOCAL_REPO" &&
|
||||
git checkout $BRANCH &&
|
||||
@@ -270,7 +270,7 @@ test_http_push_nonff () {
|
||||
(
|
||||
cd "$REMOTE_REPO" &&
|
||||
echo "$HEAD" >expect &&
|
||||
git rev-parse --verify HEAD >actual &&
|
||||
git --git-dir=. rev-parse --verify HEAD >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
@@ -284,18 +284,16 @@ test_http_push_nonff () {
|
||||
'
|
||||
|
||||
test_expect_${EXPECT_CAS_RESULT} 'force with lease aka cas' '
|
||||
HEAD=$( cd "$REMOTE_REPO" && git rev-parse --verify HEAD ) &&
|
||||
HEAD=$(git --git-dir="$REMOTE_REPO" rev-parse --verify HEAD) &&
|
||||
test_when_finished '\''
|
||||
(cd "$REMOTE_REPO" && git update-ref HEAD "$HEAD")
|
||||
git --git-dir="$REMOTE_REPO" update-ref HEAD "$HEAD"
|
||||
'\'' &&
|
||||
(
|
||||
cd "$LOCAL_REPO" &&
|
||||
git push -v --force-with-lease=$BRANCH:$HEAD origin
|
||||
) &&
|
||||
git rev-parse --verify "$BRANCH" >expect &&
|
||||
(
|
||||
cd "$REMOTE_REPO" && git rev-parse --verify HEAD
|
||||
) >actual &&
|
||||
git --git-dir="$REMOTE_REPO" rev-parse --verify HEAD >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user