From: Felipe Contreras <felipe.contreras@gmail•com>
To: Todd Zullinger <tmz@pobox•com>,
Felipe Contreras <felipe.contreras@gmail•com>
Cc: git@vger•kernel.org, Jeff King <peff@peff•net>,
Junio C Hamano <gitster@pobox•com>
Subject: Re: [PATCH 06/18] version-gen: remove redundant check
Date: Fri, 14 Apr 2023 13:32:43 -0600 [thread overview]
Message-ID: <6439aa5b2c776_6058729489@chronos.notmuch> (raw)
In-Reply-To: <ZDmjIqNwVMESgHnn@pobox.com>
Todd Zullinger wrote:
> Felipe Contreras wrote:
> > 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.
>
> >> 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 =
I don't think this is a realistic use-case, but supposing it is, what would be
the desired outcome in this case?
GIT_VERSION = 2.40.GIT
?
> 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.
If we care about this, the same behavior can be achieved with GIT_CEILING_DIRECTORIES:
GIT_CEILING_DIRECTORIES=$(cd .. && pwd) git describe ...
--
Felipe Contreras
next prev parent reply other threads:[~2023-04-14 19:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 12:18 [PATCH 00/18] version-gen: complete revamp/rewrite Felipe Contreras
2023-04-14 12:18 ` [PATCH 01/18] version-gen: reorganize Felipe Contreras
2023-04-14 12:18 ` [PATCH 02/18] version-gen: trivial cleanup Felipe Contreras
2023-04-14 12:18 ` [PATCH 03/18] version-gen: refactor default version Felipe Contreras
2023-04-14 12:18 ` [PATCH 04/18] version-gen: simplify v prefix removal Felipe Contreras
2023-04-14 12:18 ` [PATCH 05/18] version-gen: simplify update check Felipe Contreras
2023-04-14 12:18 ` [PATCH 06/18] version-gen: remove redundant check Felipe Contreras
2023-04-14 15:11 ` Todd Zullinger
2023-04-14 17:47 ` Felipe Contreras
2023-04-14 19:01 ` Todd Zullinger
2023-04-14 19:32 ` Felipe Contreras [this message]
2023-04-14 19:41 ` Todd Zullinger
2023-04-14 12:18 ` [PATCH 07/18] version-gen: simplify `git describe` checks Felipe Contreras
2023-04-14 12:18 ` [PATCH 08/18] version-gen: simplify dirty check Felipe Contreras
2023-04-14 12:18 ` [PATCH 09/18] version-gen: move describe fix into function Felipe Contreras
2023-04-14 12:18 ` [PATCH 10/18] version-gen: describe and sed in one go Felipe Contreras
2023-04-14 12:18 ` [PATCH 11/18] version-gen: refactor describe function Felipe Contreras
2023-04-14 12:18 ` [PATCH 12/18] version-gen: do v fix only when necessary Felipe Contreras
2023-04-14 12:18 ` [PATCH 13/18] version-gen: move v fix into sed Felipe Contreras
2023-04-14 12:18 ` [PATCH 14/18] version-gen: refactor main functionality Felipe Contreras
2023-04-14 12:18 ` [PATCH 15/18] version-gen: remove default version Felipe Contreras
2023-04-14 12:18 ` [PATCH 16/18] version-gen: refactor GIT_VERSION string Felipe Contreras
2023-04-14 12:18 ` [PATCH 17/18] version-gen: get rid of GVF variable Felipe Contreras
2023-04-14 12:18 ` [PATCH 18/18] version-gen: generate proper interim versions Felipe Contreras
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=6439aa5b2c776_6058729489@chronos.notmuch \
--to=felipe.contreras@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=peff@peff$(echo .)net \
--cc=tmz@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox