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 <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Jun 3, 2019 at 21:13 UTC
6e17fb3409d90f496769a5af1646a65e6770625b
2 files changed
+8
-11
git-remote-testgit.sh
+4
-7
@@ -11,13 +11,10 @@ fi
11
url=$2
12
13
dir="$GIT_DIR/testgit/$alias"
14
-prefix="refs/testgit/$alias"
14
16
-default_refspec="refs/heads/*:${prefix}/heads/*"
15
+refspec="refs/heads/*:refs/testgit/$alias/heads/*"
16
18
-refspec="${GIT_REMOTE_TESTGIT_REFSPEC-$default_refspec}"
19
-
20
-test -z "$refspec" && prefix="refs"
17
+test -n "$GIT_REMOTE_TESTGIT_NOREFSPEC" && refspec=""
18
19
GIT_DIR="$url/.git"
20
export GIT_DIR
@@ -81,10 +78,10 @@ do
78
79
echo "feature done"
80
git fast-export \
81
+ ${refspec:+"--refspec=$refspec"} \
82
${testgitmarks:+"--import-marks=$testgitmarks"} \
83
${testgitmarks:+"--export-marks=$testgitmarks"} \
86
- $refs |
87
- sed -e "s#refs/heads/#${prefix}/heads/#g"
84
+ $refs
85
echo "done"
86
;;
87
export)
t/t5801-remote-helpers.sh
+4
-4
@@ -124,7 +124,7 @@ test_expect_success 'forced push' '
124
'
125
126
test_expect_success 'cloning without refspec' '
127
- GIT_REMOTE_TESTGIT_REFSPEC="" \
127
+ GIT_REMOTE_TESTGIT_NOREFSPEC=1 \
128
git clone "testgit::${PWD}/server" local2 2>error &&
129
test_i18ngrep "this remote helper should implement refspec capability" error &&
130
compare_refs local2 HEAD server HEAD
@@ -133,7 +133,7 @@ test_expect_success 'cloning without refspec' '
133
test_expect_success 'pulling without refspecs' '
134
(cd local2 &&
135
git reset --hard &&
136
- GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) &&
136
+ GIT_REMOTE_TESTGIT_NOREFSPEC=1 git pull 2>../error) &&
137
test_i18ngrep "this remote helper should implement refspec capability" error &&
138
compare_refs local2 HEAD server HEAD
139
'
@@ -143,8 +143,8 @@ test_expect_success 'pushing without refspecs' '
143
(cd local2 &&
144
echo content >>file &&
145
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 &&
148
test_must_fail git push 2>../error) &&
149
test_i18ngrep "remote-helper doesn.t support push; refspec needed" error
150
'