git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bryan Donlan" <bdonlan@gmail.com>
To: "Christian Couder" <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org, "Junio Hamano" <junkio@cox.net>, krh@redhat.com
Subject: Re: Possible d/f conflict bug or regression
Date: Sun, 30 Mar 2008 00:51:26 -0400	[thread overview]
Message-ID: <3e8340490803292151o58186b18y487ac6fc6d4353b4@mail.gmail.com> (raw)
In-Reply-To: <200803300644.15502.chriscool@tuxfamily.org>

On Sun, Mar 30, 2008 at 12:44 AM, Christian Couder
<chriscool@tuxfamily.org> wrote:
> Le dimanche 30 mars 2008, Bryan Donlan a écrit :
>
> > On Sat, Mar 29, 2008 at 3:13 AM, Christian Couder
>  > <chriscool@tuxfamily.org> 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

  reply	other threads:[~2008-03-30  4:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29  7:13 Possible d/f conflict bug or regression Christian Couder
2008-03-29  8:01 ` Christian Couder
2008-03-30  1:29 ` Bryan Donlan
2008-03-30  4:44   ` Christian Couder
2008-03-30  4:51     ` Bryan Donlan [this message]
2008-03-30 23:46 ` Junio C Hamano
2008-03-31  0:28   ` [PATCH 1/3] Add corner case tests for diff-index and diff-files Junio C Hamano
2008-03-31  0:29   ` [PATCH 2/3] diff-index: careful when inspecting work tree items Junio C Hamano
2008-03-31  3:12     ` Junio C Hamano
2008-03-31  3:47       ` Christian Couder
2008-03-31  0:30   ` [PATCH 3/3] diff-files: " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e8340490803292151o58186b18y487ac6fc6d4353b4@mail.gmail.com \
    --to=bdonlan@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=krh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).