Code

branch -f: no reason to forbid updating the current branch in a bare repo.
authorJunio C Hamano <junkio@cox.net>
Sat, 20 Jan 2007 18:51:37 +0000 (10:51 -0800)
committerJunio C Hamano <junkio@cox.net>
Sun, 21 Jan 2007 03:19:12 +0000 (19:19 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-branch.c

index c760e188ea4169d878986ebd0d6c22702802aa59..25ffa5491c62ea047e5fad78e60b8fa7e4e6a2fe 100644 (file)
@@ -324,7 +324,7 @@ static void create_branch(const char *name, const char *start_name,
        if (resolve_ref(ref, sha1, 1, NULL)) {
                if (!force)
                        die("A branch named '%s' already exists.", name);
-               else if (!strcmp(head, name))
+               else if (!is_bare_repository() && !strcmp(head, name))
                        die("Cannot force update the current branch.");
        }