Skip to contentSkip to conversation

minor changes in script used for backports

PATCH In review Thomas Monjalon 3 participants 9 messages Apr 18, 2023 – Nov 30, 2024

lore
Share & tools
lore
#0 lore raw

cover minor changes in script used for backports

While looking again at git-log-fixes.sh,
I've found a minor bug and a small improvement.

Thomas Monjalon (2):
devtools: fix check of multiple commits fixed at once
devtools: deduplicate function to mark fixes

 devtools/git-log-fixes.sh | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)
Signature · 1 line
2.40.0
#1 lore raw

PATCH 1/2 devtools: fix check of multiple commits fixed at once

When looking for fixes to backport,
only the first origin commit hash (from "Fixes:") was checked. There is very little chance that the next commits being fixed have a wrong hash in the commit log of the fix,
but it is fixed by checking them all before proceeding further.

Fixes 752d8e097ec1 ("scripts: show fixes with release version of bug")
---
 devtools/git-log-fixes.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/git-log-fixes.sh +1 -1
index 8a4a8470c2..4690dd4545 100755
@@ -68,7 +68,7 @@ origin_version () # <origin_hash> ...
 {
 	for origin in $* ; do
 		# check hash is valid
-		git rev-parse -q --verify $1 >&- || continue
+		git rev-parse -q --verify $origin >&- || continue
 		# get version of this bug origin
 		local origver=$(commit_version $origin)
 		local roothashes="$(origin_filter $origin)"
Signature · 1 line
2.40.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] devtools: fix check of multiple commits fixed at once

Quoted 7 lines · Thomas Monjalon

When looking for fixes to backport,
only the first origin commit hash (from "Fixes:") was checked. There is very little chance that the next commits being fixed have a wrong hash in the commit log of the fix,
but it is fixed by checking them all before proceeding further.

Quoted 7 lines
Fixes 752d8e097ec1 ("scripts: show fixes with release version of bug")
---
 devtools/git-log-fixes.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] devtools: fix check of multiple commits fixed at once

In reply to Thomas Monjalon
Quoted 19 lines · Thomas Monjalon

When looking for fixes to backport,
only the first origin commit hash (from "Fixes:") was checked. There is very little chance that the next commits being fixed have a wrong hash in the commit log of the fix,
but it is fixed by checking them all before proceeding further.

Fixes 752d8e097ec1 ("scripts: show fixes with release version of bug")
---
 devtools/git-log-fixes.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
devtools/git-log-fixes.sh +0 -0
index 8a4a8470c2..4690dd4545 100755

devtools/git-log-fixes.sh origin_version () # <origin_hash> ... · line 74

Quoted 8 lines
devtools/git-log-fixes.sh +1 -1
@@ -68,7 +68,7 @@ origin_version () # <origin_hash> ...
 {
 	for origin in $* ; do
 		# check hash is valid
-		git rev-parse -q --verify $1 >&- || continue
+		git rev-parse -q --verify $origin >&- || continue
 		# get version of this bug origin
 		local origver=$(commit_version $origin)
 		local roothashes="$(origin_filter $origin)"

These still apply and working well.

#4 lore raw

PATCH 2/2 devtools: deduplicate function to mark fixes

In reply to Thomas Monjalon

In the commit 8070d8fecb4e ("devtools: add fixes flag to commit listing") the function to mark a commit for "stable" was duplicated for "Fixes:" mark.

The code is a bit smaller by using a single function for both marks.

---
 devtools/git-log-fixes.sh | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
devtools/git-log-fixes.sh +6 -16
index 4690dd4545..005e46f715 100755
@@ -84,31 +84,21 @@ origin_version () # <origin_hash> ...
 	done | sort -uV | head -n1
 }
 
-# print a marker for stable tag presence
-stable_tag () # <hash>
+# print a marker for pattern presence in the commit message
+git_log_mark () # <hash> <pattern> <marker>
 {
-	if git log --format='%b' -1 $1 | grep -qi '^Cc: *[email protected]' ; then
-		echo 'S'
+	if git log --format='%b' -1 $1 | grep -qi "$2" ; then
+		echo "$3"
 	else
 		echo '-'
 	fi
 }
 
