From: Josh Bleecher Snyder Date: Tue, 30 Dec 2014 22:21:57 GMT Subject: Bug report: checkout-index --temp path is not always relative to the current directory Message-ID: 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