Neil Horman <nhorman@xxxxxxxxxxxxx> writes: > Add a command line switch to git-rebase to allow a user the ability to specify > that they want to keep any commits in a series that are empty. > > When git-rebase's type is am, then this option will automatically keep any > commit that has a tree object identical to its parent. > > This patch changes the default behavior of interactive rebases as well. With > this patch, git-rebase -i will produce a revision set passed to > git-revision-editor, in which empty commits are commented out. Empty commits > may be kept manually by uncommenting them. If the new --keep-empty option is > used in an interactive rebase the empty commits will automatically all be > uncommented in the editor. > > Signed-off-by: Neil Horman <nhorman@xxxxxxxxxxxxx> > --- The earlier one in the series seem to be getting solid enough. Nice. > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh > index 5812222..cef290b 100644 > --- a/git-rebase--interactive.sh > +++ b/git-rebase--interactive.sh > @@ -167,6 +167,12 @@ has_action () { > sane_grep '^[^#]' "$1" >/dev/null > } > > +is_empty_commit() { > + tree=$(git rev-parse "$1"^{tree}) > + ptree=$(git rev-parse "$1"^^{tree}) > + return $(test "$tree" = "$ptree") > +} Could "$1" ever be a root commit without a parent? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html