From: Ian Jackson Date: Sun, 5 Feb 2017 14:41:43 +0000 (+0000) Subject: dgit: Do not fail when run with detached HEAD. Closes:#853022. X-Git-Tag: archive/debian/3.10~7 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=17cbb0b93e661fa2f163b155fd4505b0e4b70647;hp=e12f9af0e827a5b953f294a4cc0c7fcab7c21603 dgit: Do not fail when run with detached HEAD. Closes:#853022. Specifically: * Pass -q to git-symbolic-ref. That means that it doesn't print an error message when HEAD is not a symbolic ref (ie, a detached head), and it means that the exit status is then 1 rather than 128. * If the return value from cmdoutput_errok is undef, check $? (which is the exit status <<8) and then simply pass on the undef. Signed-off-by: Ian Jackson --- diff --git a/debian/changelog b/debian/changelog index 68fb46e0..a63f27db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ dgit (3.10~) unstable; urgency=medium to dgit private workarea. Closes:#853085. * dgit: Strip initial newline from Changes line from dpkg-parsechangelog so as to avoid blank line in commit messages. Closes:#853093. + * dgit: Do not fail when run with detached HEAD. Closes:#853022. Test suite: * quilt-useremail: New test for user config copying (#853085). diff --git a/dgit b/dgit index f1f9332a..724dba10 100755 --- a/dgit +++ b/dgit @@ -4435,8 +4435,12 @@ sub cmd_clone { } sub branchsuite () { - my @cmd = (@git, qw(symbolic-ref HEAD)); + my @cmd = (@git, qw(symbolic-ref -q HEAD)); my $branch = cmdoutput_errok @cmd; + if (!defined $branch) { + $?==256 or failedcmd @cmd; + return undef; + } if ($branch =~ m#$lbranch_re#o) { return $1; } else {