Skip to content

Commit

Permalink
git checkout: don't warn about unborn branch if -f is already passed
Browse files Browse the repository at this point in the history
I think it's unnecessary to warn that the checkout has been forced due to an
unborn current branch if -f has been explicitly passed.  For one project, I am
using git-new-workdir to create workdirs from a bare repository whose HEAD is
set to an unborn branch, and this warning started to irritate me.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matt McCutchen authored and Junio C Hamano committed Nov 28, 2008
1 parent c078383 commit 1510dbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
describe_detached_head("Previous HEAD position was", old.commit);

if (!old.commit) {
if (!old.commit && !opts->force) {
if (!opts->quiet) {
fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n");
fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name);
Expand Down

0 comments on commit 1510dbe

Please sign in to comment.