#!/bin/sh -e
# SPDX-License-Identifier: WTFPL
# shellcheck enable=

# like git-commit(1) but fake the commit date to use midnight today
# useful for privacy reasons
# takes the same options as git-commit(1)

# examples:
#
# prompt commit message, commit with fake date:
#   git midnight
#
# commit with fake date with message on command-line:
#   git midnight -m "the commit message"
#
# to edit the date of last commit:
#   git midnight --amend --no-edit --only

d=$(date +%Y.%m.%d)T00:00:00
export GIT_AUTHOR_DATE="$d" GIT_COMMITTER_DATE="$d"
git commit --date "$d" "$@"
