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

Re: [PATCH] "git checkout -- paths..." should signal error

From
Marius Storm-Olsen <marius@trolltech.com>
Date
May 29, 2008, 06:28 UTC
Message-ID
<483E4D09.1070400@trolltech.com>
In-Reply-To
<7vtzgirus5.fsf_-_@gitster.siamese.dyndns.org>
Junio C Hamano said the following on 28.05.2008 23:19:
Show 17 quoted lines
> When "git checkout -- paths..." cannot update work tree for whatever
> reason, checkout_entry() correctly issued an error message for the path to
> the end user, but the command ignored the error, causing the entire
> command to succeed.  This fixes it.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> 
>  * Now that we detect this failure, post-checkout-hook _might_ want to
>    know that what we have is an incomplete checkout.  Not calling the hook
>    in such a case may be another option, but we always called the hook and
>    that would be a change in behaviour.
> 
>  builtin-checkout.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-checkout.c b/builtin-checkout.c

I'd like to just chip in that you actually _can_ create those files (nul, con, prn, all which are "special" filenames on Windows), but need a slight different construct to create them. That, and most tools will break on _using_ them, since they's also have to refer to them in a certain way.

So, certainly msysgit could write a workaround to handle such cases. (Git would also know how to remove these files on Windows)

Though, I still think that your patch is a Good Thing(tm).
For example, if you:

D:\some\path> echo foo > nul # Ok, an no output, nor file created D:\some\path> echo foo > .\nul # Same thing D:\some\path> echo foo > \\.\d:\some\path\nul # Creates the nul file

  Directory of D:\some\path
29.05.2008  08:23    <DIR>          .
29.05.2008  08:23    <DIR>          ..
29.05.2008  08:23                 6 con
29.05.2008  08:22                 6 nul
29.05.2008  08:23                 6 prn
                3 File(s)             18 bytes

D:\some\path> del .\nul The filename, directory name, or volume label syntax is incorrect.

D:\some\path> del \\.\d:\some\path\nul  # Success
-- 
.marius [@trolltech.com]
'if you know what you're doing, it's not research'
Previous: Junio C HamanoNext: Daniel Barkalow
Message 37 of 42 in “Commit cce8d6fdb introduces file t/t5100/nul, git tree is now incompatible with Cygwin (and probably Windows)”
  1. Mark LevedahlMay 26, 2008
  2. Johannes SchindelinMay 26, 2008
  3. Mark LevedahlMay 26, 2008
  4. Johannes SchindelinMay 26, 2008
  5. Mark LevedahlMay 26, 2008
  6. Johannes SchindelinMay 26, 2008
  7. Johannes SchindelinMay 26, 2008
  8. Eric BlakeMay 27, 2008
  9. Junio C HamanoMay 28, 2008
  10. Wincent ColaiutaMay 28, 2008
  11. Lea WiemannMay 28, 2008
  12. Wincent ColaiutaMay 28, 2008
  13. Jakub NarebskiMay 28, 2008
  14. Johannes SchindelinMay 29, 2008
  15. Wincent ColaiutaMay 29, 2008
  16. Johannes SchindelinMay 29, 2008
  17. Wincent ColaiutaMay 29, 2008
  18. Steffen ProhaskaMay 31, 2008
  19. gitweb: Remove gitweb/test/ directoryJakub Narebski, May 31, 2008
  20. Wincent ColaiutaMay 31, 2008
  21. Johannes SchindelinMay 31, 2008
  22. Jakub NarebskiJun 1, 2008
  23. Kay SieversJun 1, 2008
  24. Wincent ColaiutaJun 1, 2008
  25. Junio C HamanoJun 1, 2008
  26. Jakub NarebskiJun 1, 2008
  27. Avery PennarunMay 28, 2008
  28. Junio C HamanoMay 28, 2008
  29. Sverre RabbelierMay 28, 2008
  30. Avery PennarunMay 28, 2008
  31. Junio C HamanoMay 28, 2008
  32. Daniel BarkalowMay 28, 2008
  33. Junio C HamanoMay 28, 2008
  34. Daniel BarkalowMay 28, 2008
  35. Junio C HamanoMay 28, 2008
  36. "git checkout -- paths..." should signal errorJunio C Hamano, May 28, 2008
  37. Marius Storm-OlsenMay 29, 2008
  38. Daniel BarkalowMay 29, 2008
  39. Daniel BarkalowMay 28, 2008
  40. Makefile: wt-status.h is also a lib headerJohannes Schindelin, May 26, 2008
  41. Junio C HamanoMay 26, 2008
  42. Johannes SchindelinMay 26, 2008

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.