Re: [PATCH] checkout-index needs a working tree
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 5, 2007, 01:33 UTC
- Message-ID
- <Pine.LNX.4.64.0708050229200.14781@racer.site>
- In-Reply-To
- <7vvebuj4nw.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 4 Aug 2007, Junio C Hamano wrote:
> I wonder if it would help us to catch similar breakages if we change > git.c::run_command() so that we do not pass prefix (or pass a bogus > pointer ((const char *)1)) for commands that do not ask for > NEED_WORK_TREE.
I tried that, but we have some places where we ask "if (prefix && *prefix)", for example in ls-tree. It does not _require_ a work tree, but it certainly uses it when it is available -- which is fine.
Other users are more tricky, such as ls-files and update-index, which need a working tree only in some cases.
I'll probably write a patch on Monday (if nobody else is faster) to provide a function "require_work_tree()" in environment.c, which does the obvious (with caching). Then comes the tedious part: identifying all those options that need a working tree...
Ciao, Dscho