chiark / gitweb /
dgit: absurd: Work around mangled env metadata from gbp
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Feb 2020 21:12:25 +0000 (21:12 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 Feb 2020 16:31:51 +0000 (16:31 +0000)
commitccebebe13a570e7432416817f09306e068928e96
treed1cba9c5e498ced89d2de80523d53e25ae73a2f3
parent0bbccf3893a0c5a2ce38bb0d9c5ce3e975ae1775
dgit: absurd: Work around mangled env metadata from gbp

Some versions of gbp pq will pass broken metadata from patch files
into the env vars for git-commit-tree.  Eg, #950446/#950326 where gbp
pq from buster cannot cope with binutils_2.33.90.20200122-2.dsc,
setting GIT_AUTHOR_DATE to "???" (literally, three ? marks, as copied
from the patch file libctf-soname.diff).

Work around this as follows:
 * Try git-commit-tree of an empty commit message.  Does it work?
   If so, workaround is not needed.
 * Try resetting GIT_AUTHOR_* to GIT_COMMITTER_*.  Does it work now?
   Ah, that is the fix!
 * Otherwise, just run git-commit-tree as usual.

This code makes some perhaps-unreasonable assumptions:
 * gbp's git commit-tree has the tree object as 2nd argument
   (really shonky command line parsing).  However, if this
   assumption is violated, the result is that the git-commit-tree
   attempts either fail harmlessly, or succeed harmlessly, defeating
   the workaround but with no other implications.
 * if a workaround is needed, it is best to throw away all the
   author information, rather that try to pick and choose, or to
   fix it up.
These are IMO tolerable because I think it's gbp's job to get this
right.  The output from dgit (if it succeeds) will be right in terms
of tree and even in terms of commit structure.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
absurd/git