Re: [PATCH] branch: introduce --(no-)has-upstream and --(no-)gone options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phillip Wood <phillip.wood123@xxxxxxxxx> 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.







[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux