Skip to contentSkip to conversation

cogito: Simplify recursion in cg-object-id.

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

lore
Share & tools
lore
#0 lore raw

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

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.

cg-object-id +2 -2
@@ -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
 
Signature · 2 lines
Regards,
Pavel Roskin