Re: Possible d/f conflict bug or regression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 30, 2008 at 12:44 AM, Christian Couder
<chriscool@xxxxxxxxxxxxx> wrote:
> Le dimanche 30 mars 2008, Bryan Donlan a écrit :
>
> > On Sat, Mar 29, 2008 at 3:13 AM, Christian Couder
>  > <chriscool@xxxxxxxxxxxxx> wrote:
>  > >
>
> > >  Initialized empty Git repository in .git/
>  > >  Created initial commit 3f945ca: Initial commit.
>  > >   0 files changed, 0 insertions(+), 0 deletions(-)
>  > >   create mode 100644 foo
>  > >  fatal: unable to index file foo
>  > >
>  > >  I think it's quite bad that it doesn't work.
>  >
>  > What behavior would you expect this to have? IMO, it's not entirely
>  > clear what the user means to do if they replace a file with an empty
>  > directory, as an empty directory cannot be added to the index. Even
>  > with a directory with contents, some of the contents may be junk (.o
>  > for example) as far as the user is concerned.
>
>  I think Git should behave the same as when using "git rm foo" instead of "rm
>  foo", that is the file "foo" should be deleted without errors. That's what
>  version 1.5.3 did too.
>
>
>  > Would a clearer diagnostic be a good solution? Something like:
>  > fatal: foo: file replaced by directory.
>  > Use git rm --cached or git add to specify how this should be handled.
>
>  No, I think we should fix the regression. Using "git rm stuff" instead
>  of "rm stuff" should not be required.

This is inconsistent with git's behavior when replacing a file with a
symlink then - you can rm file; ln -s something file, and the symlink
will be checked in...

As-is, if you "rm stuff" but do not "mkdir stuff", you can commit
without problems. Likewise, you can "rm stuff", and "echo foo >
stuff", and the file will be updated. "rm stuff" -> "mkdir stuff; vim
stuff/bar.c" could equally imply that the user wants to replace
"stuff" with a directory, could it not?

I don't think git should be inconsistent in this case, but equally
it's difficult to know what the user wants to do if they put in an
empty directory... That's why I think it'd be more sensible to let the
user know so they can decide which action they want to take. It
shouldn't happen often anyway; I'd be interested in hearing about a
use-case that involves frequent replacement of files with directories,
though :)

Thanks,

Bryan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux