Subject: Re: [PATCH] checkout: --to requires directory

From: Jeff King <[email-masked]>
Date: Mon, 23 Feb 2015 09:42:15 -0500

On Mon, Feb 23, 2015 at 03:16:59PM +0100, Michael J Gruber wrote:

> --to requires a directory, not a file. Say so in the usage string.

Sounds like a good goal, but...

> -		OPT_FILENAME(0, "to", &opts.new_worktree,
> +		OPT_STRING(0, "to", &opts.new_worktree, N_("dir"),
>  			   N_("check a branch out in a separate working directory")),

OPT_FILENAME also calls fix_filename(), which munges the filename so
that relative paths given by the user will work, even though git has
chdir'd to the root of the working tree.

So you need to handle that somewhere. I think it might be less painful
to teach OPT_FILENAME to be more flexible in the usage message it
prints.

-Peff