checkout: name check_linked_checkouts() more meaningfully
authorEric Sunshine <sunshine@sunshineco.com>
Fri, 17 Jul 2015 22:59:57 +0000 (18:59 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jul 2015 18:29:24 +0000 (11:29 -0700)
check_linked_checkouts() doesn't just "check" linked checkouts for
"something"; specifically, it aborts the operation if the branch about
to be checked out is already checked out elsewhere. Therefore, rename it
to die_if_checked_out() to give a better indication of its function.
The more meaningful name will be particularly important when this
function is later published for use by other callers.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c
index 75f90a9d1e0e37913805a3ecfac35552c61c6070..e75fb5e50f8be92b9f208c2eb45ebace338ff2ad 100644 (file)
@@ -910,7 +910,7 @@ static void check_linked_checkout(struct branch_info *new, const char *id)
        strbuf_release(&gitdir);
 }
 
-static void check_linked_checkouts(struct branch_info *new)
+static void die_if_checked_out(struct branch_info *new)
 {
        struct strbuf path = STRBUF_INIT;
        DIR *dir;
@@ -1152,7 +1152,7 @@ static int checkout_branch(struct checkout_opts *opts,
                char *head_ref = resolve_refdup("HEAD", 0, sha1, &flag);
                if (head_ref &&
                    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
-                       check_linked_checkouts(new);
+                       die_if_checked_out(new);
                free(head_ref);
        }