Skip to contentSkip to conversation

get_maintainer.pl: teach git log to use --no-color

PATCH In review Richard Kennedy 2 participants 5 messages Jan 22, 2010 – Jan 23, 2010 GET_MAINTAINER script

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get_maintainer.pl: teach git log to use --no-color

When git has been set to always use color in .gitconfig then I get the warning message

Bad divisor in main::vcs_assign: 0

This is caused by vcs_file_signoffs not matching any commits due to the pattern not understand the colour codes. Fix this by telling git log to never use colour.

----
patch against 2.6.33-rc5
git --version 1.6.6

scripts/get_maintainer.pl +1 -1
index 090f248..2cae27a 100755
@@ -74,7 +74,7 @@ my %VCS_cmds;
 my %VCS_cmds_git = (
     "execute_cmd" => \&git_execute_cmd,
     "available" => '(which("git") ne "") && (-d ".git")',
-    "find_signers_cmd" => "git log --since=\$email_git_since -- \$file",
+    "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file",
     "find_commit_signers_cmd" => "git log -1 \$commit",
     "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
     "blame_file_cmd" => "git blame -l \$file",
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Richard Kennedy

When git has been set to always use color in .gitconfig then I get the warning message

Bad divisor in main::vcs_assign: 0

This is caused by vcs_file_signoffs not matching any commits due to the pattern not understand the colour codes. Fix this by telling git log to never use colour.

Thanks.

maintainer
#2 lore raw
In reply to Richard Kennedy

scripts/get_maintainer.pl my %VCS_cmds; · line 80

Quoted 13 lines · Richard Kennedy
scripts/get_maintainer.pl +1 -1
index 090f248..2cae27a 100755
@@ -74,7 +74,7 @@ my %VCS_cmds;
 my %VCS_cmds_git = (
     "execute_cmd" => \&git_execute_cmd,
     "available" => '(which("git") ne "") && (-d ".git")',
-    "find_signers_cmd" => "git log --since=\$email_git_since -- \$file",
+    "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file",
     "find_commit_signers_cmd" => "git log -1 \$commit",
     "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
     "blame_file_cmd" => "git blame -l \$file",

Actually, I take back my ack.

The line immediately below your change also needs --no-color

Can you make that change and resubmit please?

cheers, Joe

#3 lore raw

Re: [PATCH] get_maintainer.pl: teach git log to use --no-color -- UPDATED

When git has been set to always use color in .gitconfig then I get the warning message

Bad divisor in main::vcs_assign: 0

This is caused by vcs_file_signoffs not matching any commits due to the pattern not understand the colour codes. Fix this by telling git log to never use colour.

Updated to fix both calls to 'git log' as requested by Joe Perches <[email protected]>

----
patch against 2.6.33-rc5
git --version 1.6.6

Hi Joe,
will this do?

regards
Richard

scripts/get_maintainer.pl +2 -2
index 090f248..2f3230d 100755
@@ -74,8 +74,8 @@ my %VCS_cmds;
 my %VCS_cmds_git = (
     "execute_cmd" => \&git_execute_cmd,
     "available" => '(which("git") ne "") && (-d ".git")',
-    "find_signers_cmd" => "git log --since=\$email_git_since -- \$file",
-    "find_commit_signers_cmd" => "git log -1 \$commit",
+    "find_signers_cmd" => "git log --no-color --since=\$email_git_since -- \$file",
+    "find_commit_signers_cmd" => "git log --no-color -1 \$commit",
     "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file",
     "blame_file_cmd" => "git blame -l \$file",
     "commit_pattern" => "^commit [0-9a-f]{40,40}",