Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v7 4/4] git-rebase: add keep_empty flag

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:38
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Thomas Rast [off-list ref] 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:
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 82042b1..8fe304f 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -168,9 +168,10 @@ 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) &&
+	ptree=$(git rev-parse "$1"^^{tree} 2>/dev/null) ||
+		die "$1: not a commit that can be picked"
+	test "$tree" = "$ptree"
 }
 
 # Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help