Skip to contentSkip to conversation

Add .git-blame-ignore-revs with reformat commits

PATCH Superseded Arne Schwabe 4 participants 7 messages May 28, 2020 – Jun 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add .git-blame-ignore-revs with reformat commits

This allows git blame to ignore reformatting changes and instead shows the previous commit that changed the line.

To avoid manually building the list of commits this commit adds a file with a list of reformatting commits. I might have missed a few but this should be a good start. To use the file use:

   git blame --ignore-revs-file=.git-blame-ignore-revs file

or to automatically always use the file

git config blame.ignoreRevsFile .git-blame-ignore-revs

Naming the file .git-blame-ignore-revs is a convention.

Some more details in this random blog post:

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame

---
 .git-blame-ignore-revs                        | 29 +++++++++++++++++++
 .../managent-demo/management-demo-server.py   |  0
 contrib/ovpnkeys.py                           |  0
 3 files changed, 29 insertions(+)
 create mode 100644 .git-blame-ignore-revs
 create mode 100644 contrib/managent-demo/management-demo-server.py
 create mode 100644 contrib/ovpnkeys.py
.git-blame-ignore-revs new file +29 -0
new file mode 100644
index 00000000..3cc811cf
@@ -0,0 +1,29 @@
+# Uncrustify the tests/unit_tests/ part of our tree. 
+da1574ef7826d73f01e120cbd1ba40ce39a305b7
+
+# Another round of uncrustify code cleanup.
+9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# Uncrustify tapctl and openvpnmsica
+6280d3d5536174934ee22d3840457d61896e0e3a
+# tun.c: uncrustify
+baef44fc8769bbd99f4d699ce9f63180c29a5455
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# uncrustify openvpn sources
+f57431cdc88f22fa4d7962946f0d3187fe058539
+
+# More broadly enforce Allman style and braces-around-conditionals
+4cd4899e8e80efae03c584a760fd107251735723
+
+# Merge 'reformatting' branch into master
+1f004b2f06e987d73e48f7fd7b96b0b248274f58
+
+# The Great Reformatting - first phase
+81d882d5302b8b647202a6893b57dfdc61fd6df2
+
contrib/managent-demo/management-demo-server.py new file +0 -0
new file mode 100644
index 00000000..e69de29b
contrib/ovpnkeys.py new file +0 -0
new file mode 100644
index 00000000..e69de29b
Signature · 1 line
2.26.0
#1 lore raw
Quoted 12 lines · Arne Schwabe

This allows git blame to ignore reformatting changes and instead shows the previous commit that changed the line.

To avoid manually building the list of commits this commit adds a file with a list of reformatting commits. I might have missed a few but this should be a good start. To use the file use:

   git blame --ignore-revs-file=.git-blame-ignore-revs file

or to automatically always use the file

Quoted 8 lines

git config blame.ignoreRevsFile .git-blame-ignore-revs

Naming the file .git-blame-ignore-revs is a convention.

Some more details in this random blog post:

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame

Feature-ACK ... the commit message could also mention that git 2.23 is needed as well.

Quoted 17 lines
---
 .git-blame-ignore-revs                        | 29 +++++++++++++++++++
 .../managent-demo/management-demo-server.py   |  0
 contrib/ovpnkeys.py                           |  0
 3 files changed, 29 insertions(+)
 create mode 100644 .git-blame-ignore-revs
 create mode 100644 contrib/managent-demo/management-demo-server.py
 create mode 100644 contrib/ovpnkeys.py
.git-blame-ignore-revs new file +1 -0
new file mode 100644
index 00000000..3cc811cf
@@ -0,0 +1,29 @@
+# Uncrustify the tests/unit_tests/ part of our tree. 

.git-blame-ignore-revs line 11

Quoted 10 lines
.git-blame-ignore-revs new file +10 -0
+da1574ef7826d73f01e120cbd1ba40ce39a305b7
+
+# Another round of uncrustify code cleanup.
+9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# Uncrustify tapctl and openvpnmsica
+6280d3d5536174934ee22d3840457d61896e0e3a

Missing a blank line here, for consistency

Quoted 4 lines
.git-blame-ignore-revs new file +4 -0
+# tun.c: uncrustify
+baef44fc8769bbd99f4d699ce9f63180c29a5455
+
+# networking_sitnl.c: uncrustify file

.git-blame-ignore-revs line 25

Quoted 10 lines
.git-blame-ignore-revs new file +10 -0
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# uncrustify openvpn sources
+f57431cdc88f22fa4d7962946f0d3187fe058539
+
+# More broadly enforce Allman style and braces-around-conditionals
+4cd4899e8e80efae03c584a760fd107251735723
+
+# Merge 'reformatting' branch into master
+1f004b2f06e987d73e48f7fd7b96b0b248274f58

Are you sure this "merge" commit shouldn't be commit 81d882d5 instead?

contrib/managent-demo/management-demo-server.py

Quoted 6 lines
.git-blame-ignore-revs new file +4 -0
+
+# The Great Reformatting - first phase
+81d882d5302b8b647202a6893b57dfdc61fd6df2
+
contrib/managent-demo/management-demo-server.py new file +0 -0
new file mode 100644

