miou icon indicating copy to clipboard operation
miou copied to clipboard

Git blame ignore revs

Open mbarbin opened this issue 11 months ago • 2 comments

I have seen this pattern in use in the ppxlib project, where revision applying ocamlformat upgrades are listed in this file. I don't have first-hand experience with this, but thought I would create a draft PR as a reminder to look into it at a later point.

There is no point in filling the revs too early, because the actual SHA is subject to many changes through force rebases before the fmt commit ends up being merged into main.

  • [x] Rebase and fill the actual revision.
  • [x] Look a bit into what this file is and how to use it (I suspect this is automatically used by git blame given the name, but just to double check since I am not familiar with this as of yet).

mbarbin avatar Jan 05 '25 20:01 mbarbin

I looked into what this file may be used for. My current understanding is that it should be manually provided to git blame, then it is useful. There may exists other conventions or tools that make use of this by default.

At any rate, this seems to do the trick:

mathieu:~/dev/forks/miou$ git blame lib/miou_unix.mli --ignore-revs-file=.git-blame-ignore-revs > /tmp/blame-ignoring-revs
mathieu:~/dev/forks/miou$ git blame lib/miou_unix.mli > /tmp/blame
mathieu:~/dev/forks/miou$ diff /tmp/blame{,-ignoring-revs} | head -n 6
3,4c3,4
< d5573222 (Mathieu Barbin      2025-01-05 17:51:34 +0100   3)     This module offers a re-implementation of the I/O according to Miou's model.
< d5573222 (Mathieu Barbin      2025-01-05 17:51:34 +0100   4)     This module is essentially concerned with reading and writing
---
> 97f1a5f7 (Calascibetta Romain 2024-04-02 11:24:50 +0200   3)     This module offers a re-implementation of the I/O according to Miou's model.
> 11e7b04c (Calascibetta Romain 2024-09-22 13:20:38 +0200   4)     This module is essentially concerned with reading and writing

mbarbin avatar Jan 07 '25 20:01 mbarbin

I'm ok with this PR but it requires a little documentation. I will do something probably tomorrow on this topic and see how to explain this file and how to fill it properly.

dinosaure avatar Jan 07 '25 20:01 dinosaure