DORMANTno replies

[PATCH 3/8] cogito: "cg-object-id -p" should separate its output by newlines

From: Pavel Roskin <hidden>
Date: 2016-06-15 22:42:06
Subsystem: the rest · Maintainer: Linus Torvalds

"cg-object-id -p" should separate its output by newlines.

If there are several parents, they should be separated by newlines, not
by spaces.  That's what cg-diff expects.
diff --git a/cg-Xnormid b/cg-Xnormid
--- a/cg-Xnormid
+++ b/cg-Xnormid
@@ -17,11 +17,11 @@
 id="$1"
 
 if [ "${id:(-1):1}" = "^" ]; then
 	# find parent
 	id=$(cg-object-id "${id%^}") || exit 1
-	git-cat-file commit "$id" | awk '/^parent/{print $2," "};/^$/{exit}' || exit 1
+	git-cat-file commit "$id" | awk '/^parent/{print $2};/^$/{exit}' || exit 1
 	exit
 fi
 
 if [ ! "$id" ] || [ "$id" = "this" ] || [ "$id" = "HEAD" ]; then
 	read id < "$_git/HEAD"
diff --git a/cg-object-id b/cg-object-id
--- a/cg-object-id
+++ b/cg-object-id
@@ -9,12 +9,12 @@
 #
 # OPTIONS
 # -------
 # -p::
 #	Get ID of parent commit(s) to a given revision or HEAD.
-#	NOTE: Multiple SHA1s will be returned for commits with multiple
-#	parents.
+#	NOTE: Multiple SHA1s separated by newlines will be returned for
+#	commits with multiple parents.
 #
 # -t::
 #	Get ID of tree associated with given commit or HEAD.
 #
 # OBJECT_ID::
@@ -53,11 +53,11 @@ if [ "$show_parent" ]; then
 fi
 
 normid=$(. ${COGITO_LIB}cg-Xnormid "$id") || exit 1
 
 if [ "$show_parent" ]; then
-	echo ${normid% *}
+	echo "${normid% *}"
 	exit 0
 fi
 
 type=${normid#* }
 normid=${normid% *}


-- 
Regards,
Pavel Roskin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help