@matheusbsbs / matheus-bagliano / commits / 1510dbe380
Fork 0

git checkout: don't warn about unborn branch if -f is already passed

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>

Matt McCutchen committed Nov 24, 2008 at 01:55 UTC 1510dbe380a24fdf303a3c0594752cfdc968cb12
1 file changed +1 -1
builtin-checkout.c
+1 -1
@@ -421,7 +421,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
421 if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
422 describe_detached_head("Previous HEAD position was", old.commit);
423
424 - if (!old.commit) {
424 + if (!old.commit && !opts->force) {
425 if (!opts->quiet) {
426 fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n");
427 fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name);