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>