Re: mangled file names in git checkout-index --temp output when run in repo subdirectory
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 23, 2014, 23:27 UTC
- Message-ID
- <CAPig+cQ4Bb=bUKeKuBp-ykorBV+mSuztvzh=AA5CDNPFLVQw5Q@mail.gmail.com>
- In-Reply-To
- <CAA8EjDRsw6o8T1sS=rpSt_+KaKt9QnONCmF23yHDdKhgKHcdww@mail.gmail.com>
On Tue, Dec 23, 2014 at 11:36 AM, Russ Cox <rsc@golang.org> wrote:
Show 17 quoted lines
> I am using git checkout-index --temp to obtain copies of files from
> the index, but it does not always print valid file names unless run
> from the repository root.
>
> git checkout-index --temp prints names of files in the index
> interpreted relative to the current directory below the repository
> root.
>
> If you have a git repo in /tmp/gitbug, you are in /tmp/gitbug/dir1,
> and you run git checkout-index --temp /tmp/gitbug/dir1/file1, the file
> listing prints just "file1". So far so good.
>
> However, this file name shortening appears to assume that all file
> names being printed will be within the subtree rooted at the current
> directory, and it just skips over the first N characters in the name,
> where N is the length of the current directory name relative to the
> repo root (in the above example, N = len("dir1/") = 5).Indeed, although the "checkout" functionality of checkout-index properly handles relative paths above the current directory, the code which prints them doesn't. I'm working up a patch.