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

Re: [PATCH 06/18] version-gen: remove redundant check

From
Todd Zullinger <tmz@pobox.com>
Date
Apr 14, 2023, 19:01 UTC
Message-ID
<ZDmjIqNwVMESgHnn@pobox.com>
In-Reply-To
<643991c58aef_5ecfe29433@chronos.notmuch>
Felipe Contreras wrote:
Show 13 quoted lines
> Todd Zullinger wrote:
>> Felipe Contreras wrote:
>>> If we are not in a git repository `git describe` will fail anyway.
>> 
>> The parent directory may be a git repository though.  The
>> current code ensures that we're running `git describe` in
>> the proper repository.
> 
> How exactly does it do that?
> 
> The current code expects the cwd to be the git repo, run it in any other
> directory and it will generate GIT-VERSION-FILE in that directory, which is
> clearly not intended.

Whether it's fool proof isn't really my point. It did attempt to check that .git was a file or directory. Not checking at all isn't necessarily an improvement, was my concern.

Show 10 quoted lines
>> If we drop this, aren't we breaking things for someone
>> building a git tarball which is in a subdirectory of a git
>> repository?
> 
> How exactly would this hypothetical person build such a tarball?
> 
>   git init /tmp/foo
>   mkdir -p /tmp/foo/bar
>   cd /tmp/foo/bar
>   make -C ~/dev/git dist

If I have a git repo, say ~/fedora/git which contains the fedora packaging (spec file, etc.) and extract a git archive in this directory, the describe will now pick up the data from the parent git directory, won't it?

    $ git -C ~/fedora clone https://src.fedoraproject.org/rpms/git.git
    $ cd ~/fedora/git
    $ git -C ~/upstream/git archive --format=tar --prefix=git/ HEAD | tar xf -
    $ cd git
    $ make GIT-VERSION-GEN
    $ cat GIT-VERSION-FILE 
    GIT_VERSION = 

The version file in the tarballs prevents this from happening in the most common case, but it still feels like this is loosening things a little more than it should.

-- 
Todd
Previous: Felipe ContrerasNext: Felipe Contreras
Message 11 of 24 in “version-gen: complete revamp/rewrite”
  1. 00/18 version-gen: complete revamp/rewriteFelipe Contreras, Apr 14, 2023
  2. 01/18 version-gen: reorganizeFelipe Contreras, Apr 14, 2023
  3. 02/18 version-gen: trivial cleanupFelipe Contreras, Apr 14, 2023
  4. 03/18 version-gen: refactor default versionFelipe Contreras, Apr 14, 2023
  5. 04/18 version-gen: simplify v prefix removalFelipe Contreras, Apr 14, 2023
  6. 05/18 version-gen: simplify update checkFelipe Contreras, Apr 14, 2023
  7. 07/18 version-gen: simplify `git describe` checksFelipe Contreras, Apr 14, 2023
  8. 06/18 version-gen: remove redundant checkFelipe Contreras, Apr 14, 2023
  9. Todd ZullingerApr 14, 2023
  10. Felipe ContrerasApr 14, 2023
  11. Todd ZullingerApr 14, 2023
  12. Felipe ContrerasApr 14, 2023
  13. Todd ZullingerApr 14, 2023
  14. 08/18 version-gen: simplify dirty checkFelipe Contreras, Apr 14, 2023
  15. 09/18 version-gen: move describe fix into functionFelipe Contreras, Apr 14, 2023
  16. 11/18 version-gen: refactor describe functionFelipe Contreras, Apr 14, 2023
  17. 10/18 version-gen: describe and sed in one goFelipe Contreras, Apr 14, 2023
  18. 13/18 version-gen: move v fix into sedFelipe Contreras, Apr 14, 2023
  19. 15/18 version-gen: remove default versionFelipe Contreras, Apr 14, 2023
  20. 12/18 version-gen: do v fix only when necessaryFelipe Contreras, Apr 14, 2023
  21. 14/18 version-gen: refactor main functionalityFelipe Contreras, Apr 14, 2023
  22. 17/18 version-gen: get rid of GVF variableFelipe Contreras, Apr 14, 2023
  23. 16/18 version-gen: refactor GIT_VERSION stringFelipe Contreras, Apr 14, 2023
  24. 18/18 version-gen: generate proper interim versionsFelipe Contreras, Apr 14, 2023

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.