1

I know revision of breaking change is a Framework but shitty changelog makes impossible to locate first breaking binary release.

I can locate it in Git history manually if put lots of attention with:

git log --all --graph --oneline --decorate

Unfortunately it is extremely hard to follow graph.

There is a trick for branches:

git branch -a --contains $REV

but I don't know one for tags and it doesn't show relations as a graph.

One possible idea is to construct revset as everything after $REV but I cannot figure it out from https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection otherwise it would be:

git log --graph --decorate --simplify-by-decoration --oneline  $ALL_AFTER_REV

It will include branches & tags.

PS So the actual problem in trickiness to specify descendants in Git. For hg it is trivial:

hg log --graph --style compact -r "tag() & descendants($REV)"

PPS I used info from:

gavenkoa
  • 37,355
  • 13
  • 206
  • 248
  • Could you show an example of the output you're looking for? And when you say "after $REV" do you mean commits older or newer than $REV? – Schwern Sep 08 '20 at 13:44
  • Newer than `$REV` but in graph not in time or other meta. Git operates with ancestors and it is hard to find descendants. I came up with rough Bash code using your suggestion for `git tag --contains`. – gavenkoa Sep 08 '20 at 14:35
  • A concrete example of the output you expect will help. – Schwern Sep 08 '20 at 14:38

2 Answers2

1

git tag also takes --contains.

But there's a better way to hunt for which commit caused a bug: git bisect. You give it the newest commit where the bug is not present, and the oldest commit where it is. Then it will conduct a binary search of the commits between to find the one which caused the bug. That means if you have 100 commits, it will only have to search roughly 14.

Git checks out a suspect commit. Then you tell it whether the bug is present or not. And it will check out the next suspect commit. Continue until it's been narrowed down to a single commit.

It can also be automated by providing a script to determine if the bug is present.

See Debugging With Git for more.

Schwern
  • 127,817
  • 21
  • 150
  • 290
  • I know broken rev. And I need to find all or special (marked by branch tip or tag) **descendants** . Seems Git doesn't support that out of the box. Need to `--contains` and shell magic to combine into single graph. – gavenkoa Sep 08 '20 at 14:07
  • @gavenkoa It's unclear what you are looking for. Could you provide an example of your desired output? – Schwern Sep 08 '20 at 14:19
1

I came up with Bash function:

mygit-descendants() {
  git log --graph --decorate --oneline  --simplify-by-decoration ^"$1" $(
    git branch --all --contains "$1" --format '%(objectname)';
    git tag --contains "$1" --format '%(objectname)';
      );
}

Because of ^ revspec it fails to show tag/branch on the same revision.

Some may suggest:

git describe --contains $REV

but it is limited to tags only and print only first reachable tag ((

gavenkoa
  • 37,355
  • 13
  • 206
  • 248