Skip to content

Commit 6e17fb3

Browse files
felipecgitster
authored andcommitted
t5801 (remote-helpers): cleanup refspec stuff
The code is much simpler this way, specially thanks to: git fast-export --refspec Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e198b3a commit 6e17fb3

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

git-remote-testgit.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@ fi
1111
url=$2
1212

1313
dir="$GIT_DIR/testgit/$alias"
14-
prefix="refs/testgit/$alias"
1514

16-
default_refspec="refs/heads/*:${prefix}/heads/*"
15+
refspec="refs/heads/*:refs/testgit/$alias/heads/*"
1716

18-
refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}"
19-
20-
test -z "$refspec" && prefix="refs"
17+
test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" && refspec=""
2118

2219
GIT_DIR="$url/.git"
2320
export GIT_DIR
@@ -81,10 +78,10 @@ do
8178

8279
echo "feature done"
8380
git fast-export \
81+
${refspec:+"--refspec=$refspec"} \
8482
${testgitmarks:+"--import-marks=$testgitmarks"} \
8583
${testgitmarks:+"--export-marks=$testgitmarks"} \
86-
$refs |
87-
sed -e "s#refs/heads/#${prefix}/heads/#g"
84+
$refs
8885
echo "done"
8986
;;
9087
export)

t/t5801-remote-helpers.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ test_expect_success 'forced push' '
124124
'
125125

126126
test_expect_success 'cloning without refspec' '
127-
GIT_REMOTE_TESTGIT_REFSPEC="" \
127+
GIT_REMOTE_TESTGIT_NOREFSPEC=1 \
128128
git clone "testgit::${PWD}/server" local2 2>error &&
129129
test_i18ngrep "this remote helper should implement refspec capability" error &&
130130
compare_refs local2 HEAD server HEAD
@@ -133,7 +133,7 @@ test_expect_success 'cloning without refspec' '
133133
test_expect_success 'pulling without refspecs' '
134134
(cd local2 &&
135135
git reset --hard &&
136-
GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) &&
136+
GIT_REMOTE_TESTGIT_NOREFSPEC=1 git pull 2>../error) &&
137137
test_i18ngrep "this remote helper should implement refspec capability" error &&
138138
compare_refs local2 HEAD server HEAD
139139
'
@@ -143,8 +143,8 @@ test_expect_success 'pushing without refspecs' '
143143
(cd local2 &&
144144
echo content >>file &&
145145
git commit -a -m ten &&
146-
GIT_REMOTE_TESTGIT_REFSPEC="" &&
147-
export GIT_REMOTE_TESTGIT_REFSPEC &&
146+
GIT_REMOTE_TESTGIT_NOREFSPEC=1 &&
147+
export GIT_REMOTE_TESTGIT_NOREFSPEC &&
148148
test_must_fail git push 2>../error) &&
149149
test_i18ngrep "remote-helper doesn.t support push; refspec needed" error
150150
'

0 commit comments

Comments
 (0)