git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
Feb 23, 2015, 14:42 UTC
Message-ID
<20150223144214.GA31624@peff.net>
In-Reply-To
<768eecca8711467b43fcc45403ce9ce91bb1550e.1424700971.git.git@drmicha.warpmail.net>
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
Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 18 in “checkout: --to requires directory”
  1. checkout: --to requires directoryMichael J Gruber, Feb 23, 2015
  2. Jeff KingFeb 23, 2015
  3. Michael J GruberFeb 23, 2015
  4. 0/4 OPT_{FILENAME,PATH}Michael J Gruber, Feb 23, 2015
  5. 1/4 parse-options: introduce OPT_PATHMichael J Gruber, Feb 23, 2015
  6. Junio C HamanoFeb 23, 2015
  7. Michael J GruberFeb 24, 2015
  8. Philip OakleyFeb 23, 2015
  9. 2/4 option-strings: use OPT_FILENAMEMichael J Gruber, Feb 23, 2015
  10. Jeff KingFeb 23, 2015
  11. Junio C HamanoFeb 23, 2015
  12. Junio C HamanoFeb 23, 2015
  13. 3/4 option-strings: use OPT_PATHMichael J Gruber, Feb 23, 2015
  14. Jeff KingFeb 23, 2015
  15. Junio C HamanoFeb 23, 2015
  16. Jeff KingFeb 23, 2015
  17. 4/4 checkout: --to requires directoryMichael J Gruber, Feb 23, 2015
  18. Duy NguyenFeb 24, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.