On Wed, Feb 26, 2014 at 6:19 PM, Duy Nguyen <[email protected]> wrote:
> On Thu, Feb 27, 2014 at 3:06 AM, Eric Sunshine <[email protected]>
> wrote:
>>> + 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.
Thanks for the explanation. I thought that that might be the case.
>>> + for (name = path + len - 1; name > path; name--)
>>> + if (is_dir_sep(*name)) {
>>> + name++;
>>> + break;
>>> + }
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html