Skip to contentSkip to conversation

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

PATCH In review Pavel Roskin 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

"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.

cg-Xnormid +1 -1
@@ -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"
cg-object-id +3 -3
@@ -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% *}
Signature · 2 lines
Regards,
Pavel Roskin