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

From: Marius Storm-Olsen <[email-masked]>
Date: Thu, 29 May 2008 08:28:25 +0200

Junio C Hamano said the following on 28.05.2008 23:19:
> 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 <[email-masked]>
> ---
> 
>  * 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'