Sam Vilain <sam@vilain.net> writes:Gaah. That goes all the way down to the root commit. + print "fetching revs for ".@refs." remote refs\n"; Is this meant to be final message to the end-user, or debug? + my %r = map { ($_ => undef) } + $git->command("rev-list", @refs); This traverses all the way down to the root commit, doesn't it? That is probably good enough for a toy repository for testing, but is impractical in real repositories, I am afraid. See below for the standard ways to check ancestry. + # don't delete the current branch + my ($checked_out) = $git->command(qw(symbolic-ref HEAD)); When the HEAD is detached, does the error message go directly to the end user? + while ( my ($ref, $rev) = each %l ) { + next if $checked_out and $ref eq $checked_out; + if ( exists $r{$rev} ) { + print "$ref is obsolete\n"; + $git->command(qw(update-ref -d), $ref, $rev); + } + } The standard way to check if commit A is included in (i.e. is an ancestor of) commit B, without traversing the ancestry chain of B all the way down to the root commit, is to run: git merge-base --all A B and see if A appears in its output (if so, then A is an ancestor of B, otherwise it is not). This is a pair-wise check, and for your purpose the check would become N*M operation (Yuck). The same check can be done in parallel with: git show-branch --independent A B C D... whose output would include A if the commit is not included in any of the other commits B C D... This parallel traversal has a limit --- you can only check 25 branches at a time. You make it sound like this is just a one-shot conversion issue, in which case I really doubt we would want that. But it appears to be a useful feature in general, provided if the assumed use case is described clearly so that new users know when to use it. In the form that was given to me, I think the documentation leaves the user in a "Huh?" state. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Greg KH | Re: Announce: Linux-next (Or Andrew's dream :-)) |
| Greg KH | [patch 26/73] NET: Correct two mistaken skb_reset_mac_header() conversions. |
| Greg Kroah-Hartman | [PATCH 007/196] Chinese: add translation of stable_kernel_rules.txt |
| Alan Cox | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Alexey Dobriyan | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 03/37] dccp: List management for new feature negotiation |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
