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

Re: current repository hash

From
ACAlf Clement <alf.clement@gmail.com>
Date
Jun 16, 2008, 18:30 UTC
Message-ID
<556d90580806161130g62269318i46f00e5c7f79b7d9@mail.gmail.com>
In-Reply-To
<8aa486160806160515p751b2af4j2b0db6db7a9ad482@mail.gmail.com>
Hi all,
thanks for the tips.

When I run describe I get an error: $ git describe --debug HEAD fatal: cannot describe '792815de6e3c2403f1e2ed5f2264ca88a0ae7000'

Any hints why? I have a tag v1.3 attached to HEAD and all commited.

CU, Alf

On Mon, Jun 16, 2008 at 2:15 PM, Santi Béjar <sbejar@gmail.com> wrote:
Show 31 quoted lines
> On Mon, Jun 16, 2008 at 13:51, Alf Clement <alf.clement@gmail.com> wrote:
>> Hi all,
>>
>> I want to compile the current repository hash id into my program, to
>> be able to checkout later this
>> id an see the exact files for the compile. It should flag if there are
>> currently modified files in the
>> directory tree.
>
> You can look at how git does it:
>
> http://git.kernel.org/?p=git/git.git;a=blob;f=GIT-VERSION-GEN;hb=HEAD
>
>>
>> What would be the best command to get a unique identifier?
>
> "git rev-parse HEAD" for a unique identifier,
> but "git describe" is more convenient/useful.
>
>> Do I need the 40 digit hash id?
>
> Normally 7 or 8 are sufficient.
>
>> How can I make sure that a shorter hash id will be unique?
>
> You can't. Even the 40 digit hash is "only" cryptographically unique.
> But within a project 7 or 8 digits are unique enough for practical
> use.
>
> Santi
>
Previous: Santi BéjarNext: Jeff King
Message 4 of 9 in “current repository hash”
  1. Alf ClementJun 16, 2008
  2. David TweedJun 16, 2008
  3. Santi BéjarJun 16, 2008
  4. Alf ClementJun 16, 2008
  5. Jeff KingJun 16, 2008
  6. Alf ClementJun 17, 2008
  7. Johan HerlandJun 17, 2008
  8. Jeff KingJun 16, 2008
  9. Johannes SchindelinJun 17, 2008

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.