This file shouldn't be included in this change.

contrib/ovpnkeys.py

Quoted 5 lines

index 00000000..e69de29b

contrib/ovpnkeys.py new file +0 -0
new file mode 100644
index 00000000..e69de29b

So a few minor things to look into, otherwise this is really valuable.

I would probably also consider to also add a note about this git feature in README. It's not the most ideal file, but I struggle to find a better place currently (I might have overlooked something). We would probably benefit having a separate developers README with all the hints, tips and tricks developers would need to care about. That is, however, out of scope for this change.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#2 lore raw

Am 29.05.20 um 15:51 schrieb David Sommerseth:

Quoted 55 lines · Arne Schwabe
Quoted 12 lines

This allows git blame to ignore reformatting changes and instead shows the previous commit that changed the line.

To avoid manually building the list of commits this commit adds a file with a list of reformatting commits. I might have missed a few but this should be a good start. To use the file use:

   git blame --ignore-revs-file=.git-blame-ignore-revs file

or to automatically always use the file

Quoted 8 lines

git config blame.ignoreRevsFile .git-blame-ignore-revs

Naming the file .git-blame-ignore-revs is a convention.

Some more details in this random blog post:

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame

Feature-ACK ... the commit message could also mention that git 2.23 is needed as well.

Quoted 17 lines
---
 .git-blame-ignore-revs                        | 29 +++++++++++++++++++
 .../managent-demo/management-demo-server.py   |  0
 contrib/ovpnkeys.py                           |  0
 3 files changed, 29 insertions(+)
 create mode 100644 .git-blame-ignore-revs
 create mode 100644 contrib/managent-demo/management-demo-server.py
 create mode 100644 contrib/ovpnkeys.py
.git-blame-ignore-revs new file +1 -0
new file mode 100644
index 00000000..3cc811cf
@@ -0,0 +1,29 @@
+# Uncrustify the tests/unit_tests/ part of our tree. 

.git-blame-ignore-revs line 11

Quoted 10 lines
.git-blame-ignore-revs new file +10 -0
+da1574ef7826d73f01e120cbd1ba40ce39a305b7
+
+# Another round of uncrustify code cleanup.
+9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# Uncrustify tapctl and openvpnmsica
+6280d3d5536174934ee22d3840457d61896e0e3a

Missing a blank line here, for consistency

Quoted 17 lines
Quoted 4 lines
.git-blame-ignore-revs new file +4 -0
+# tun.c: uncrustify
+baef44fc8769bbd99f4d699ce9f63180c29a5455
+
+# networking_sitnl.c: uncrustify file

.git-blame-ignore-revs line 25

Quoted 10 lines
.git-blame-ignore-revs new file +10 -0
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# uncrustify openvpn sources
+f57431cdc88f22fa4d7962946f0d3187fe058539
+
+# More broadly enforce Allman style and braces-around-conditionals
+4cd4899e8e80efae03c584a760fd107251735723
+
+# Merge 'reformatting' branch into master
+1f004b2f06e987d73e48f7fd7b96b0b248274f58

Are you sure this "merge" commit shouldn't be commit 81d882d5 instead?

I am not sure to be honest, that is why I included both commits as ignoring the merge commit might be instead then showing the other commit.

Arne

#3 lore raw

Hi,

Quoted 10 lines · Arne Schwabe

Am 29.05.20 um 15:51 schrieb David Sommerseth:

Quoted 6 lines · Arne Schwabe
Quoted 2 lines

+# Merge 'reformatting' branch into master
+1f004b2f06e987d73e48f7fd7b96b0b248274f58

Are you sure this "merge" commit shouldn't be commit 81d882d5 instead?

I am not sure to be honest, that is why I included both commits as ignoring the merge commit might be instead then showing the other commit.

merge commits are normally there to solve conflicts..or to do nothing.

The conflict might be related to the reformatting (so you think we may want to hide it)...but I think we should not ignore it in any case as resolving a conflict is potentially a source of bugs.

Regards,

Signature · 1 line
Antonio Quartulli
#4 lore raw

PATCH v2 1/1 Add .git-blame-ignore-revs with reformat commits

In reply to Arne Schwabe

This allows git blame to ignore reformatting changes and instead to show the previous commit that changed the line.

To avoid manually building the list of commits this commit adds a file with a list of reformatting commits. I might have missed a few but this should be a good start. To use the file use:

   git blame --ignore-revs-file=.git-blame-ignore-revs file

or to automatically always use the file

git config blame.ignoreRevsFile .git-blame-ignore-revs

Naming the file .git-blame-ignore-revs is a convention.

Some more details in this random blog post:

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame

Patch V2: Remove merge commit of the great formatting, add small
reminder how to use the feature at the top of the file

---
 .git-blame-ignore-revs                        | 39 +++++++++++++++++++
 .../managent-demo/management-demo-server.py   |  0
 contrib/ovpnkeys.py                           |  0
 3 files changed, 39 insertions(+)
 create mode 100644 .git-blame-ignore-revs
 create mode 100644 contrib/managent-demo/management-demo-server.py
 create mode 100644 contrib/ovpnkeys.py
