transport-helper: clarify pushing without refspecs
This has never worked, since it's inception the code simply skips all the refs, essentially telling fast-export to do nothing. Let's at least tell the user what's going on. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Apr 17, 2013 at 23:14 UTC
21610d820b97583a8f4e3e7f4a48716c8e32fd92
3 files changed
+8
-7
Documentation/gitremote-helpers.txt
+2
-2
@@ -162,8 +162,8 @@ Miscellaneous capabilities
162
For remote helpers that implement 'import' or 'export', this capability
163
allows the refs to be constrained to a private namespace, instead of
164
writing to refs/heads or refs/remotes directly.
165
- It is recommended that all importers providing the 'import' or 'export'
166
- capabilities use this.
165
+ It is recommended that all importers providing the 'import'
166
+ capability use this. It's mandatory for 'export'.
167
+
168
A helper advertising the capability
169
`refspec refs/heads/*:refs/svn/origin/branches/*`
t/t5801-remote-helpers.sh
+3
-3
@@ -111,13 +111,13 @@ test_expect_success 'pulling without refspecs' '
111
compare_refs local2 HEAD server HEAD
112
'
113
114
-test_expect_failure 'pushing without refspecs' '
114
+test_expect_success 'pushing without refspecs' '
115
test_when_finished "(cd local2 && git reset --hard origin)" &&
116
(cd local2 &&
117
echo content >>file &&
118
git commit -a -m ten &&
119
- GIT_REMOTE_TESTGIT_REFSPEC="" git push) &&
120
- compare_refs local2 HEAD server HEAD
119
+ GIT_REMOTE_TESTGIT_REFSPEC="" test_must_fail git push 2>../error) &&
120
+ grep "remote-helper doesn.t support push; refspec needed" error
121
'
122
123
test_expect_success 'pulling without marks' '
transport-helper.c
+3
-2
@@ -785,6 +785,9 @@ static int push_refs_with_export(struct transport *transport,
785
struct string_list revlist_args = STRING_LIST_INIT_NODUP;
786
struct strbuf buf = STRBUF_INIT;
787
788
+ if (!data->refspecs)
789
+ die("remote-helper doesn't support push; refspec needed");
790
+
791
helper = get_helper(transport);
792
793
write_constant(helper->in, "export\n");
@@ -795,8 +798,6 @@ static int push_refs_with_export(struct transport *transport,
798
char *private;
799
unsigned char sha1[20];
800
798
- if (!data->refspecs)
799
- continue;
801
private = apply_refspecs(data->refspecs, data->refspec_nr, ref->name);
802
if (private && !get_sha1(private, sha1)) {
803
strbuf_addf(&buf, "^%s", private);