git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: Alex Henrie <alexhenrie24@gmail.com>,
	git@vger.kernel.org, karthik.188@gmail.com
Subject: Re: [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options
Date: Fri, 17 Feb 2023 11:44:35 -0800	[thread overview]
Message-ID: <xmqq7cwgm5zw.fsf@gitster.g> (raw)
In-Reply-To: <437723a1-284d-e96c-9202-ae7bfcb830a9@dunelm.org.uk> (Phillip Wood's message of "Fri, 17 Feb 2023 10:50:13 +0000")

Phillip Wood <phillip.wood123@gmail.com> writes:

> Rather than adding several new options with hard to understand names I
> wonder if it would be better to add a --filter option that can be
> extended in the future.
>
> --filter upstream[=<pattern>]
>   Limit the output to branches whose configured upstream matches
>   <pattern>. If the optional pattern is omitted list all branches
>   with a configured upstream. To list branches with no configured
>   upstream use an empty pattern i.e. "upstream="
> ...
> If we wanted we could add "--filter contains=<commit>", "--filter
> merged=<commit>" and "--filter points-at=<commit>" and say the
> existing options are alias for those filters.

I do find the above approach much easier to explain and understand,
especially the part that makes it clear to users that the option is
about filtering the list of branches with their upstream status.

> --filter pruneable[=<remote>]
>   Limit the output to branches whose upstream has been removed by
>   "git fetch --prune". If <remote> is given only list those branches
>   whose upstream matches that remote.
>
> We could allow --filter with --delete so one could run
>     git branch --delete --filter pruneable=origin
> to delete all the branches with a missing upstream on the remote origin.

I however do not think "prunable" is an appropriate phrase for the
"gone" stuff.  Your topic may have started by forking from a remote
topic some time ago, and you have accumulated some work on the topic
branch.

    $ git fetch
    $ git checkout -b -t my-topic-Y remotes/origin/their-topic-X
    $ work work work 
    $ git commit

Back when you started your topic, their-topic-X was still work in
progress and was not merged to the mainline of the project, but it
recently graduated to the mainline.  The branch their-topic-X has
become unnecessary at the origin, and they removed the branch.  Then
you updated from the origin:

    $ git fetch --prune

Now, you no longer have remotes/origin/their-topic-X which my-topic-Y
was based on.  Did it make the my-topic-Y branch "prunable"?  Can we
discard it?  I doubt it.

If on the other hand the reason why their-topic-X disappeared as a
remote tracking branch was because it turned out to be a bad idea,
and got rejected without having been merged to anywhere, then, yes,
any new work you made on my-topic-Y is based on the faulty foundation
and may need to be redone completely or discarded.  But still I do
not think "prunable" is a good way to describe it.





      reply	other threads:[~2023-02-17 19:44 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
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 [this message]

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=xmqq7cwgm5zw.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=alexhenrie24@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=phillip.wood123@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).