On Thu, Apr 19, 2012 at 12:05:56PM -0700, Junio C Hamano wrote: > Junio C Hamano <jch@xxxxxxxxxx> writes: > > > Thomas Rast <trast@xxxxxxxxxxxxxxx> writes: > > > >> Either way, it should simply be spelled as > >> > >> is_empty_commit() { > >> tree=$(git rev-parse "$1"^{tree}) > >> ptree=$(git rev-parse "$1"^^{tree}) > >> test "$tree" = "$ptree" > >> } > > > > Thanks; will squash in something like this: > > ... > > Ehh, not like that. But something like this, as we need to be able to > pick "root" (t3412 insists on it). > > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh > index 82042b1..de71543 100644 > --- a/git-rebase--interactive.sh > +++ b/git-rebase--interactive.sh > @@ -168,9 +168,11 @@ has_action () { > } > > is_empty_commit() { > - tree=$(git rev-parse "$1"^{tree}) > - ptree=$(git rev-parse "$1"^^{tree}) > - return $(test "$tree" = "$ptree") > + tree=$(git rev-parse "$1"^{tree} 2>/dev/null) || > + die "$1: not a commit that can be picked" > + ptree=$(git rev-parse "$1"^^{tree} 2>/dev/null) || > + ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904 > + test "$tree" = "$ptree" > } > > # Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and > What about this? is_empty_commit() { tree=$(git rev-parse -q --verify "$1"^{tree}) ptree=$(git rev-parse -q --verify "$1"^^{tree}) # Note that if either rev-parse commands fail, the output # of that command will be an empty string. If that happens # We should just return 0, to indicate the commit is non-empty # and let the rest of the git rebase logic handle it. if test -z "$tree" -o -z "$ptree" then return 0 fi return test "$tree" = "$ptree" } -- 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