On Wednesday 09 February 2011, Junio C Hamano wrote: > Johan Herland <johan@xxxxxxxxxxx> writes: > > Ah, yes, I should have been more specific: > > remote.origin.fetch = ~refs/tags/*:refs/tags/* > > Hmmm, I was in the vicinity of builtin/fetch.c:find_non_local_tags() > today, and I had to wonder what the implementation of this would look > like.... AFAIK, find_non_local_tags() is called to produce a list of refs to be auto- followed. Currently it produces this list by traversing the remote refs, and selecting refs that follow all of these criteria: A. Ref name starts with "refs/tags" B. Ref refers (after peeling) to an object that is either already locally available, or is already on the list of objects to be fetched. C. Ref name does not already exist locally. Now, here's roughly how I would change it to implement the "~from:to"-style refspecs: 0. Change its name from find_non_local_tags() to find_auto_follow_refs(). 1. At the top, enumerate the auto-following refspecs ("~refs/tags/*:refs/tags/*" in this case) 2. When traversing the remote refs, instead of criteria A above, we want to check if ref->name matches the remote side of any of the auto-following refspecs enumerated in step #1. Skip past all non-matches. 3. Criteria B stays unchanged. 4. When checking criteria C, we want to check against the _local_ side of the matched auto-following refspec. AFAICS, that's pretty much what should be needed. There are some other things to consider as well, but IMHO none of those seem like show stoppers: For example, there may be command-line options for making auto-following refspecs explicit (i.e. corresponding to --tags; basically disables the "~" in the refspec), or disabling auto-following (i.e. corresponding to --no- tags; basically disregards refspecs with "~"). Another slight complication is refspecs with _both_ "~" and "+" (i.e. both auto-following and --force behavior), which may be resolved by disregarding criteria C for those refspecs. Have fun! :) ...Johan -- Johan Herland, <johan@xxxxxxxxxxx> www.herland.net -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html