Re: [PATCH] Permit refspec source side to parse as a sha1
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
> I really think we cannot afford piling hacks on top of hacks to hide the
> broken interface forever. We have two different things to validate, and
> the callers all know what they have when calling us to validate. We
> should not have a single loose validation that only catches "it cannot be
> either fetch nor push refspec" breakage.
> ...
> But at least I think something like this patch would lead us in the right
> direction.
On top of the one I sent out, with this patch, you can:
$ git push other ':/remote show:refs/heads/new'
to send the commit you would review with "git show ':/remote show'".
---
builtin-send-pack.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 930e0fb..bb9c33a 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -537,7 +537,7 @@ static void verify_remote_names(int nr_heads, const char **heads)
int i;
for (i = 0; i < nr_heads; i++) {
- const char *remote = strchr(heads[i], ':');
+ const char *remote = strrchr(heads[i], ':');
remote = remote ? (remote + 1) : heads[i];
switch (check_ref_format(remote)) {