Skip to content

Commit

Permalink
Merge branch 'ph/rebase-preserve-all-merges' into maint
Browse files Browse the repository at this point in the history
"git rebase --preserve-merges" lost empty merges in recent versions
of Git.

* ph/rebase-preserve-all-merges:
  rebase --preserve-merges: keep all merge commits including empty ones
  • Loading branch information
gitster committed Jan 29, 2013
2 parents 33b29fd + 9869778 commit da2987d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ is_empty_commit() {
test "$tree" = "$ptree"
}

is_merge_commit()
{
git rev-parse --verify --quiet "$1"^2 >/dev/null 2>&1
}

# Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
# GIT_AUTHOR_DATE exported from the current environment.
do_with_author () {
Expand Down Expand Up @@ -874,7 +879,7 @@ git rev-list $merges_option --pretty=oneline --abbrev-commit \
while read -r shortsha1 rest
do

if test -z "$keep_empty" && is_empty_commit $shortsha1
if test -z "$keep_empty" && is_empty_commit $shortsha1 && ! is_merge_commit $shortsha1
then
comment_out="# "
else
Expand Down

0 comments on commit da2987d

Please sign in to comment.