threads / patch / 1875

patch, 8 partscogito: Simplify recursion in cg-object-id.

Subject: [PATCH 5/8] cogito: Simplify recursion in cg-object-id.

## tl;dr

One message between Sep 20, 2005 and Sep 20, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Pavel Roskin· Sep 20, 2005, 02:21 UTC · lore
Simplify recursion in cg-object-id.

It's not needed to call the whole cg-object-id script from itself. It's sufficient to call normalize_id() from itself.

Show changes to cg-object-id +2 −2
diff --git a/cg-object-id b/cg-object-id
--- a/cg-object-id
+++ b/cg-object-id
@@ -32,12 +32,12 @@ normalize_id()
 {
 	local id="$1"
 
 	if [ "${id:(-1):1}" = "^" ]; then
 		# find first parent
-		id=$(cg-object-id "${id%^}") || exit 1
-		normid=$(git-cat-file commit "$id" | \
+		normalize_id "${id%^}"
+		normid=$(git-cat-file commit "$normid" | \
 			 awk '/^parent/{print $2; exit};/^$/{exit}') || exit 1
 		type="commit"
 		return
 	fi
 
-- 
Regards,
Pavel Roskin

← back to recent threads