git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug report: checkout-index --temp path is not always relative to the current directory

From
Josh Bleecher Snyder <josharian@gmail.com>
Date
Dec 30, 2014, 22:21 UTC
Message-ID
<CAFAcib9tz+EDqWx=nohxEbH3FRbwUweabKHTyBF-dioh6G-KKg@mail.gmail.com>
In the section on using --temp, 'git help checkout-index' says:

"The path field is always relative to the current directory and the temporary file names are always relative to the top level directory."

However, this can be false when an absolute path to the file is provided.
Reproduction:
~$ git version
git version 2.2.1
~$ mkdir demo
~$ cd demo
~/demo$ mkdir a
~/demo$ echo "a" > a/f
~/demo$ mkdir b
~/demo$ echo "b" > b/f
~/demo$ git init .
Initialized empty Git repository in ~/demo/.git/
~/demo$ git add .
~/demo$ git commit -m "init"
[master (root-commit) 2afa910] init
 2 files changed, 2 insertions(+)
 create mode 100644 a/f
 create mode 100644 b/f
~/demo$ echo "b2" > b/f
~/demo$ cd a
~/demo/a$ git checkout-index --temp -- `git rev-parse --show-toplevel`/b/f
.merge_file_xm8RTd f
~/demo/a$ cat ../.merge_file_xm8RTd
b

Note that if f in the checkout-index output is interpreted as relative to the current directory, it would refer to a/f, whereas in fact is it b/f.

This led to https://github.com/golang/go/issues/9476.

Thanks, Josh

Next: Eric Sunshine
Message 1 of 2 in “Bug report: checkout-index --temp path is not always relative to the current directory”
  1. Josh Bleecher SnyderDec 30, 2014
  2. Eric SunshineDec 30, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.