]> mj.ucw.cz Git - git-tools.git/blobdiff - update2
Update2: Remember original stdout
[git-tools.git] / update2
diff --git a/update2 b/update2
index e1cf4ef8d5df9fc510dfa953f4fb869fa3244161..32426c897a1f3dfca1e874db2b7dc880a2ec6e45 100755 (executable)
--- a/update2
+++ b/update2
@@ -38,6 +38,7 @@ my $subj = '[' . $subject_prefix . ($ref eq 'master' ? '' : "/$ref") . ']';
 my $out = File::Temp->new() or die;
 my $outname = $out->filename;
 $out->autoflush(1);
+open ORIG_STDOUT, '>&', \*STDOUT;
 close STDOUT;
 open STDOUT, '>&', $out or die;
 
@@ -105,14 +106,14 @@ if ($old =~ /^0+$/) {
                my $pos_after_header = output_size();
 
                # Show individual commits with diffs and stats
-               system 'git', 'log', @rev_list_options, '--reverse', @diff_options, '-p', '--stat', "$old..$new";
+               system 'git', 'log', @rev_list_options, @diff_options, '-p', '--stat', "$old..$new";
 
                # If the file is too long, truncate it and print just a summary
                if (defined($max_diff_size) && output_size() > $max_diff_size) {
                        $out->truncate($pos_after_header);
                        output_size();
                        print $out "Diff was too long, printing just a summary.\n\n";
-                       system 'git', 'log', @rev_list_options, '--reverse', "$old..$new";
+                       system 'git', 'log', @rev_list_options, "$old..$new";
                }
        } elsif ($lca eq $new) {
                # Rewind
@@ -144,6 +145,7 @@ if (defined $mail_to) {
                '-s', $subj,
                $mail_to;
 } else {
-       print STDERR "Subject: $subj\n\n";
-       `cat >&2 $outname`;
+       open STDOUT, '>&', \*ORIG_STDOUT;
+       print "Subject: $subj\n\n";
+       system 'cat', $outname;
 }