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

Re: ident hash usage question

From
ESEugene Sajine <euguess@gmail.com>
Date
Oct 20, 2009, 22:14 UTC
Message-ID
<76c5b8580910201514sc44f1cag222cf8a3710c875@mail.gmail.com>
In-Reply-To
<7veioxn6ee.fsf@alter.siamese.dyndns.org>
Show 13 quoted lines
> If the project is already arranged to be compiled with decent automation,
> I do not think you need any change to the workflow.
>
> You would have a version.cc file with
>
>        static char program_version[] = "My Program " VERSION_STRING;
>
> in it, and teach the build procedure how to compile and link this file.
> Something like:
>
>    version.o: version.cc
>        $(CXX) -o $@ -DVERSION_STRING=\""$(git describe HEAD)"\" $?
>

Please, correct me if I'm mistaken and forgive me if I'm not correct in using C++ terms.

Your solution proposes to have a version file which will carry the info about last state the program was built from. But as I understand in case of static linking the executable will get only obj files from a library, which are necessary and everything irrelevant will be thrown away by linker. In this circumstances the program comparing two executable will not notice any differences between let's say existing production and new development version of the executable. In case of several libraries linked this gets even worse. That's what their basis is for keywords expansion use.

If there is no other solution in VCS terms how to understand which particular version of file has got linked to the executable except keywords expansion, then I'm talking about the way of reducing the amount of keywords expanded to a minimum - 1.

If we can agree on this, then it seems that having the content/blob hash in the file $Id$ is enough to get any other relevant info about the file.

At least by hash you can find the path added/modified. When the path is on hands you can easily realize the history for the file. It seems to me that using content hash will provide unique results enough to make conclusions, because the probability of having two files with same hash but different content is too low, and only scenario is to get the same hash is to get the absolute copy of the file, but such file existence is questionable...

OTOH, Alex was right that there are situation where this is not working as expected from the first run: If the file was modified its blob hash is going to change, but there will be no entry with letter A in the log. So, if

$ git log --no-abbrev --raw --all | grep "SHA-1 A"

Returns empty string then, we should do that without "A". As I understand this *second* run should always return:

1. only one entry if this is latest hash - one path. Goal reached.
2. two entries if there was a change afterwards - One path. Goal reached
3. three entries if rename was committed separately and then renamed
file was changed - two paths. Enough to make conclusion about the
files.

In any case the goal is to get the path as correct as possible and then proceed with matching and other stuff.

Thanks, Eugene

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 18 in “ident hash usage question”
  1. Eugene SajineOct 20, 2009
  2. Alex RiesenOct 20, 2009
  3. Alex RiesenOct 20, 2009
  4. Eugene SajineOct 20, 2009
  5. Alex RiesenOct 20, 2009
  6. Johannes SixtOct 20, 2009
  7. Alex RiesenOct 20, 2009
  8. Eugene SajineOct 20, 2009
  9. Junio C HamanoOct 20, 2009
  10. Eugene SajineOct 20, 2009
  11. Junio C HamanoOct 20, 2009
  12. Eugene SajineOct 20, 2009
  13. Daniel BarkalowOct 21, 2009
  14. Nanako ShiraishiOct 21, 2009
  15. Alex RiesenOct 20, 2009
  16. Eugene SajineOct 20, 2009
  17. Alex RiesenOct 21, 2009
  18. Eugene SajineOct 21, 2009

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.