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

Re: [PATCH] git remote update: New option --prune (-p)

From
Ddemerphq <demerphq@gmail.com>
Date
Apr 2, 2009, 16:07 UTC
Message-ID
<9b18b3110904020907i23f246aelccc2a0770acc2574@mail.gmail.com>
In-Reply-To
<20090402143112.GA26974@coredump.intra.peff.net>
2009/4/2 Jeff King <peff@peff.net>:
Show 23 quoted lines
> On Thu, Apr 02, 2009 at 04:17:35PM +0200, demerphq wrote:
>
>> > But "git remote update" actually respects "remote groups", so it is not
>> > just "--all". I think what you want is "git remote prune <group>".
>>
>> Are there any implicit groups defined, like "all-remotes" or
>> something? It seems less than desirable to have to define such a group
>> for an operation that IMO is pretty reasonable to expect to happen
>> regularly.
>
> Yes. From "git help remote":
>
>       update
>           Fetch updates for a named set of remotes in the repository as
>           defined by remotes.<group>. If a named group is not specified on
>           the command line, the configuration parameter remotes.default will
>           get used; if remotes.default is not defined, all remotes which do
>           not have the configuration parameter
>           remote.<name>.skipDefaultUpdate set to true will be updated. (See
>           git-config(1)).
>
> So without defining any other config, "git remote update" will by
> default update everything

Er, personally i find that documentation pretty cryptic. And when i check git config for group, i see this:

       remotes.<group>
           The list of remotes which are fetched by "git remote update
           <group>". See git-remote(1).
and
       remote.<name>.skipDefaultUpdate
           If true, this remote will be skipped by default when updating using
           the update subcommand of git-remote(1).

Neither of which really explain groups, how to define them properly, (the list is separated by what? and includes the remote name?) or whether there are implicit groups. I mean, it seems logical that if you can have user defined groups that there are some built in ones too, like "all" and "none" or perhaps groups defined by transport "http" or "git" for instance.

Show 8 quoted lines
>> I personally haven't found any use for defining  remote groups yet to
>> be honest. Its a granularity of operation that hasnt served much
>> purpose for me yet. Although i could see it being useful in the
>> future.
>
> I haven't either. I suspect it would be useful if you had a complex set
> of repo relationships, like an integration manager pulling from an
> upstream but also from other developers.

Now that you have called my attention to them in more detail i suspect ill end up using them for a few things. Maybe ill try to write up a doc patch once i have.

Show 7 quoted lines
>> Generally tho I either want to update and prune one remote only, with
>>
>>    git fetch $remote; git prune $remote,
>
> It might be useful if "remote update" treated an unconfigured group as a
> simple remote. So that "git remote update --prune $remote" would do what
> you wanted here.

It seems reasonable to me that names for groups and remotes should stay distinct and that remotes are treated as being groups which contain only the remote of the same name. These would be yet more implicit groups.

Show 5 quoted lines
>
> I could even see "remote.*.autoprune" config being useful so you could
> avoid --prune. It is living dangerously, I suppose, for some workflows;
> but I generally consider whatever is in my remote tracking branches to
> be throwaway, and automatically pruning is not really dangerous.
Me too.
Show 14 quoted lines
>> or i want to update and prune all with something like:
>>
>>   git remote update; for r in $(git remote); do git remote prune $r; done;
>>
>> This patch makes the latter better huffman encoded, but I'd kind of
>> expect both to be doable as single commands in terms of how often I
>> want to do them.
>>
>> Maybe git fetch --prune would be a nice complement to this patch.
>
> I think we have tried to keep pruning out of fetch, as fetch does not
> necessarily use or know about tracking branches. But the "git remote
> update $remote" proposal I gave above would do basically the same thing
> (except you would call it "remote update" instead of "fetch").
Ok, that makes sense.  I see why fetch would be left out. Thanks for explaining.

cheers, Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Previous: Jeff KingNext: Jeff King
Message 6 of 15 in “git remote update: New option --prune (-p)”
  1. git remote update: New option --prune (-p)Finn Arne Gangstad, Apr 2, 2009
  2. demerphqApr 2, 2009
  3. Jeff KingApr 2, 2009
  4. demerphqApr 2, 2009
  5. Jeff KingApr 2, 2009
  6. demerphqApr 2, 2009
  7. Jeff KingApr 2, 2009
  8. demerphqApr 2, 2009
  9. Junio C HamanoApr 2, 2009
  10. Finn Arne GangstadApr 2, 2009
  11. Junio C HamanoApr 2, 2009
  12. 0/2 git remote update: New option --prune (-p)Finn Arne Gangstad, Apr 3, 2009
  13. 1/2 builtin-remote.c: Split out prune_remote as a separate function.Finn Arne Gangstad, Apr 3, 2009
  14. 2/2 git remote update: New option --pruneFinn Arne Gangstad, Apr 3, 2009
  15. Junio C HamanoApr 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.