Subject: Re: Reachability lists in git

From: Jonathan Nieder <[email-masked]>
Date: Tue, 18 Nov 2014 12:22:51 -0800

Junio C Hamano wrote:
> Jonathan Nieder <[email-masked]> writes:

>> --ancestry-path is my current favorite tool for walking-forward needs.
>
> Curious.  I often want to answer this question:
[...]
> And my experiments with --ancestry-path has been less than ideal.

Thanks for an example.  I've found it works okay interactively, less
so for scripted use (so I wish there were something better, though I
haven't sketched out what that something better would look like).

>     Commit 982ac87 was reported to be faulty.  What topic was it on
>     and at which point was it merged to 'master'?

 $ git log --graph --ancestry-path 982ac87^..origin/master
[...]
 * | commit f30366b27a91dbc18328bccf3067cdfad4f0cfbc
 |/  Merge: 97fefaf efa5f82
 |   Author: Junio C Hamano <[email-masked]>
 |   Date:   Wed Apr 3 09:34:04 2013 -0700
 |
 |       Merge branch 'jc/directory-attrs-regression-fix'
 |
 |       Fix 1.8.1.x regression that stopped matching "dir" (without
 |       trailing slash) to a directory "dir".
 |
 |       * jc/directory-attrs-regression-fix:
 |         t: check that a pattern without trailing slash matches a directory
 |         dir.c::match_pathname(): pay attention to the length of string parameters
 |         dir.c::match_pathname(): adjust patternlen when shifting pattern
 |         dir.c::match_basename(): pay attention to the length of string parameters
 |         attr.c::path_matches(): special case paths that end with a slash
 |         attr.c::path_matches(): the basename is part of the pathname
[...]
 |
 * commit 982ac87316a1cf5126888157bdcbfa32268ebe47
   Author: Jeff King <[email-masked]>
   Date:   Thu Mar 28 17:47:47 2013 -0400

       dir.c::match_pathname(): adjust patternlen when shifting pattern

>      - What is the 'bottom' of the topic, that is, the commit
>        reachable from the faulty commit that was already on 'master'
>        when the faulty commit was written the first time?

 $ git tag the-merge f30366b27a91dbc18328bccf3067cdfad4f0cfbc
 $ git merge-base 982ac87 the-merge^
 9db9eecfe5c2490d17c0d4bd5452e4cb1d0948c5

>      - What is the 'top' of the topic, that is, were there more
>        commits made on top to build on the faulty commit on the
>        topic before the whole thing was merged to 'master'?

 $ git log --oneline 982ac87..the-merge^2
 efa5f82 t: check that a pattern without trailing slash matches a directory
 ab3aebc dir.c::match_pathname(): pay attention to the length of string parameters

>      - Were there follow-up fixes and enhancements on the topic
>        after the topic was merged to 'master' (this is harder)?

There's only one line coming out of the-merge^2 in the ancestry-path
graph, so there were no such follow-up fixes.

Jonathan