[PATCH 3/3] name-rev: --weight option (WIP)

2012-08-29 Thread Junio C Hamano
Instead of naming a rev after a tip that is topologically closest, use the tip that is the oldest one among those which contain the rev. The semantics name-rev --weight would give is closer to what people expect from describe --contains. Note that this is fairly expensive (see NEEDSWORK comment

Re: [PATCH 3/3] name-rev: --weight option (WIP)

2012-08-29 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Note that this is fairly expensive (see NEEDSWORK comment in the code). And this is with the notes-cache. (priming the cache from scratch) $ rm .git/refs/notes/name-rev-weight $ /usr/bin/time ../git.git/git-name-rev --weight --tags

Re: [PATCH 3/3] name-rev: --weight option (WIP)

2012-08-29 Thread Jeff King
On Wed, Aug 29, 2012 at 04:37:06PM -0700, Junio C Hamano wrote: Junio C Hamano gits...@pobox.com writes: Note that this is fairly expensive (see NEEDSWORK comment in the code). And this is with the notes-cache. [...] +static int get_tip_weight(struct commit *commit) +{ + struct

Re: [PATCH 3/3] name-rev: --weight option (WIP)

2012-08-29 Thread Junio C Hamano
Jeff King p...@peff.net writes: OK. I didn't think too hard about it, so I'll trust you that it is not easy. I wonder if using the generation number would be another way of defining oldest that would be easier to calculate. Go back to my illustration to Greg and think about the implication of

Re: [PATCH 3/3] name-rev: --weight option (WIP)

2012-08-29 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: Jeff King p...@peff.net writes: OK. I didn't think too hard about it, so I'll trust you that it is not easy. I wonder if using the generation number would be another way of defining oldest that would be easier to calculate. Go back to my