summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2020-12-21 19:32:52 +0100
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2021-05-18 11:01:42 +0000
commit0f486a3f84c861e5d53a84aba17e75c63f3d83bc (patch)
tree2783bf6ac83cf7537a95bf188e7ec7af6b318378 /bin
parentdd72a087cbea9cf07f7d134f600d45562f58a8fe (diff)
downloadqtrepotools-0f486a3f84c861e5d53a84aba17e75c63f3d83bc.tar.gz
gpush: restructure loop to avoid copying data
Change-Id: I74aec34e93c1077e81e5d28b7aa21e5c73a96d1e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'bin')
-rw-r--r--bin/git_gpush.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/git_gpush.pm b/bin/git_gpush.pm
index 562c22c..e97b7c7 100644
--- a/bin/git_gpush.pm
+++ b/bin/git_gpush.pm
@@ -1134,9 +1134,11 @@ sub visit_commits_raw($$;$)
my $log = open_process(USE_STDIN | USE_STDOUT | FWD_STDERR,
'git', 'log', _GIT_LOG_ARGS, @$args, '--stdin');
write_process($log, map { "$_\n" } @$tips);
- my @author = (undef, undef, undef);
- my @committer = (undef, undef, undef);
- while (read_fields($log, my ($id, $parents, $tree, $message), @author, @committer)) {
+ while (1) {
+ my @author = (undef, undef, undef);
+ my @committer = (undef, undef, undef);
+ last if (!read_fields($log, my ($id, $parents, $tree, $message), @author, @committer));
+
# We truncate the subject anyway, so using just the first line is OK.
$message =~ /^(.*)$/m;
my $subject = $1;
@@ -1160,8 +1162,8 @@ sub visit_commits_raw($$;$)
subject => $subject,
message => $message,
tree => $tree,
- author => [ @author ], # Force copy, as these are ...
- committer => [ @committer ] # ... not loop-local.
+ author => \@author,
+ committer => \@committer
};
}
close_process($log);