summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-17 11:57:15 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2013-08-17 11:57:15 +0100
commit5b98b2392fc8aaef1dad7225df857d1a01a1322a (patch)
tree70e63645a6b8e0c9e39080ca47325603e75fd717 /dgit
parentcdbc62887df2d6bb73f684192406812dcafac25d (diff)
improvements to cmdoutput handling, chomping, etc.
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit8
1 files changed, 4 insertions, 4 deletions
diff --git a/dgit b/dgit
index b079562..279d92d 100755
--- a/dgit
+++ b/dgit
@@ -111,8 +111,10 @@ sub cmdoutput_errok {
$!=0; $?=0;
{ local $/ = undef; $d = <P>; }
die if P->error;
- close P or return undef;
+ if (!close P) { print DEBUG "=>!$?\n" if $debug>0; return undef; }
chomp $d;
+ $d =~ m/^.*/;
+ print DEBUG "=> \`$&'",(length $' ? '...' : ''),"\n" if $debug>0; #';
return $d;
}
@@ -153,7 +155,6 @@ sub cfg {
$v = cmdoutput_errok(@git, qw(config --), $c);
};
if ($?==0) {
- chomp $v;
return $v;
} elsif ($?!=256) {
die "$c $?";
@@ -319,7 +320,7 @@ sub mktree_in_ud_from_only_subdir () {
symlink '../../../../objects','.git/objects' or die $!;
runcmd @git, qw(add -Af);
my $tree = cmdoutput @git, qw(write-tree);
- chomp $tree; $tree =~ m/^\w+$/ or die "$tree ?";
+ $tree =~ m/^\w+$/ or die "$tree ?";
return ($tree,$dir);
}
@@ -599,7 +600,6 @@ sub cmd_clone {
sub branchsuite () {
my $branch = cmdoutput_errok @git, qw(symbolic-ref HEAD);
- chomp $branch;
if ($branch =~ m#$lbranch_re#o) {
return $1;
} else {