git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alex Henrie <alexhenrie24@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, karthik.188@gmail.com
Subject: Re: [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options
Date: Thu, 16 Feb 2023 20:07:24 -0700	[thread overview]
Message-ID: <CAMMLpeTVvWN0aSB=uTfSoYgJ_CXNYy4tmskdQk5HmKOpB9e+OQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqa61dpha9.fsf@gitster.g>

On Thu, Feb 16, 2023 at 12:00 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Alex Henrie <alexhenrie24@gmail.com> writes:
>
> > GitHub and GitLab have features to create a branch using the web
> > interface, then delete the branch after it is merged. That results in a
> > lot of "gone" branches in my local clone, and I frequently find myself
> > typing `git branch -v | grep gone`. I don't want `git branch --merged`
> > because that would include branches that have been created for future
> > work but do not yet have any commits.
>
> I can see why it is a useful feature to filter or group branches by
> its remote tracking status, but I do not know if the design
> presented here is what we want.  "--has-upstream" (yes/no) is
> understandable, but "--no-has-upstream" is quite a mouthful and an
> awkward way to say "no configured upstream" ("--has-no-upstream"
> might be more palatable).  "--gone" does not even hint it is about
> the precense or absense of upstream ("Are we looking for a branch
> that is gone?  Perhaps in a future we may have logs of branches that
> have been deleted?") and will not "click" in readers' mind that it
> is about branches configured to track some branch at the remote that
> has been removed.
>
> Perhaps something like
>
>         --upstream=(configured|unconfigured|gone)
>
> may be easier to explain, understand, and possibly more extensible
> but I dunno.
>
> If most people use a single remote and track branches from the
> single remote, then --upstream=origin to select branches with
> upstream configured somewhere in origin would allow users who
> interact with multiple remotes to further limit by remote.  Or we
> could even go --upstream=refs/remotes/origin/* using ref matching
> rules to specify that chosen branches must have upstream configured
> to refs that match the pattern (your "--has-upstream" becomes a mere
> special case of doing "--upstream=*"), with a special token, e.g.
> "--upstream=no", that never matches a real ref, to select ones
> without any upstream configured.
>
> I do not know offhand how that line of UI design that allows future
> enhancement would mesh with the concept of "configured upstream no
> longer exists", but whatever UI we pick that is understandable,
> explainable and extensible, it should be made to work well with
> "gone", too.

Hi Junio, thank you for the feedback.

I intentionally avoided naming the new option --upstream to avoid
confusion with the -u and --set-upstream-to options. And as you
pointed out, --upstream=(configured|unconfigured|gone) would preclude
adding an optional argument to search for branches with a particular
upstream.

I don't know how we could make the negative options sound better. The
inverses of --merged and --contains are --no-merged and --no-contains
(which also sound a little weird, but are perfectly understandable),
and I think there's value in following the same pattern.

You have a good point that --gone makes it sound like the option
searches for locally deleted branches. How about --upstream-gone
instead?

-Alex

  reply	other threads:[~2023-02-17  3:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16  4:14 [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options Alex Henrie
2023-02-16 19:00 ` Junio C Hamano
2023-02-17  3:07   ` Alex Henrie [this message]
2023-02-16 19:32 ` Konstantin Khomoutov
2023-02-16 22:35   ` Junio C Hamano
2023-02-17  3:12     ` Alex Henrie
2023-02-17 11:10       ` Konstantin Khomoutov
2023-02-17 10:50 ` Phillip Wood
2023-02-17 19:44   ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMMLpeTVvWN0aSB=uTfSoYgJ_CXNYy4tmskdQk5HmKOpB9e+OQ@mail.gmail.com' \
    --to=alexhenrie24@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).