tg-export.sh: make synthesized commits have unique timestamps
commit2123e21e610826fb9240c0199b7430f36b8e7cee
authorKyle J. McKay <mackyle@gmail.com>
Mon, 28 Sep 2015 21:05:20 +0000 (28 14:05 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 28 Sep 2015 21:05:20 +0000 (28 14:05 -0700)
tree8e503babcac19b0ec50047aed97f9aea19f9bb72
parentc8f705b24ad2e5b7c6536210056a6528d6f35abf
tg-export.sh: make synthesized commits have unique timestamps

When creating new synthesized commits for --linearize or
--collapse, make sure they all have unique committer timestamps
that reflect the order in which they were synthesized.

Prior to this change, multiple commits could be synthesized
within the same second getting the same timestamp leading to
a subsequent ordering by git rev-list that depended on the
commit hash.  This creates an undesirable unstable output.

Instead advance the committer timestamp by one second for
each new commit created also force GIT_AUTHOR_DATE to have
the same value if it would otherwise be unset or empty.

And also, while we're in there, avoid exporting GIT_AUTHOR_NAME
and GIT_AUTHOR_EMAIL unless they actually contain something.

If a previous commit caused them to be set and exported, it's not
enough to just set them to the empty string and not export them
again, they have to be explicitly unset to unexport them.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
tg-export.sh