Jeff King <peff@xxxxxxxx> writes: > + /* > + * We may have selected a local default branch name "foo", > + * and even though the remote's HEAD does not point there, > + * it may still have a "foo" branch. If so, set it up so > + * that we can follow the usual checkout code later. Very sensible. > + * > + * Note that for an empty repo we'll already have set > + * option_no_checkout above, which would work against us here. > + * But for an empty repo, find_remote_branch() can never find > + * a match. > + */ > + our_head_points_at = find_remote_branch(mapped_refs, branch); > + > + if (!option_bare && !our_head_points_at) > install_branch_config(0, branch, remote_name, ref); I may be completely confused, but shouldn't the condition read "if we are not bare, and we did find the 'branch' in their refs", i.e. without "!" in front of our_head_points_at?