archimport: use safe_pipe_capture for user input

Refnames can contain shell metacharacters which need to be passed verbatim to sub-processes. Using safe_pipe_capture skips the shell entirely. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Sep 11, 2017 at 10:24 UTC 8d0fad0a7a6ba34fd706c148fa7ed1f8eb2b8b26
1 file changed +2 -2
git-archimport.perl
+2 -2
@@ -983,7 +983,7 @@ sub find_parents {
983 # check that we actually know about the branch
984 next unless -e "$git_dir/refs/heads/$branch";
985
986 - my $mergebase = `git-merge-base $branch $ps->{branch}`;
986 + my $mergebase = safe_pipe_capture(qw(git-merge-base), $branch, $ps->{branch});
987 if ($?) {
988 # Don't die here, Arch supports one-way cherry-picking
989 # between branches with no common base (or any relationship
@@ -1074,7 +1074,7 @@ sub find_parents {
1074
1075 sub git_rev_parse {
1076 my $name = shift;
1077 - my $val = `git-rev-parse $name`;
1077 + my $val = safe_pipe_capture(qw(git-rev-parse), $name);
1078 die "Error: git-rev-parse $name" if $?;
1079 chomp $val;
1080 return $val;