File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -974,6 +974,16 @@ sub seed_camelcase_includes {
974
974
}
975
975
}
976
976
977
+ sub git_is_single_file {
978
+ my ($filename ) = @_ ;
979
+
980
+ return 0 if ((which(" git" ) eq " " ) || !(-e " $gitroot " ));
981
+
982
+ my $output = ` ${git_command} ls-files -- $filename 2>/dev/null` ;
983
+ my $count = $output =~ tr / \n// ;
984
+ return $count eq 1 && $output =~ m { ^${filename} $} ;
985
+ }
986
+
977
987
sub git_commit_info {
978
988
my ($commit , $id , $desc ) = @_ ;
979
989
@@ -1047,6 +1057,9 @@ sub git_commit_info {
1047
1057
$allow_c99_comments = !defined $ignore_type {" C99_COMMENT_TOLERANCE" };
1048
1058
for my $filename (@ARGV ) {
1049
1059
my $FILE ;
1060
+ my $is_git_file = git_is_single_file($filename );
1061
+ my $oldfile = $file ;
1062
+ $file = 1 if ($is_git_file );
1050
1063
if ($git ) {
1051
1064
open ($FILE , ' -|' , " git format-patch -M --stdout -1 $filename " ) ||
1052
1065
die " $P : $filename : git format-patch failed - $! \n " ;
@@ -1091,6 +1104,7 @@ sub git_commit_info {
1091
1104
@modifierListFile = ();
1092
1105
@typeListFile = ();
1093
1106
build_types();
1107
+ $file = $oldfile if ($is_git_file );
1094
1108
}
1095
1109
1096
1110
if (!$quiet ) {
You can’t perform that action at this time.
0 commit comments