aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-01-23 13:48:32 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-05-18 23:24:34 +0300
commit6961c7164ca6cfdc3bbc138bd9152cb8992b5986 (patch)
tree342bd4bd78920f28f7767a3871cd0ce80062d24d
parent1a23b6e073d663b35d5abed2c0331f9825785240 (diff)
downloadgit-6961c7164ca6cfdc3bbc138bd9152cb8992b5986.tar.gz
git-am: new option to allow empty commits
Good for adding comments to existing ones. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rwxr-xr-xgit-am.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/git-am.sh b/git-am.sh
index 16fb337abb..5702a1e0da 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -40,6 +40,7 @@ committer-date-is-author-date lie about committer date
ignore-date use current timestamp for author date
rerere-autoupdate update the index with reused conflict resolution if possible
S,gpg-sign? GPG-sign commits
+e,allow-empty allow empty commit
rebasing* (internal use for git-rebase)"
. git-sh-setup
@@ -376,6 +377,7 @@ resolvemsg= resume= scissors= no_inbody_headers=
git_apply_opt=
committer_date_is_author_date=
ignore_date=
+allow_empty=
allow_rerere_autoupdate=
gpg_sign_opt=
SIGNOFF=
@@ -423,7 +425,7 @@ it will be removed. Please do not use it anymore."
-a|--ack)
shift
ack=$1
- acks=`git config --get-all am.ack-$ack`
+ acks=$(git config --get-all am.ack-$ack)
if test "acks"
then
if test "$SIGNOFF"
@@ -447,6 +449,8 @@ it will be removed. Please do not use it anymore."
ignore_date=t ;;
--rerere-autoupdate|--no-rerere-autoupdate)
allow_rerere_autoupdate="$1" ;;
+ -e|--allow-empty)
+ allow_empty=t ;;
-q|--quiet)
GIT_QUIET=t ;;
--keep-cr)
@@ -718,10 +722,11 @@ do
<"$dotest"/info >/dev/null &&
go_next && continue
- test -s "$dotest/patch" || {
+ test -s "$dotest/patch" || test "$allow_empty" = t || {
eval_gettextln "Patch is empty. Was it split wrong?
If you would prefer to skip this patch, instead run \"\$cmdline --skip\".
-To restore the original branch and stop patching run \"\$cmdline --abort\"."
+To restore the original branch and stop patching run \"\$cmdline --abort\".
+To allow empty patches use \"\$cmdline --allow-empty\"."
stop_here $this
}
rm -f "$dotest/original-commit" "$dotest/author-script"