From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3416F20E030 for ; Sat, 29 Aug 2026 02:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787969222; cv=none; b=Ujb7xrN8QHeN2MpnlHzjOUW1tZZjXaCClZKJXpqquCcmFBmjBpcLyP4qqYORN4LBn85Mw855vGQyzp3WoyMcf2C5mxf+sarQr4t/CU8QlCMECLLxjtD5gTdfTzLFQ/k6Cv65VSNiZpPOMaMYQssjnmGv5Z9rcviRn+EP43PXCXo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787969222; c=relaxed/simple; bh=1cOl2i/Dyc407Y8l4spOPcoeALdpId3WXSkigULPjEg=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=cESufKgN/9/emKHJIfspNKWc26n2HMIkreWkISJ26Sikup6wdae/FtZcIh6kwE6zDR9lT9O/Ih+ENx5Y9A4krvW2AlSpfUsGxar0r/mnwtUkkrcL0H1dO04PoAedmdBbb4kJA9W0frH3KwzYZSkyY6sef8llXgjnHqgv9jt8Jjk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=bt2WLeBq; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HkmnWTgr; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="bt2WLeBq"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HkmnWTgr" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6A51F140016C; Fri, 28 Aug 2026 22:07:00 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-06.internal (MEProxy); Fri, 28 Aug 2026 22:07:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1787969220; x=1788055620; bh=sBFsmvtu3f VnX4SGmETQA1d0kcJO25Bl67EGCO/qBHY=; b=bt2WLeBqRbGVGsEQllc1pPTfWo wxTgIHYWy7yPsiGCpCAnhcZ8BuT5THlfadB3paJ6ud0mgKJ2hbm8VKh20PL9Yrub NanCZ8BzWHRSKMdFxxjZAsZux8pgebnJqTfmwxeF4UeO6uG2s1Ue1ePD7bZLDZi7 2AULoIXUkM4l/ATydDnAR1eaCBmDz4KUd0Y38yVUwujI7GD2G6TfDmVJFy2DiL++ GICH7olBR9zocjcYtrtcvm93cRF+a4Mq2WY6jddSYGyZnNW8EFAQOUpbizvWnmeP h2LTH4hQUIAUCBrIpiwLrHjnMiKqOv/dND5WXWGqMT8N7HvHD9n5RxFMmUhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1787969220; x=1788055620; bh=sBFsmvtu3fVnX4SGmETQA1d0kcJO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SKzg X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 28 Aug 2026 22:07:00 -0400 (EDT) From: Junio C Hamano To: git@vger.kernel.org Subject: Re: [PATCH 7/8] checkout: wrap overly long lines In-Reply-To: (Junio C. Hamano's message of "Fri, 28 Aug 2026 15:55:55 -0700") References: <20260828225206.310500-1-gitster@pobox.com> <20260828225206.310500-8-gitster@pobox.com> Date: Fri, 28 Aug 2026 19:06:59 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Junio C Hamano writes: >> + die_for_incompatible_opt3(opts->new_branch, >> + new_branch_opt, >> + opts->new_new_branch_force, > > Editor slip. This should of course be "opts->new_branch_force". Not just that, but some uses of die_for_incompatible_optN() changed the order of the options in the error message. Here is a fixed version. diff --git a/builtin/checkout.c b/builtin/checkout.c index b18515ac7f..9771c848c5 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1864,15 +1864,18 @@ static void validate_path_options(struct checkout_opts *opts) if (!opts->patch_mode) { if (opts->patch_context != -1) - die(_("the option '%s' requires '%s'"), "--unified", "--patch"); + die(_("the option '%s' requires '%s'"), + "--unified", "--patch"); if (opts->patch_interhunk_context != -1) - die(_("the option '%s' requires '%s'"), "--inter-hunk-context", "--patch"); + die(_("the option '%s' requires '%s'"), + "--inter-hunk-context", "--patch"); if (!opts->auto_advance) - die(_("the option '%s' requires '%s'"), "--no-auto-advance", "--patch"); + die(_("the option '%s' requires '%s'"), + "--no-auto-advance", "--patch"); } - if (opts->overlay_mode == 1 && opts->patch_mode) - die(_("options '%s' and '%s' cannot be used together"), "-p", "--overlay"); + die_for_incompatible_opt2(opts->patch_mode, "-p", + opts->overlay_mode == 1, "--overlay"); if (opts->checkout_index >= 0 || opts->checkout_worktree >= 0) { if (opts->checkout_index < 0) @@ -1914,19 +1917,25 @@ static void parse_pathspec_from_file_options(struct checkout_opts *opts, { if (opts->pathspec_from_file) { if (opts->pathspec.nr) - die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file"); - - if (opts->force_detach) - die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--detach"); - - if (opts->patch_mode) - die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--patch"); - - parse_pathspec_file(&opts->pathspec, 0, - 0, - prefix, opts->pathspec_from_file, opts->pathspec_file_nul); + die(_("'%s' and pathspec arguments cannot be used together"), + "--pathspec-from-file"); + + die_for_incompatible_opt2(!!opts->pathspec_from_file, + "--pathspec-from-file", + opts->force_detach, + "--detach"); + + die_for_incompatible_opt2(!!opts->pathspec_from_file, + "--pathspec-from-file", + opts->patch_mode, + "--patch"); + + parse_pathspec_file(&opts->pathspec, 0, 0, + prefix, opts->pathspec_from_file, + opts->pathspec_file_nul); } else if (opts->pathspec_file_nul) { - die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file"); + die(_("the option '%s' requires '%s'"), + "--pathspec-file-nul", "--pathspec-from-file"); } opts->pathspec.recursive = 1; @@ -1934,9 +1943,17 @@ static void parse_pathspec_from_file_options(struct checkout_opts *opts, static void validate_branch_options(struct checkout_opts *opts, char cb_option) { - if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1) - die(_("options '-%c', '-%c', and '%s' cannot be used together"), - cb_option, toupper(cb_option), "--orphan"); + char new_branch_opt[] = "-c"; + char new_branch_force_opt[] = "-C"; + + new_branch_opt[1] = cb_option; + new_branch_force_opt[1] = toupper(cb_option); + + die_for_incompatible_opt3(!!opts->new_branch, + new_branch_opt, + !!opts->new_branch_force, + new_branch_force_opt, + !!opts->new_orphan_branch, "--orphan"); if (opts->new_branch_force) opts->new_branch = opts->new_branch_force; @@ -2147,10 +2164,12 @@ int cmd_checkout(int argc, N_("create and checkout a new branch")), OPT_STRING('B', NULL, &opts.new_branch_force, N_("branch"), N_("create/reset and checkout a branch")), - OPT_BOOL('l', NULL, &opts.new_branch_log, N_("create reflog for new branch")), + OPT_BOOL('l', NULL, &opts.new_branch_log, + N_("create reflog for new branch")), OPT_BOOL(0, "guess", &opts.dwim_new_local_branch, N_("second guess 'git checkout ' (default)")), - OPT_BOOL(0, "overlay", &opts.overlay_mode, N_("use overlay mode (default)")), + OPT_BOOL(0, "overlay", &opts.overlay_mode, + N_("use overlay mode (default)")), OPT_BOOL(0, "auto-advance", &opts.auto_advance, N_("auto advance to the next file when selecting hunks interactively")), OPT_END() -- 2.55.0-884-g76cf8659c2