# [PATCH] cg-object-id: comment the alternate id shortcut parsing

4 messages from 2005-12-07 to 2005-12-07. Participants: Jonas Fonseca, Petr Baudis.
Thread: https://gitlist.dev/t/2768

## Jonas Fonseca, 2005-12-07 21:39

Subject: [PATCH] cg-object-id: comment the alternate id shortcut parsing
Message-ID: <20051207213943.GC25890@diku.dk>
URL: https://gitlist.dev/e/20051207213943.GC25890%40diku.dk

```
Add comment about why Cogito's own 4 digit id shortcut parser is needed.

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

---
commit 3c14cded46e110396127fc5b5e65883eb5cd60b9
tree 593da711de14cfc3f8dc1fd5773990902568b42e
parent 36c0d9fae209ab7fa889333e8eebef22e7f0f55c
author Jonas Fonseca <fonseca@diku.dk> Wed, 07 Dec 2005 08:17:04 +0100
committer Jonas Fonseca <fonseca@antimatter.localdomain> Wed, 07 Dec 2005 08:17:04 +0100

 cg-object-id |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/cg-object-id b/cg-object-id
index 56d9f91..ea04dca 100755
--- a/cg-object-id
+++ b/cg-object-id
@@ -52,7 +52,9 @@ normalize_id()
 		id="$revid"
 		valid=1
 
-	# Short id's must be lower case and at least 4 digits.
+	# Short id's must be lower case and at least 4 digits. git-rev-parse(1)
+	# allows only down to 5 digits and we want to show the list of matched
+	# ids.
 	elif [[ "$id" == [0-9a-f][0-9a-f][0-9a-f][0-9a-f]* ]]; then
 		idpref=${id:0:2}
 		idpost=${id:2}

-- 
Jonas Fonseca

```

## Petr Baudis, 2005-12-07 22:05

Subject: Re: [PATCH] cg-object-id: comment the alternate id shortcut parsing
Message-ID: <20051207220521.GM22159@pasky.or.cz>
URL: https://gitlist.dev/e/20051207220521.GM22159%40pasky.or.cz
In-Reply-To: <20051207213943.GC25890@diku.dk>

```
Dear diary, on Wed, Dec 07, 2005 at 10:39:43PM CET, I got a letter
where Jonas Fonseca <fonseca@diku.dk> said that...
> -	# Short id's must be lower case and at least 4 digits.
> +	# Short id's must be lower case and at least 4 digits. git-rev-parse(1)
> +	# allows only down to 5 digits and we want to show the list of matched
> +	# ids.

Huh. The code in sha1_name.c speaks differently and it works as well:

	$ git-rev-parse b1fc
	b1fcca45069d4f6b00a9ac7136be4268d09fd6b9

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

```

## Jonas Fonseca, 2005-12-07 22:14

Subject: Re: [PATCH] cg-object-id: comment the alternate id shortcut parsing
Message-ID: <20051207221449.GA27619@diku.dk>
URL: https://gitlist.dev/e/20051207221449.GA27619%40diku.dk
In-Reply-To: <20051207220521.GM22159@pasky.or.cz>

```
Petr Baudis <pasky@suse.cz> wrote Wed, Dec 07, 2005:
> Dear diary, on Wed, Dec 07, 2005 at 10:39:43PM CET, I got a letter
> where Jonas Fonseca <fonseca@diku.dk> said that...
> > -	# Short id's must be lower case and at least 4 digits.
> > +	# Short id's must be lower case and at least 4 digits. git-rev-parse(1)
> > +	# allows only down to 5 digits and we want to show the list of matched
> > +	# ids.
> 
> Huh. The code in sha1_name.c speaks differently and it works as well:
> 
> 	$ git-rev-parse b1fc
> 	b1fcca45069d4f6b00a9ac7136be4268d09fd6b9

I had this one testcase:

	~/src/elinks/0.11 > cg-object-id --verify e6b6
	cg-object-id: unrecognized option `--verify'
	~/src/elinks/0.11 > cg-object-id e6b6
	e6b65b543108bfeb95ea24978112b46e34cfde87

Could it have something to do with the local packing?

-- 
Jonas Fonseca

```

## Jonas Fonseca, 2005-12-07 22:19

Subject: Re: [PATCH] cg-object-id: comment the alternate id shortcut parsing
Message-ID: <20051207221945.GB27619@diku.dk>
URL: https://gitlist.dev/e/20051207221945.GB27619%40diku.dk
In-Reply-To: <20051207221449.GA27619@diku.dk>

```
Jonas Fonseca <fonseca@diku.dk> wrote Wed, Dec 07, 2005:
> Petr Baudis <pasky@suse.cz> wrote Wed, Dec 07, 2005:
> > Dear diary, on Wed, Dec 07, 2005 at 10:39:43PM CET, I got a letter
> > where Jonas Fonseca <fonseca@diku.dk> said that...
> > > -	# Short id's must be lower case and at least 4 digits.
> > > +	# Short id's must be lower case and at least 4 digits. git-rev-parse(1)
> > > +	# allows only down to 5 digits and we want to show the list of matched
> > > +	# ids.
> > 
> > Huh. The code in sha1_name.c speaks differently and it works as well:
> > 
> > 	$ git-rev-parse b1fc
> > 	b1fcca45069d4f6b00a9ac7136be4268d09fd6b9
> 
> I had this one testcase:
> 
	~/src/elinks/0.11 > git-rev-parse --verify e6b6
	error: short SHA1 e6b6 is ambiguous.
	fatal: Needed a single revision
> 	~/src/elinks/0.11 > cg-object-id e6b6
> 	e6b65b543108bfeb95ea24978112b46e34cfde87
> 
> Could it have something to do with the local packing?

-- 
Jonas Fonseca

```
