From: Junio C Hamano <gitster@pobox.com>
To: Harald Nordgren <haraldnordgren@gmail.com>
Cc: Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH v2 1/2] branch: suggest <remote>/<branch> on upstream slip
Date: Thu, 25 Jun 2026 14:16:54 -0700 [thread overview]
Message-ID: <xmqqfr2ae2wp.fsf@gitster.g> (raw)
In-Reply-To: <CAHwyqnXZ_eGUPOhq1hXs==uYuYbRBWw120fXRQa=apWKekxVAQ@mail.gmail.com> (Harald Nordgren's message of "Thu, 25 Jun 2026 09:44:12 +0200")
Harald Nordgren <haraldnordgren@gmail.com> writes:
>> Do we still need the _if_enabled() thing here? Isn't the caller
>> gated with the same condition in this version?
>>
>> > + strbuf_release(&remote_ref);
>> > + exit(code);
>> > +}
>> > +
>> > int cmd_branch(int argc,
>> > const char **argv,
>> > const char *prefix,
>> > @@ -957,6 +980,9 @@ int cmd_branch(int argc,
>> > if (!refs_ref_exists(get_main_ref_store(the_repository), branch->refname)) {
>> > if (!argc || branch_checked_out(branch->refname))
>> > die(_("no commit on branch '%s' yet"), branch->name);
>> > + if (argc == 1 &&
>> > + advice_enabled(ADVICE_SET_UPSTREAM_FAILURE))
>> > + die_if_upstream_looks_like_remote(new_upstream, argv[0]);
>> > die(_("branch '%s' does not exist"), branch->name);
>> > }
>
> I think we do, so it will give the advice and tell the user that it
> can be disabled in the standard format.
I was hoping that unconditional advise() should be sufficient, but
the caller there needs to say if_enabled, even though it _knows_
that it is enabled, only to give the turn-off instructions.
I wonder if future readers would be confused just like I was,
without a comment on the callsite of _if_enabled() added by this
patch?
Thanks.
next prev parent reply other threads:[~2026-06-25 21:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 11:10 [PATCH 0/2] branch/push: suggest intended form when remote/branch slip given Harald Nordgren via GitGitGadget
2026-06-12 11:10 ` [PATCH 1/2] branch: suggest <remote>/<branch> on upstream slip Harald Nordgren via GitGitGadget
2026-06-22 19:56 ` Junio C Hamano
2026-06-22 21:35 ` Junio C Hamano
2026-06-24 12:35 ` Ben Knoble
2026-06-12 11:10 ` [PATCH 2/2] push: suggest <remote> <branch> for a slash slip Harald Nordgren via GitGitGadget
2026-06-22 20:40 ` Junio C Hamano
2026-06-22 8:41 ` [PATCH 0/2] branch/push: suggest intended form when remote/branch slip given Harald Nordgren
2026-06-22 8:59 ` Weijie Yuan
2026-06-22 21:16 ` Junio C Hamano
2026-06-23 7:35 ` Harald Nordgren
2026-06-24 21:55 ` [PATCH v2 " Harald Nordgren via GitGitGadget
2026-06-24 21:55 ` [PATCH v2 1/2] branch: suggest <remote>/<branch> on upstream slip Harald Nordgren via GitGitGadget
2026-06-24 22:33 ` Junio C Hamano
2026-06-25 7:44 ` Harald Nordgren
2026-06-25 21:16 ` Junio C Hamano [this message]
2026-06-24 21:55 ` [PATCH v2 2/2] push: suggest <remote> <branch> for a slash slip Harald Nordgren via GitGitGadget
2026-06-24 22:42 ` Junio C Hamano
2026-06-25 3:36 ` Junio C Hamano
2026-06-25 7:53 ` Harald Nordgren
2026-06-25 13:12 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfr2ae2wp.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=haraldnordgren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox