{"thread":{"id":"38266","subject":"Bug report: checkout-index --temp path is not always relative to the current directory","startedAt":"2014-12-30T22:21:57Z","lastAt":"2014-12-30T22:25:02Z","messageCount":2,"participants":["Josh Bleecher Snyder","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"254225","messageId":"CAFAcib9tz+EDqWx=nohxEbH3FRbwUweabKHTyBF-dioh6G-KKg@mail.gmail.com","threadId":"38266","inReplyTo":null,"subject":"Bug report: checkout-index --temp path is not always relative to the current directory","fromName":"Josh Bleecher Snyder","fromEmail":"josharian@gmail.com","sentAt":"2014-12-30T22:21:57Z","receivedAt":"2014-12-30T22:21:57Z","isPatch":false,"sender":{"key":"josharian@gmail.com","avatar":"https://gravatar.com/avatar/df58f649b62f4d66e2e635810212cb54403228630fabfa080eb5847a6f4cc01b?d=mp&s=160"},"body":"In the section on using --temp, 'git help checkout-index' says:\n\n\"The path field is always relative to the current directory and the\ntemporary file names are always relative to the top level directory.\"\n\nHowever, this can be false when an absolute path to the file is provided.\n\nReproduction:\n\n~$ git version\ngit version 2.2.1\n~$ mkdir demo\n~$ cd demo\n~/demo$ mkdir a\n~/demo$ echo \"a\" > a/f\n~/demo$ mkdir b\n~/demo$ echo \"b\" > b/f\n~/demo$ git init .\nInitialized empty Git repository in ~/demo/.git/\n~/demo$ git add .\n~/demo$ git commit -m \"init\"\n[master (root-commit) 2afa910] init\n 2 files changed, 2 insertions(+)\n create mode 100644 a/f\n create mode 100644 b/f\n~/demo$ echo \"b2\" > b/f\n~/demo$ cd a\n~/demo/a$ git checkout-index --temp -- `git rev-parse --show-toplevel`/b/f\n.merge_file_xm8RTd f\n~/demo/a$ cat ../.merge_file_xm8RTd\nb\n\nNote that if f in the checkout-index output is interpreted as relative\nto the current directory, it would refer to a/f, whereas in fact is it\nb/f.\n\nThis led to https://github.com/golang/go/issues/9476.\n\nThanks,\nJosh\n"},{"id":"254226","messageId":"CAPig+cRSfb=tQ4zUnzutZsj_R590juPU-jFCdJ6+E=x51tguRQ@mail.gmail.com","threadId":"38266","inReplyTo":"CAFAcib9tz+EDqWx=nohxEbH3FRbwUweabKHTyBF-dioh6G-KKg@mail.gmail.com","subject":"Re: Bug report: checkout-index --temp path is not always relative to the current directory","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-12-30T22:25:02Z","receivedAt":"2014-12-30T22:25:02Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Dec 30, 2014 at 5:21 PM, Josh Bleecher Snyder\n<josharian@gmail.com> wrote:\n> In the section on using --temp, 'git help checkout-index' says:\n>\n> \"The path field is always relative to the current directory and the\n> temporary file names are always relative to the top level directory.\"\n>\n> However, this can be false when an absolute path to the file is provided.\n\nSee [1] for a fix.\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/261796\n\n> Reproduction:\n>\n> ~$ git version\n> git version 2.2.1\n> ~$ mkdir demo\n> ~$ cd demo\n> ~/demo$ mkdir a\n> ~/demo$ echo \"a\" > a/f\n> ~/demo$ mkdir b\n> ~/demo$ echo \"b\" > b/f\n> ~/demo$ git init .\n> Initialized empty Git repository in ~/demo/.git/\n> ~/demo$ git add .\n> ~/demo$ git commit -m \"init\"\n> [master (root-commit) 2afa910] init\n>  2 files changed, 2 insertions(+)\n>  create mode 100644 a/f\n>  create mode 100644 b/f\n> ~/demo$ echo \"b2\" > b/f\n> ~/demo$ cd a\n> ~/demo/a$ git checkout-index --temp -- `git rev-parse --show-toplevel`/b/f\n> .merge_file_xm8RTd f\n> ~/demo/a$ cat ../.merge_file_xm8RTd\n> b\n>\n> Note that if f in the checkout-index output is interpreted as relative\n> to the current directory, it would refer to a/f, whereas in fact is it\n> b/f.\n>\n> This led to https://github.com/golang/go/issues/9476.\n>\n> Thanks,\n> Josh\n"}]}