Open joshgold22 opened 1 year ago
In my case, I use a hook to prevent my making an empty changeset without realizing it (if I forget to "add" or use "-a"). This stops rewording during a commit --amend or rebase -i, but Fork's commit has the button to allow skipping the hook.
i.e., part of my .git/hooks/pre-commit:
if git diff --cached --name-only $against | grep -q .
then
exit 0
else
echo "EMPTY COMMIT -- Use -a or add patches."
exit 1
fi
I use a hook to prevent me making an empty changeset without realizing it
But git doesn't allow empty commits by default, does it?
$git commit -m "test"
On branch develop
Your branch is up to date with 'origin/develop'.
nothing to commit, working tree clean
Anyway, technical implementation of that is not easy, because we don't know the made the rebase to fail and whether it was caused by a hook or not.
Most likely we will not have a time to implement that.
How is it implemented in Fork for commit, though? I would think Fork could do the same thing in the to cases (regardless of the content of the hook giving the exit status).
Parenthetically — my particular hook may be a distraction here — it works particularly with --amend and -m or -e to update the message. (I'm using --no-verify below to suppress my own pre-commit hooks. Without hooks, you wouldn't need that to change the commit message with no code changes.)
% git commit --amend -m "new message" --no-verify
[3ec6d88e69] new message
Date: Mon Jun 26 16:22:53 2023 -0400
14 files changed, 14 insertions(+), 102 deletions(-)
Other kinds of hooks might, for instance, prevent someone from committing code with tabs instead of spaces or enforce some other team standard.
commit --amend gives a pop-up to suppress pre-commit hooks if they stop the current operation, but when the same hook is triggered during a rebase, it fails in Fork with no way around. Please add a similar dialog to rebase.