5 # How to refer to the new commit:
10 # We don't want to commit with current time, we want to commit with a time that is a function of the RCS content (actually, max), because this makes this command idempotent.
14 git read-tree
-v "$@" "$parent"
15 parent_opts
+=(-p "$parent")
16 # Keep the max time for the future commit:
17 local newtime
="$(git show "$parent" --pretty=format:'%ct' | head -1)"
18 if (( newtime
> time )); then time="$newtime"; fi
21 # First time, we should save the old index and start reading new stuff into it:
22 printf $
"%s is saving your current index.\n" "$0"
23 readonly SAVED_INDEX
="$(git write-tree)"
25 printf $
"%s is restoring your old index.\n" "$0"
26 git read-tree
-v "$SAVED_INDEX"
28 trap restore_index EXIT
# Yes, it will be executed when exiting after an error as well (checked).
34 for parent
in "$@"; do
35 # Make it think there are no deletions (pass an empty tree as the source):
36 single-read
-m -i "$(git the-empty-tree)"
40 # The commit message is read from stdin.
41 GIT_COMMITTER_DATE
="$time" \
42 GIT_AUTHOR_DATE
="$time" \
43 git commit-tree
"$(git write-tree)" "${parent_opts[@]}" \
44 |
xargs git tag
"$TAG"