git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH Cogito] Make cg-Xnormid use $_git and $_git_objects

From
Jonas Fonseca <fonseca@diku.dk>
Date
May 29, 2005, 01:00 UTC
Message-ID
<20050529010057.GA7520@diku.dk>

The recently introduced cg-Xnormid accesses .git and .git/objects directly which is not consistent with the current behavior so source cg-Xlib to get access to the $_git and $_git_objects variables.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---

BTW, both commit-id and tree-id needs to be patched to find the installed cg-Xnormid.

	-normid=$(cg-Xnormid "$id") || exit 1
	+normid=$(${COGITO_LIB}cg-Xnormid "$id") || exit 1
 
--- c8e987e5e4608c1144293cd3f852210d70b572cb/cg-Xnormid  (mode:100755)
+++ uncommitted/cg-Xnormid  (mode:100755)
@@ -13,16 +13,18 @@
 #
 # Takes the ID to normalize and returns the normalized ID.
 
+. ${COGITO_LIB}cg-Xlib
+
 id="$1"
 
 if [ ! "$id" ] || [ "$id" = "this" ] || [ "$id" = "HEAD" ]; then
-	read id < .git/HEAD
+	read id < "$_git/HEAD"
 
-elif [ -r ".git/refs/tags/$id" ]; then
-	read id < ".git/refs/tags/$id"
+elif [ -r "$_git/refs/tags/$id" ]; then
+	read id < "$_git/refs/tags/$id"
 
-elif [ -r ".git/refs/heads/$id" ]; then
-	read id < ".git/refs/heads/$id"
+elif [ -r "$_git/refs/heads/$id" ]; then
+	read id < "$_git/refs/heads/$id"
 
 # Short id's must be lower case and at least 4 digits.
 elif [[ "$id" == [0-9a-z][0-9a-z][0-9a-z][0-9a-z]* ]]; then
@@ -30,10 +32,10 @@
 	idpost=${id:2}
 
 	# Assign array elements to matching names
-	idmatch=(.git/objects/$idpref/$idpost*)
+	idmatch=($_git_objects/$idpref/$idpost*)
 
 	if [ ${#idmatch[*]} -eq 1 ] && [ -r "$idmatch" ]; then
-		id=$idpref${idmatch#.git/objects/$idpref/}
+		id=$idpref${idmatch#$_git_objects/$idpref/}
 	elif [ ${#idmatch[*]} -gt 1 ]; then
 		echo "Ambiguous id: $id" >&2
 		exit 1
@@ -41,7 +43,7 @@
 fi
 
 # If we don't have a 40-char ID by now, it's an error
-if [ ${#id} -ne 40 ] || [ ! -f .git/objects/${id:0:2}/${id:2} ]; then
+if [ ${#id} -ne 40 ] || [ ! -f $_git_objects/${id:0:2}/${id:2} ]; then
 	echo "Invalid id: $id" >&2
 	exit 1
 fi
-- 
Jonas Fonseca
Message 1 of 1 in “Make cg-Xnormid use $_git and $_git_objects”
  1. Make cg-Xnormid use $_git and $_git_objectsJonas Fonseca, May 29, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.