git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Automatically remote prune

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 5, 2009, 02:23 UTC
Message-ID
<7viqdpemki.fsf@alter.siamese.dyndns.org>
In-Reply-To
<43d8ce650911041741w4b39d137ha2a1529a15256d27@mail.gmail.com>
John Tapsell <johnflux@gmail.com> writes:
Show 8 quoted lines
> 2009/11/5 Junio C Hamano <gitster@pobox.com>:
>> John Tapsell <johnflux@gmail.com> writes:
>
>> You could store necessary information somewhere else when you contacted
>> the remote the last time, but we need to consider what the benefits are to
>> give this information in the first place.
>
> We already get all this information on a "git fetch", no?

"what the benefits are to give this information _in the 'branch' output_" was what I meant. From the part you omitted from my message:

    The [Deleted] mark in your suggestion tells the user:
        This is already removed in the remote, and this tracking copy is the
        only way for you to view it ever again.  Do not run 'remote prune
        origin' blindly otherwise you will lose it.

There are two reasons I could think of that the user might want to know this.

 (1) The user wants to keep the remotes/<origin>/* namespace clean (iow,
     the user does not care to keep old commits that were deemed bad by
     the remote side) by removing stale tracking refs.  But in this case,
     it is very unlikely that the user would use "git branch -d -r" to
     remove stale ones one-by-one after seeing '[Deleted]' label in the
     output from "git branch -r".  Rather he would run "git remote prune
     origin" to blindly remove them all.
 (2) The user does want to be careful not to lose commits that now only
     exists in his repository.  Perhaps he saw something worthwhile to
     base his topic later on.  But these stale remote tracking refs are
     not removed until the user runs "git remote prune origin".  As long
     as we give him a way to check what will be pruned before running "git
     remote prune", there is not much point in showing that information in
     output of "git branch -r".  There is no need to keep extra info by
     creating a new file in .git by "fetch". Nor showing that to the user
     when he does "fetch" either, for that matter.

A better approach to please the first class of audience may be to introduce an option that tells fetch to cull tracking refs that are stale. Then "branch -r" output will not show stale refs and there is no place (nor need) to show [Deleted] labels.

Such an option won't be very useful for the second class of audience, though. For them we would need something else, and it would likely be an enhancement to "git remote". It would ask the other side what refs are no longer there, and then check our local refspace to see if there are local topics based on them (which would mean the user is already in a trouble) and which ones are not forked locally at all (which may mean "it wasn't interesting to the user, and we can safely remove it" or "the user was interested in it, but hasn't got around to forking from it yet, being busy working on something else"). I am unsure what should be done in the latter case (i.e. lost remote refs haven't been touched locally) but am just thinking aloud.

Previous: Shawn O. PearceNext: Sitaram Chamarty
Message 5 of 15 in “Automatically remote prune”
  1. John TapsellNov 4, 2009
  2. Junio C HamanoNov 4, 2009
  3. John TapsellNov 5, 2009
  4. Shawn O. PearceNov 5, 2009
  5. Junio C HamanoNov 5, 2009
  6. Sitaram ChamartyNov 5, 2009
  7. John TapsellNov 5, 2009
  8. Junio C HamanoNov 5, 2009
  9. Jay SoffianNov 5, 2009
  10. Petr BaudisNov 6, 2009
  11. Jay SoffianNov 6, 2009
  12. Petr BaudisNov 6, 2009
  13. Junio C HamanoNov 8, 2009
  14. Petr BaudisNov 6, 2009
  15. Dmitry PotapovNov 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.