Skip to content

Instantly share code, notes, and snippets.

@Gems
Created April 15, 2022 17:06
Show Gist options
  • Save Gems/b7a2e5df97d54ce24a3c71299186ee9c to your computer and use it in GitHub Desktop.
Save Gems/b7a2e5df97d54ce24a3c71299186ee9c to your computer and use it in GitHub Desktop.
Git gpg that respects $GIT_COMMITTER_DATE
#!/usr/bin/env bash
LOG_FILE=/dev/null
exec > >(tee -a $LOG_FILE >&1)
exec 2> >(tee -a $LOG_FILE >&2)
if [ -n "$GIT_COMMITTER_DATE" ]; then
FST="--faked-system-time $(date -j -f '%Y-%m-%dT%H:%M:%S' $GIT_COMMITTER_DATE +'%s')"
fi
echo $FST "$@" >>$LOG_FILE
gpg $FST "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment