371
372
# usage: $out = run_git_quoted(["command", "args", ...]);
373
# $out = run_git_quoted(["command", "args", ...], "raw"); # don't interpret output as UTF-8.
374
-# $out = run_git_unquoted(["command args"); # don't quote arguments
375
-# $out = run_git_unquoted(["command args", "raw"); # ditto but raw instead of UTF-8 as above
374
+# $out = run_git_quoted_nostderr(["command", "args", ...]); # discard stderr
375
+# $out = run_git_quoted_nostderr(["command", "args", ...], "raw"); # ditto but raw instead of UTF-8 as above
376
sub _run_git {
377
my $args = shift;
378
my $encoding = (shift || 'encoding(UTF-8)');
391
_run_git(["git", @{$_[0]}], $_[1]);
392
}
393
394
-sub run_git_unquoted {
395
- _run_git(["git $_[0]"], $_[1]);
394
+sub run_git_quoted_nostderr {
395
+ _run_git(['sh', '-c', 'git "$@" 2>/dev/null', '--', @{$_[0]}], $_[1]);
396
}
397
398
sub get_all_mediafiles {
521
522
sub get_last_local_revision {
523
# Get note regarding last mediawiki revision.
524
- #
525
- # It's OK to use run_git_unquoted() here because $remotename is
526
- # supplied by the local git itself.
527
- my $note = run_git_unquoted("notes --ref=${remotename}/mediawiki show refs/mediawiki/${remotename}/master 2>/dev/null");
524
+ my $note = run_git_quoted_nostderr(["notes", "--ref=${remotename}/mediawiki",
525
+ "show", "refs/mediawiki/${remotename}/master"]);
526
my @note_info = split(/ /, $note);
527
528
my $lastrevision_number;
1187
my $mw_revision = $last_remote_revid;
1188
1189
# Get sha1 of commit pointed by local HEAD
1192
- #
1193
- # It's OK to use run_git_unquoted() because $local is supplied
1194
- # by the local git itself.
1195
- my $HEAD_sha1 = run_git_unquoted("rev-parse ${local} 2>/dev/null");
1190
+ my $HEAD_sha1 = run_git_quoted_nostderr(["rev-parse", $local]);
1191
chomp($HEAD_sha1);
1192
# Get sha1 of commit pointed by remotes/$remotename/master
1198
- #
1199
- # It's OK to use run_git_unquoted() here because $remotename is
1200
- # supplied by the local git itself.
1201
- my $remoteorigin_sha1 = run_git_unquoted("rev-parse refs/remotes/${remotename}/master 2>/dev/null");
1193
+ my $remoteorigin_sha1 = run_git_quoted_nostderr(["rev-parse", "refs/remotes/${remotename}/master"]);
1194
chomp($remoteorigin_sha1);
1195
1196
if ($last_local_revid > 0 &&