Allow "check-ref-format --branch" from subdirectory
check-ref-format --branch requires access to the repository to resolve refs like @{-1}. Noticed by Nguyễn Thái Ngọc Duy. Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cfbe22f03f
commit
49cc460d88
@ -36,7 +36,9 @@ static void collapse_slashes(char *dst, const char *src)
|
||||
static int check_ref_format_branch(const char *arg)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
int nongit;
|
||||
|
||||
setup_git_directory_gently(&nongit);
|
||||
if (strbuf_check_branch_ref(&sb, arg))
|
||||
die("'%s' is not a valid branch name", arg);
|
||||
printf("%s\n", sb.buf + 11);
|
||||
|
Reference in New Issue
Block a user