Thread (71 messages) flat view 71 messages, 8 authors, 2016-06-15
STALE3727d

Revision v1 of 7 in this series.

Revisions (7)
  1. v1 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]
  4. v5 [diff vs current]
  5. v6 [diff vs current]
  6. v7 [diff vs current]
  7. v8 [diff vs current]

[PATCH 3/4] git-commit-am: Allow automatic rebasing to preserve empty commits

From: Neil Horman <nhorman@tuxdriver.com>
Date: 2016-06-15 22:53:26
Subsystem: the rest · Maintainer: Linus Torvalds

Using the keep_empy environment variable, this change allows git-commit-am to
apply empty commits to the new branch we are rebasing to

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Jeff King <redacted>
CC: Phil Hord <redacted>
CC: Junio C Hamano <redacted>
---
 git-rebase--am.sh |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index c815a24..c1d1b60 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -20,11 +20,21 @@ esac
 
 test -n "$rebase_root" && root_flag=--root
 
-git format-patch -k --stdout --full-index --ignore-if-in-upstream \
-	--src-prefix=a/ --dst-prefix=b/ \
-	--no-renames $root_flag "$revisions" |
-git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
-move_to_original_branch
+if [ -n "$keep_empty" ]
+then
+	# we have to do this the hard way.  git format-patch completly squashes
+	# empty commits and even if it didn't the format doesn't really lend
+	# itself well to recording empty patches.  fortunately, cherry-pick
+	# makes this easy
+	git cherry-pick --keep-empty "$revisions" && move_to_original_branch
+else
+	git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+		--src-prefix=a/ --dst-prefix=b/ \
+		--no-renames $root_flag "$revisions" |
+	git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
+	move_to_original_branch
+fi
+
 ret=$?
 test 0 != $ret -a -d "$state_dir" && write_basic_state
 exit $ret
-- 
1.7.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help