From: "Philip Oakley" <philipoakley@iee.org>
To: "Jonathan Nieder" <jrnieder@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Dale R. Worley" <worley@alum.mit.edu>,
"Git List" <git@vger.kernel.org>
Subject: Re: [git-users] Problem using detached worktrees with commands implemented in scripts
Date: Fri, 18 Oct 2013 21:40:29 +0100 [thread overview]
Message-ID: <03C57561C4664D048C2F28134019C391@PhilipOakley> (raw)
In-Reply-To: 20131017224834.GW9464@google.com
From: "Jonathan Nieder" <jrnieder@gmail.com>
> Philip Oakley wrote:
It was Dale that had the problem, I was just suggesting where he might
want to look... ;-)
>
>> A bit more looking gave that the cd_to_toplevel () in git-sh-setup.sh
>> directly uses `git rev-parse --show-toplevel`, which simply returns
>> work_tree (static char *work_tree; in environment.c, with comment /*
>> This is set by setup_git_dir_gently() and/or git_default_config()
>> */), apparently without a check for the GIT_WORK_TREE.
>
> Getting closer. :)
>
> The usual way to use GIT_WORK_TREE is along with GIT_DIR.
When re-checking the manual's git(1) env variable section the comment
that implies this didn't read well "The value will not be used in
combination...". The section probably needs that to be stated explicitly
("an exported GIT_WORK_TREE is ignored if GIT_DIR is not set").
> That takes
> you into the setup_explicit_git_dir() codepath, which does respect
> GIT_WORK_TREE as it should. (setup_discovered_git_dir does, too.)
>
> The strange behavior you ran into is that unlike, say, git-pull.sh and
> git-am.sh, filter-branch does not set SUBDIRECTORY_OK, store the
> prefix from 'git rev-parse --show-prefix', and then cd_to_toplevel at
> the top of the script. In other words, nobody bothered to make it
> work from anywhere other than the toplevel of the worktree to begin
> with, and nobody wanted it enough to fix it later.
>
I maybe wrong, but I thought that in Dale's case he was already at the
same level as the GIT_WORK_TREE he had set, so may not have expected to
need a cd_to_toplevel
Dale did propose a patch in
http://thread.gmane.org/gmane.comp.version-control.git/236260 as the
error was from later in the setup script.
> Hope that helps,
> Jonathan
>
Philip
next prev parent reply other threads:[~2013-10-18 20:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 20:03 [git-users] Problem using detached worktrees with commands implemented in scripts Dale R. Worley
2013-10-16 21:42 ` Junio C Hamano
2013-10-16 22:39 ` Philip Oakley
2013-10-16 23:08 ` Junio C Hamano
2013-10-17 20:11 ` Philip Oakley
2013-10-17 20:50 ` Junio C Hamano
2013-10-17 21:14 ` Philip Oakley
2013-10-17 22:38 ` Philip Oakley
2013-10-17 22:48 ` Jonathan Nieder
2013-10-18 20:40 ` Philip Oakley [this message]
2013-10-18 22:54 ` Dale R. Worley
2013-10-17 19:09 ` Dale R. Worley
2013-10-17 20:08 ` Junio C Hamano
2013-10-18 22:25 ` Dale R. Worley
2013-10-18 22:43 ` Junio C Hamano
2013-10-21 18:51 ` Dale R. Worley
2013-10-18 22:50 ` Dale R. Worley
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=03C57561C4664D048C2F28134019C391@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=worley@alum.mit.edu \
/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).