git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/8] cogito: "cg-object-id -p" should separate its output by newlines
@ 2005-09-20  2:14 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-09-20  2:14 UTC (permalink / raw)
  To: git

"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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-20  2:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-20  2:14 [PATCH 3/8] cogito: "cg-object-id -p" should separate its output by newlines Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).