Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AlDanial/cloc
Browse files Browse the repository at this point in the history
  • Loading branch information
AlDanial committed Jul 14, 2024
2 parents eb48081 + a662823 commit bf0ddd1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,8 @@ if (defined $opt_vcs) {
}
}
if ($opt_vcs eq "git") {
$opt_vcs = "git -c 'safe.directory=*' ls-files";
my @submodules = invoke_generator("git -c 'safe.directory=*' submodule status", \@ARGV);
$opt_vcs = "git -c \"safe.directory=*\" ls-files";
my @submodules = invoke_generator("git -c \"safe.directory=*\" submodule status", \@ARGV);
foreach my $SM (@submodules) {
$SM =~ s/^\s+//; # may have leading space
$SM =~ s/\(\S+\)\s*$//; # may end with something like (heads/master)
Expand Down Expand Up @@ -2470,7 +2470,7 @@ sub exclude_autogenerated_files { # {{{1
} # 1}}}
sub git_root_dir { # {{{1
# if in a git repo, return the repo's top level directory
my $cmd = "git -c 'safe.directory=*' rev-parse --show-toplevel";
my $cmd = "git -c \"safe.directory=*\" rev-parse --show-toplevel";
print $cmd, "\n" if $opt_v > 1;
my $dir = undef;
chomp($dir = `$cmd`);
Expand Down Expand Up @@ -5133,14 +5133,14 @@ sub get_git_metadata { # {{{1
print "-> get_git_metadata($prt_args)\n" if $opt_v > 2;
foreach my $arg (@{$ra_arg_list}) {
next if is_file($arg);
my $origin = `git -c 'safe.directory=*' remote get-url origin 2>&1`;
my $origin = `git -c \"safe.directory=*\" remote get-url origin 2>&1`;
next if $origin =~ /^fatal:/;
chomp($rh_git_metadata->{$arg}{"origin"} = $origin);
chomp($rh_git_metadata->{$arg}{"branch"} = `git -c 'safe.directory=*' symbolic-ref --short HEAD`);
chomp($rh_git_metadata->{$arg}{"branch"} = `git -c \"safe.directory=*\" symbolic-ref --short HEAD`);
if (is_dir($arg)) {
chomp($rh_git_metadata->{$arg}{"commit"} = `git -c 'safe.directory=*' rev-parse HEAD`);
chomp($rh_git_metadata->{$arg}{"commit"} = `git -c \"safe.directory=*\" rev-parse HEAD`);
} else {
chomp($rh_git_metadata->{$arg}{"commit"} = `git -c 'safe.directory=*' rev-parse $arg`);
chomp($rh_git_metadata->{$arg}{"commit"} = `git -c \"safe.directory=*\" rev-parse $arg`);
}
}
print "<- get_git_metadata()\n" if $opt_v > 2;
Expand Down Expand Up @@ -5205,7 +5205,7 @@ sub replace_git_hash_with_tarfile { # {{{1

my %repo_listing = (); # $repo_listing{hash}{files} = 1;
foreach my $hash (sort keys %git_hash) {
my $git_list_cmd = "git -c 'safe.directory=*' ls-tree --name-only -r ";
my $git_list_cmd = "git -c \"safe.directory=*\" ls-tree --name-only -r ";
if ($hash =~ m/(.*?):(.*?)$/) {
# requesting specific file(s) from this hash; grep for them
# Note: this capability not fully implemented yet
Expand Down Expand Up @@ -5243,7 +5243,7 @@ sub replace_git_hash_with_tarfile { # {{{1
if ($opt_git_diff_rel) {
# Strategy 1: Union files are what git consinders have changed
# between the two commits.
my $git_list_cmd = "git -c 'safe.directory=*' diff-tree -r --no-commit-id --name-only $Left $Right";
my $git_list_cmd = "git -c \"safe.directory=*\" diff-tree -r --no-commit-id --name-only $Left $Right";
# print "$git_list_cmd\n" if $opt_v;
foreach my $file (`$git_list_cmd`) {
chomp($file);
Expand Down Expand Up @@ -5388,7 +5388,7 @@ sub git_similarity_index { # {{{
$ra_git_similarity) = @_; # out
die "this option is not yet implemented";
print "-> git_similarity_index($git_hash_Left, $git_hash_Right)\n" if $opt_v > 2;
my $cmd = "git -c 'safe.directory=*' diff -M --name-status $git_hash_Left $git_hash_Right";
my $cmd = "git -c \"safe.directory=*\" diff -M --name-status $git_hash_Left $git_hash_Right";
print $cmd, "\n" if $opt_v;
open(GSIM, "$cmd |") or die "Unable to run $cmd $!";
while (<GSIM>) {
Expand Down Expand Up @@ -5482,7 +5482,7 @@ sub git_archive { # {{{1
} else {
($Tarfh, $Tarfile) = tempfile(UNLINK => 1, SUFFIX => '.tar'); # delete on exit
}
my $cmd = "git -c 'safe.directory=*' archive -o $Tarfile $files_this_commit";
my $cmd = "git -c \"safe.directory=*\" archive -o $Tarfile $files_this_commit";
print $cmd, "\n" if $opt_v;
system $cmd;
if (!can_read($Tarfile) or !get_size($Tarfile)) {
Expand All @@ -5496,7 +5496,7 @@ sub git_archive { # {{{1
foreach my $i (1..$n_sets-1) {
my $fname = sprintf "%s_extra_%08d", $Tarfile, $i;
my $files_this_commit = join(" ", @{$File_Set[$i]});
my $cmd = "git -c 'safe.directory=*' archive -o $fname $files_this_commit";
my $cmd = "git -c \"safe.directory=*\" archive -o $fname $files_this_commit";
print $cmd, "\n" if $opt_v;
system $cmd;
push @tar_files, $fname;
Expand All @@ -5521,7 +5521,7 @@ sub git_archive { # {{{1
} else {
foreach my $i (1..$n_sets-1) {
my $files_this_commit = join(" ", @{$File_Set[$i]});
my $cmd = "git -c 'safe.directory=*' archive -o ${Tarfile}_extra $files_this_commit";
my $cmd = "git -c \"safe.directory=*\" archive -o ${Tarfile}_extra $files_this_commit";
print $cmd, "\n" if $opt_v;
system $cmd;
# and merge into the first one
Expand Down

0 comments on commit bf0ddd1

Please sign in to comment.