summaryrefslogtreecommitdiff
path: root/builtin/check-ref-format.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-06 03:39:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-06 17:01:45 (GMT)
commit49cc460d88f5bae79b45ce2db16674f36b6cf38a (patch)
tree5b347503edd9e9000e53565144e9f4617c28858f /builtin/check-ref-format.c
parentcfbe22f03f9be1f3bbbd33240dcb127099d4346e (diff)
downloadgit-49cc460d88f5bae79b45ce2db16674f36b6cf38a.zip
git-49cc460d88f5bae79b45ce2db16674f36b6cf38a.tar.gz
git-49cc460d88f5bae79b45ce2db16674f36b6cf38a.tar.bz2
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>
Diffstat (limited to 'builtin/check-ref-format.c')
-rw-r--r--builtin/check-ref-format.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index 8707ee9..ae3f281 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -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);