.git-blame-ignore-revs new file +39 -0
new file mode 100644
index 00000000..6d9b374f
@@ -0,0 +1,39 @@
+# This FILE allows git blame to ignore reformatting changes and instead
+# shows the previous commit that changed the line.
+#
+# To avoid manually building the list of commits this commit
+# adds a file with a list of reformatting commits. TO use:
+#
+#   git blame --ignore-revs-file=.git-blame-ignore-revs file
+#
+# or to automatically always use the file
+#
+#   git config blame.ignoreRevsFile .git-blame-ignore-revs
+
+
+# Uncrustify the tests/unit_tests/ part of our tree.
+da1574ef7826d73f01e120cbd1ba40ce39a305b7
+
+# Another round of uncrustify code cleanup.
+9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# Uncrustify tapctl and openvpnmsica
+6280d3d5536174934ee22d3840457d61896e0e3a
+
+# tun.c: uncrustify
+baef44fc8769bbd99f4d699ce9f63180c29a5455
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# uncrustify openvpn sources
+f57431cdc88f22fa4d7962946f0d3187fe058539
+
+# More broadly enforce Allman style and braces-around-conditionals
+4cd4899e8e80efae03c584a760fd107251735723
+
+# The Great Reformatting - first phase
+81d882d5302b8b647202a6893b57dfdc61fd6df2
contrib/managent-demo/management-demo-server.py new file +0 -0
new file mode 100644
index 00000000..e69de29b
contrib/ovpnkeys.py new file +0 -0
new file mode 100644
index 00000000..e69de29b
Signature · 1 line
2.26.0
Acked-by David Somerseth on v2 1/1
#5 lore raw

contrib/managent-demo/management-demo-server.py

Quoted 79 lines · Arne Schwabe

This allows git blame to ignore reformatting changes and instead to show the previous commit that changed the line.

To avoid manually building the list of commits this commit adds a file with a list of reformatting commits. I might have missed a few but this should be a good start. To use the file use:

   git blame --ignore-revs-file=.git-blame-ignore-revs file

or to automatically always use the file

git config blame.ignoreRevsFile .git-blame-ignore-revs

Naming the file .git-blame-ignore-revs is a convention.

Some more details in this random blog post:

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame

Patch V2: Remove merge commit of the great formatting, add small
reminder how to use the feature at the top of the file

---
 .git-blame-ignore-revs                        | 39 +++++++++++++++++++
 .../managent-demo/management-demo-server.py   |  0
 contrib/ovpnkeys.py                           |  0
 3 files changed, 39 insertions(+)
 create mode 100644 .git-blame-ignore-revs
 create mode 100644 contrib/managent-demo/management-demo-server.py
 create mode 100644 contrib/ovpnkeys.py
.git-blame-ignore-revs new file +39 -0
new file mode 100644
index 00000000..6d9b374f
@@ -0,0 +1,39 @@
+# This FILE allows git blame to ignore reformatting changes and instead
+# shows the previous commit that changed the line.
+#
+# To avoid manually building the list of commits this commit
+# adds a file with a list of reformatting commits. TO use:
+#
+#   git blame --ignore-revs-file=.git-blame-ignore-revs file
+#
+# or to automatically always use the file
+#
+#   git config blame.ignoreRevsFile .git-blame-ignore-revs
+
+
+# Uncrustify the tests/unit_tests/ part of our tree.
+da1574ef7826d73f01e120cbd1ba40ce39a305b7
+
+# Another round of uncrustify code cleanup.
+9cf7b4925a54d93fbea1cadcf3dc0e11f3ce358f
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# Uncrustify tapctl and openvpnmsica
+6280d3d5536174934ee22d3840457d61896e0e3a
+
+# tun.c: uncrustify
+baef44fc8769bbd99f4d699ce9f63180c29a5455
+
+# networking_sitnl.c: uncrustify file
+2c45d268ca65c522fbabb7c4dab5e721296b4623
+
+# uncrustify openvpn sources
+f57431cdc88f22fa4d7962946f0d3187fe058539
+
+# More broadly enforce Allman style and braces-around-conditionals
+4cd4899e8e80efae03c584a760fd107251735723
+
+# The Great Reformatting - first phase
+81d882d5302b8b647202a6893b57dfdc61fd6df2
contrib/managent-demo/management-demo-server.py +0 -0

This looks good.

contrib/ovpnkeys.py

Quoted 6 lines

new file mode 100644
index 00000000..e69de29b

contrib/ovpnkeys.py new file +0 -0
new file mode 100644
index 00000000..e69de29b

Why do you keep on adding this file ;-)

I'd say this file could be removed at apply time.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Inc
#6 lore raw
In reply to Arne Schwabe

Great discovery, much appreciated :-) - and I have not added the two dangling new files in this patch.

Your patch has been applied to the master branch.

commit e0b49cb95286a62a4e615470c6d3fe841b433314

Author: Arne Schwabe
Date:   Fri Jun 5 01:53:38 2020 +0200
     Add .git-blame-ignore-revs with reformat commits

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg19967.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering