From: Duy Nguyen <pclouds@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Cosmin Polifronie <oppturbv@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Running 'git worktree add' in 'pre-commit' hook
Date: Thu, 16 May 2019 18:41:51 +0700 [thread overview]
Message-ID: <CACsJy8BXxVggL7CWA5Q0d7U4B+encfZ85NshxLJ=VvHhf_LUYg@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cTQrF1W4LEgOiEoKn4f69OEygFat=4V8aTzf0Rxom2hEw@mail.gmail.com>
On Thu, May 16, 2019 at 6:33 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
> I researched this also and concluded that it's a bug in git-commit.
> You run afoul of it in other situations, as well. For instance, say
> you have your index file in a non-standard location:
>
> $ export GIT_INDEX_FILE=../storage/index
> $ git worktree add --detach other
> Preparing worktree (detached HEAD c9156d2)
> fatal: Unable to create '/.../foo/other/../storage/index.lock': No
> such file or directory
> $
>
> I think the correct fix is for git-commit to assign GIT_INDEX_FILE
> with the absolute path to the index file, not a relative path.
Oh if it's relative $GIT_INDEX_FILE then I think its our environment.c
code that does not work so well when we chdir() away. I vaguely recall
something about this when discussing Jeff's chdir-notify series. But
it turns out that's about chdir() in run-command.c [1]. But the idea
is still the same, all variables are supposed to be relative to $CWD.
Whenever you move $CWD you should reparent all of them, including
$GIT_INDEX_FILE.
[1] https://public-inbox.org/git/CACsJy8CdqpNOw+zdMyugX-902Z=gLNij5_xcmE4jGLRBTqiO1g@mail.gmail.com/
--
Duy
next prev parent reply other threads:[~2019-05-16 11:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 14:52 Running 'git worktree add' in 'pre-commit' hook Cosmin Polifronie
2019-05-15 0:46 ` Bryan Turner
2019-05-15 12:38 ` Cosmin Polifronie
2019-05-16 11:25 ` Duy Nguyen
2019-05-16 11:33 ` Eric Sunshine
2019-05-16 11:39 ` Eric Sunshine
2019-05-16 11:44 ` Duy Nguyen
2019-05-16 12:05 ` Eric Sunshine
2019-05-16 11:41 ` Duy Nguyen [this message]
2019-05-16 12:14 ` Eric Sunshine
2019-05-16 12:28 ` Duy Nguyen
2019-05-16 11:59 ` Eric Sunshine
2019-05-16 22:17 ` Jeff King
2019-05-16 23:16 ` Eric Sunshine
2019-05-17 0:19 ` Jeff King
2019-05-17 1:02 ` Eric Sunshine
2019-05-17 1:19 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACsJy8BXxVggL7CWA5Q0d7U4B+encfZ85NshxLJ=VvHhf_LUYg@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=oppturbv@gmail.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).