All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH Cogito] Make cg-Xnormid use $_git and $_git_objects
Date: Sun, 29 May 2005 03:00:57 +0200	[thread overview]
Message-ID: <20050529010057.GA7520@diku.dk> (raw)

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

                 reply	other threads:[~2005-05-29  0:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050529010057.GA7520@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.