]> mj.ucw.cz Git - git-tools.git/commitdiff
update2: Save original STDIN
authorMartin Mares <mj@ucw.cz>
Fri, 10 Aug 2012 14:59:29 +0000 (16:59 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 10 Aug 2012 14:59:29 +0000 (16:59 +0200)
Otherwise, a change of multiple branches sends only one mail, because
our invocation of mutt replaces STDIN.

update2

diff --git a/update2 b/update2
index 5d30726c8393a17a09ac87aae289469e465ec10e..7d628533510d733fd28b2d31d9b954516cea1f66 100755 (executable)
--- a/update2
+++ b/update2
@@ -36,12 +36,13 @@ my @diff_options = ('-C');
 
 sub update_ref($$$);
 
+open ORIG_STDIN, '<&', \*STDIN;
 open ORIG_STDOUT, '>&', \*STDOUT;
 
 if (@ARGV) {
        update_ref($ARGV[0], $ARGV[1], $ARGV[2]);
 } else {
-       while (<STDIN>) {
+       while (<ORIG_STDIN>) {
                chomp;
                my ($old, $new, $ref) = /^(\S+) (\S+) (.*)/ or die "Error parsing hook input ($_)\n";
                update_ref($ref, $old, $new);