Merge branch 'maint'

* maint:
  annotate: make it work from subdirectories.
  git-config: Correct asciidoc documentation for --int/--bool
  t1300: Add tests for git-config --bool --get
  unpack-trees.c: verify_uptodate: remove dead code
  Use PATH_MAX instead of TEMPFILE_PATH_LEN
  branch: fix segfault when resolving an invalid HEAD
This commit is contained in:
Junio C Hamano
2007-05-20 19:58:03 -07:00
6 changed files with 48 additions and 18 deletions

View File

@ -623,9 +623,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
(rename && force_create))
usage(builtin_branch_usage);
head = xstrdup(resolve_ref("HEAD", head_sha1, 0, NULL));
head = resolve_ref("HEAD", head_sha1, 0, NULL);
if (!head)
die("Failed to resolve HEAD as a valid ref.");
head = xstrdup(head);
if (!strcmp(head, "HEAD")) {
detached = 1;
}