From: "Philip Oakley" <philipoakley@iee.org>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "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: Thu, 17 Oct 2013 23:38:09 +0100 [thread overview]
Message-ID: <1390B0AFBE7F4C4A875987C7469B0791@PhilipOakley> (raw)
In-Reply-To: 5A09FF55D37146E7A02DF2F640A46406@PhilipOakley
From: "Philip Oakley" <philipoakley@iee.org>
> From: "Junio C Hamano" <gitster@pobox.com>
>> "Philip Oakley" <philipoakley@iee.org> writes:
>>
>>> From: "Junio C Hamano" <gitster@pobox.com>
>>>> "Philip Oakley" <philipoakley@iee.org> writes:
>>>>
>>>>> ... and the detection process for 'toplevel' may not work
>>>>> properly when in a separated work-tree environment.
>>>>
>>>> Without GIT_WORK_TREE exported to point at the top-level, there is
>>>> nothing that lets us "detect" it, as the working tree does not have
>>>> ".git" directory to tell us to stop, no?
>>>>
>>>
>>> "No", but not in that way.
>>>
>>> My point (to Dale) was, as you state, that the "cd to top level" was
>>> (IIUC) the probable causes of the fault, and that a documentation
>>> update would probably be appropriate for the discussion on exporting
>>> GIT_WORK_TREE, and that it would specifically mention those git
>>> commands that needed to "cd to top level", and hence would not work
>>> in
>>> such an environment. (I wasn't sure where the appropriate "cd to top
>>> level" function was)
>>>
>>> An explanation here on the list wouldn't solve the problems for
>>> others
>>> who are yet to make the same mistake, hence the implied suggestion.
>>
>> I understand what you mean by these last two lines. It was unclear
>> to me which part of our documentation needs updating and how, and
>> that was (and still is) what I was primarily interested in finding
>> out.
>>
> I was expecting that the places would be in git(1) [git.txt] and
> config(1) [config.txt], in the enironment variables GIT_WORK_TREE
> section and core.worktree sections repectively. However what the right
> text would be hasn't been fully determined yet, as it should be clear
> about which commands don't follow the stated 'rules'. Dale's use case
> does appear to be stretching...
>
> Philip
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.
One option may be to either protect the cd_to_toplevel code with a
check of `git rev-parse --local-env-vars` to see if GIT_WORK_TREE is
present. Or create `git rev-parse --work-dir` to match `--git-dir`. This
would be a code level fix. This makes the assumption that if a deteched
GIT_WORK_TREE is set then it is the top level.
In terms of command scripts that use git-sh-setup.sh we have a longish
list, so a full list in the documentation is probably unreasonable
(which suggests that a code fix would be more apprpriate)
commands:
git-am
git-bisect
git-filter-branch
git-instaweb
git-lost-found
git-merge-one-file
git-mergetool
git-pull
git-quiltimport
git-rebase
git-repack
git-request-pull
git-stash
git-submodule
git-web--browse
git\contrib\*various*
Philip
next prev parent reply other threads:[~2013-10-17 22:38 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 [this message]
2013-10-17 22:48 ` Jonathan Nieder
2013-10-18 20:40 ` Philip Oakley
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=1390B0AFBE7F4C4A875987C7469B0791@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).