diff options
author | Junio C Hamano <junkio@cox.net> | 2007-04-11 18:43:01 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-04-11 18:43:01 -0700 |
commit | 566f5b217df73d6a642a0857cc5c13c11f84e7c3 (patch) | |
tree | ff172bf2658ca4e1f4c88d30bb80c8af17f29b2d /builtin-fsck.c | |
parent | gitweb: Allow configuring the default projects order and add order 'none' (diff) | |
parent | GIT 1.5.1.1 (diff) | |
download | tgif-566f5b217df73d6a642a0857cc5c13c11f84e7c3.tar.xz |
Merge branch 'maint'
* maint:
GIT 1.5.1.1
cvsserver: Fix handling of diappeared files on update
fsck: do not complain on detached HEAD.
(encode_85, decode_85): Mark source buffer pointer as "const".
Diffstat (limited to 'builtin-fsck.c')
-rw-r--r-- | builtin-fsck.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/builtin-fsck.c b/builtin-fsck.c index 4d8b66c344..05d98d2cfc 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -534,7 +534,7 @@ static void get_default_heads(void) * "show_unreachable" flag. */ if (!default_refs) { - error("No default references"); + fprintf(stderr, "notice: No default references\n"); show_unreachable = 0; } } @@ -554,15 +554,23 @@ static int fsck_head_link(void) { unsigned char sha1[20]; int flag; - const char *head_points_at = resolve_ref("HEAD", sha1, 1, &flag); - - if (!head_points_at || !(flag & REF_ISSYMREF)) - return error("HEAD is not a symbolic ref"); - if (prefixcmp(head_points_at, "refs/heads/")) + int null_is_error = 0; + const char *head_points_at = resolve_ref("HEAD", sha1, 0, &flag); + + if (!head_points_at) + return error("Invalid HEAD"); + if (!strcmp(head_points_at, "HEAD")) + /* detached HEAD */ + null_is_error = 1; + else if (prefixcmp(head_points_at, "refs/heads/")) return error("HEAD points to something strange (%s)", head_points_at); - if (is_null_sha1(sha1)) - return error("HEAD: not a valid git pointer"); + if (is_null_sha1(sha1)) { + if (null_is_error) + return error("HEAD: detached HEAD points at nothing"); + fprintf(stderr, "notice: HEAD points to an unborn branch (%s)\n", + head_points_at + 11); + } return 0; } |