Re: [PATCH v3 21/25] checkout: support checking out into a new working directory
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 26, 2014, 23:19 UTC
- Message-ID
- <CACsJy8BkAOk4d3nFP_CtUN4Feer0sHy8H8vpbUWcZcYMLYgYyg@mail.gmail.com>
- In-Reply-To
- <CAPig+cSDT72MHFdwnZHBwEUiJQiQAkc-nv0vK166O8EuXVtgbw@mail.gmail.com>
On Thu, Feb 27, 2014 at 3:06 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 5 quoted lines
>> + len = strlen(path);
>> + if (!len || is_dir_sep(path[len - 1]))
>> + die(_("'--to' argument '%s' cannot end with a slash"), path);
>
> What is the purpose of this restriction?Laziness on my part :) Because the following loop searches backward to get the `basename $path`, trailing slash would make it return empty base name. I could have just removed the trailing slash here instead of dying though. Thanks for catching.
Show 6 quoted lines
>
>> + for (name = path + len - 1; name > path; name--)
>> + if (is_dir_sep(*name)) {
>> + name++;
>> + break;
>> + }-- Duy