-# print a marker for fixes tag presence
-fixes_tag () # <hash>
-{
-        if git log --format='%b' -1 $1 | grep -qi '^Fixes: *' ; then
-                echo 'F'
-        else
-                echo '-'
-        fi
-}
-
 git log --oneline --reverse $range |
 while read id headline ; do
 	origins=$(origin_filter $id)
-	stable=$(stable_tag $id)
-	fixes=$(fixes_tag $id)
+	stable=$(git_log_mark $id '^Cc: *[email protected]' 'S')
+	fixes=$(git_log_mark $id '^Fixes:' 'F')
 	[ "$stable" = "S" ] || [ "$fixes" = "F" ] || [ -n "$origins" ] || continue
 	version=$(commit_version $id)
 	if [ -n "$origins" ] ; then
Signature · 1 line
2.40.0
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] devtools: deduplicate function to mark fixes

Quoted 10 lines · Thomas Monjalon

In the commit 8070d8fecb4e ("devtools: add fixes flag to commit listing") the function to mark a commit for "stable" was duplicated for "Fixes:" mark.

The code is a bit smaller by using a single function for both marks.

---
 devtools/git-log-fixes.sh | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
Acked-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] devtools: deduplicate function to mark fixes

In reply to Thomas Monjalon
Quoted 42 lines · Thomas Monjalon

In the commit 8070d8fecb4e ("devtools: add fixes flag to commit listing") the function to mark a commit for "stable" was duplicated for "Fixes:" mark.

The code is a bit smaller by using a single function for both marks.

---
 devtools/git-log-fixes.sh | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
devtools/git-log-fixes.sh +4 -14
index 4690dd4545..005e46f715 100755
@@ -84,31 +84,21 @@ origin_version () # <origin_hash> ...
 	done | sort -uV | head -n1
 }
 
-# print a marker for stable tag presence
-stable_tag () # <hash>
+# print a marker for pattern presence in the commit message
+git_log_mark () # <hash> <pattern> <marker>
 {
-	if git log --format='%b' -1 $1 | grep -qi '^Cc: *[email protected]' ; then
-		echo 'S'
+	if git log --format='%b' -1 $1 | grep -qi "$2" ; then
+		echo "$3"
 	else
 		echo '-'
 	fi
 }
 
-# print a marker for fixes tag presence
-fixes_tag () # <hash>
-{
-        if git log --format='%b' -1 $1 | grep -qi '^Fixes: *' ; then
-                echo 'F'
-        else
-                echo '-'
-        fi
-}
-

devtools/git-log-fixes.sh origin_version () # <origin_hash> ... · line 104

Quoted 10 lines
devtools/git-log-fixes.sh +2 -2
 git log --oneline --reverse $range |
 while read id headline ; do
 	origins=$(origin_filter $id)
-	stable=$(stable_tag $id)
-	fixes=$(fixes_tag $id)
+	stable=$(git_log_mark $id '^Cc: *[email protected]' 'S')
+	fixes=$(git_log_mark $id '^Fixes:' 'F')
 	[ "$stable" = "S" ] || [ "$fixes" = "F" ] || [ -n "$origins" ] || continue
 	version=$(commit_version $id)
 	if [ -n "$origins" ] ; then
#7 lore raw
In reply to Thomas Monjalon

These patches have been forgotten.
Adding more Cc.

18/04/2023 16:07, Thomas Monjalon:

Quoted 6 lines

While looking again at git-log-fixes.sh,
I've found a minor bug and a small improvement.

Thomas Monjalon (2):
devtools: fix check of multiple commits fixed at once
devtools: deduplicate function to mark fixes

author Acked-by Luca Boccassi Acked-by Kevin Traynor Applied
#8 lore raw

28/11/2023 14:23, Thomas Monjalon:

Quoted 10 lines

These patches have been forgotten.
Adding more Cc.

18/04/2023 16:07, Thomas Monjalon:

Quoted 6 lines

While looking again at git-log-fixes.sh,
I've found a minor bug and a small improvement.

Thomas Monjalon (2):
devtools: fix check of multiple commits fixed at once
devtools: deduplicate function to mark fixes

Applied