All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joey Hess <id@joeyh.name>
To: git@vger.kernel.org
Subject: Re: GIT_INDEX_FILE relative path breaks in subdir
Date: Sun, 22 May 2016 15:04:04 -0400	[thread overview]
Message-ID: <20160522190404.GA20998@kitenet.net> (raw)
In-Reply-To: <20160517182645.GA27396@kitenet.net>

[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]

This is actually worse than I thought; when git is being run with a
detached work tree, GIT_INDEX_FILE is treated as a path relative to CWD,
instead of the normal behavior of relative the top of the work tree.

Normal and expected (according to this thread anyway):

joey@darkstar:~/src/other/git/Documentation> input="100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1    frotz"
joey@darkstar:~/src/other/git/Documentation> echo "$input" | GIT_INDEX_FILE=.git/newindex git update-index --index-info 
joey@darkstar:~/src/other/git/Documentation> ls ../.git/newindex 
../.git/newindex

Fully detached worktree and git dir:

joey@darkstar:/> echo "$input" | GIT_INDEX_FILE=.git/index git --git-dir=/home/joey/src/other/git/.git --work-tree=/home/joey/src/other/git update-index --index-info 
fatal: Unable to create '/.git/index.lock': No such file or directory
joey@darkstar:/> echo "$input" | GIT_WORK_TREE=/home/joey/src/other/git GIT_DIR=/home/joey/src/other/git/.git GIT_INDEX_FILE=.git/newindex git update-index --index-info 
fatal: Unable to create '/.git/newindex.lock': No such file or directory

Work tree detached via git configuration:

joey@darkstar:~/src/other/git> git config core.worktree /home/joey/src/other/git/tmptree
joey@darkstar:~/src/other/git> mkdir tmptree
joey@darkstar:~/src/other/git> cd tmptree/
joey@darkstar:~/src/other/git/tmptree> mkdir Documentation
joey@darkstar:~/src/other/git/tmptree> cd Documentation/
joey@darkstar:~/src/other/git/tmptree/Documentation> echo "$input" | GIT_INDEX_FILE=.git/index git update-index --index-info
fatal: Unable to create '/home/joey/src/other/git/tmptree/.git/index.lock': No such file or directory

This seems to make it basically impossible for any program that wants to
use GIT_INDEX_FILE to use anything other than an absolute path;
there are too many configurations to keep straight that could change how
git interprets what should be a simple relative path to a file.

-- 
see shy jo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  reply	other threads:[~2016-05-22 19:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 17:18 GIT_INDEX_FILE relative path breaks in subdir Joey Hess
2016-05-17 17:34 ` Junio C Hamano
2016-05-17 18:26   ` Joey Hess
2016-05-22 19:04     ` Joey Hess [this message]
2016-05-23 16:44       ` Junio C Hamano
2016-05-23 17:29         ` Joey Hess
2016-05-23 18:30           ` Junio C Hamano
2016-05-23 18:52             ` Joey Hess
2016-05-23 19:44               ` Junio C Hamano

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=20160522190404.GA20998@kitenet.net \
    --to=id@joeyh.name \
    --cc=git@vger.kernel.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.