send-pack: tighten checks for remote names

"git push $URL HEAD~6" created a bogus ref HEAD~6 immediately
under $GIT_DIR of the remote repository.  While we should keep
refspecs that have arbitrary extended SHA-1 expression on the
source side working (e.g. "HEAD~6:refs/tags/yesterday"), we
should not create bogus ref on the other end.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano
2006-12-13 10:30:11 -08:00
parent 411fb8baa6
commit 37adac765a
2 changed files with 22 additions and 1 deletions

2
refs.c
View File

@ -534,7 +534,7 @@ int check_ref_format(const char *ref)
level++;
if (!ch) {
if (level < 2)
return -1; /* at least of form "heads/blah" */
return -2; /* at least of form "heads/blah" */
return 0;
}
}