From: Scott Weaver <[email protected]>

[redhat] process_configs.sh: include config commit

This adds a comment to the pending config file that documents the commit
where the new config was defined.  This is based on the "Defined at"
line provided by the helpnewconfig make target.

Signed-off-by: Scott Weaver <[email protected]>

diff --git a/redhat/configs/process_configs.sh 
b/redhat/configs/process_configs.sh
index blahblah..blahblah 100755
--- a/redhat/configs/process_configs.sh
+++ b/redhat/configs/process_configs.sh
@@ -148,7 +148,8 @@ parsenewconfigs()
         /usr/bin/awk -v BASE="$tmpdir" '
                 BEGIN { inpatch=0;
                        outfile="none";
-                        symbol="none"; }
+                        symbol="none";
+                        commit=""; }
                 /^Symbol: .*$/ {
                         split($0, a, " ");
                         symbol="CONFIG_"a[2];
@@ -160,9 +161,11 @@ parsenewconfigs()
                        }
                         else {
                                 if (symbol != "none") {
+                                    print "# Commit: "commit >> outfile
                                     system("cat " outfile " " BASE "/" symbol 
" > " BASE "/tmpf");
                                     system("mv " BASE "/tmpf " BASE "/" 
symbol);
                                     symbol="none"
+                                    commit=""
                                }
                                 outfile="none"
                                inpatch = 0;
@@ -173,6 +176,15 @@ parsenewconfigs()
                                 print "# "$0 >> outfile;
                         }
                 }
+                /^Defined at .*$/ {
+                        split($0, x, " ");
+                        filenum=x[3];
+                        split(filenum, x, ":");
+                        file=x[1]
+                        line=x[2]
+                        cmd="git blame -L " line "," line " " file " | cut -d 
\" \" -f1 | xargs git log --pretty=format:\"%C(auto)%h %C(cyan)('%s')\" -1"
+                        cmd | getline commit
+                }
 
 
         ' .helpnewconfig

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2923
--
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to