Skip to content

Commit e13d370

Browse files
sunshinecogitster
authored andcommitted
checkout: name check_linked_checkouts() more meaningfully
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c265c53 commit e13d370

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ static void check_linked_checkout(struct branch_info *new, const char *id)
910910
strbuf_release(&gitdir);
911911
}
912912

913-
static void check_linked_checkouts(struct branch_info *new)
913+
static void die_if_checked_out(struct branch_info *new)
914914
{
915915
struct strbuf path = STRBUF_INIT;
916916
DIR *dir;
@@ -1152,7 +1152,7 @@ static int checkout_branch(struct checkout_opts *opts,
11521152
char *head_ref = resolve_refdup("HEAD", 0, sha1, &flag);
11531153
if (head_ref &&
11541154
(!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
1155-
check_linked_checkouts(new);
1155+
die_if_checked_out(new);
11561156
free(head_ref);
11571157
}
11581158

0 commit comments

Comments
 (0)