Hi, On Fri, 11 Jul 2008, Johannes Schindelin wrote: > On Fri, 11 Jul 2008, Dmitry Potapov wrote: > > > On Fri, Jul 11, 2008 at 04:58:40PM +0200, Toralf Förster wrote: > > > > > > $> git-log v2.6.26-rc9.. --pretty=short | grep "^commit" | cut -f2 -d' ' | xargs -n 1 git describe | grep '\-56\-' > > > > The fastest way to do the same would be: > > > > git rev-list v2.6.26-rc9.. | xargs git describe | grep '\-56\-' > > You forgot the "--all" option to rev-list. > > And I doubt it would be the "fastest" way, in terms of execution speed. > > Also, it leaves out this case: > > rc9 - A - B - C - D - F > \ / > ----- E ----- > > F would be "rc9-5", but also "rc9-2". > > Oh, and this would leave out reflogs, too. > > Can we please let this concept die now? Heh, just as an intellectual exercise, I could not resist trying to brush up my l33t py7h0n sk1llz (and I am sure somebody will teach me something useful again): -- snipsnap -- #!/usr/bin/python import os import sys if len(sys.argv) != 2: print 'Usage:', sys.argv[0], '<pseudo-describe>' # split argument dash = sys.argv[1].rindex('-') tag = sys.argv[1][0:dash] generation = int(sys.argv[1][dash + 1:]) # get sha1 of given tag's commit pipe = os.popen('git rev-parse ' + tag + '^{commit}') sha1 = pipe.readlines()[0].strip() pipe.close() # 'number' will contain (positive) distance to given commit number = dict() number[sha1] = set() number[sha1].add(0) pipe = os.popen('git rev-list ^' + sha1 + ' --all --parents') rev_list = pipe.readlines() pipe.close() rev_list.reverse() for line in rev_list: list = line.strip().split(' ') number[list[0]] = set() for parent in list[1:]: if parent in number: for n in number[parent]: number[list[0]].add(n + 1) for n in number[list[0]]: if n == generation: print list[0]