All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: david@lang.hm
Cc: git@vger.kernel.org, rob@landley.net
Subject: Re: possible bug in git apply?
Date: Sat, 04 Aug 2007 22:08:12 +0200	[thread overview]
Message-ID: <857iobdpw3.fsf@lola.goethe.zz> (raw)
In-Reply-To: <Pine.LNX.4.64.0708041243070.6905@asgard.lang.hm> (david@lang.hm's message of "Sat\, 4 Aug 2007 12\:45\:23 -0700 \(PDT\)")

david@lang.hm writes:

> On Saturday 04 August 2007 2:03:59 pm Rob Landley wrote:
>> Signed-off-by: Rob Landley <rob@landley.net>
>> Amiga part Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
>>
>> Move architecture-specific Documentation into a common subdirectory.
>
> I really, really, really hate git.
>
> Ok, on my laptop I just noticed that "git apply" of the patch didn't
> complain but it also left the empty subdirectories it moved stuff
> out of.  (I don't believe this happened on the version of git I was
> using on my previous laptop, which ate itself a month and change
> ago, but obviously I can't check.)
>
> There is no "git rmdir".  "git rm" refuses to delete the directory
> without -r.  "git rm -r Documentation/x86_64" listed (as just deleted) all
> the files that the patch already moved out of the directory.
>
> Am I missing something obvious here?

Committing the change?

> since git doesn't track directories, only content (per the big
> discussion recently) I beleive that doing a checkout would leave Rob
> without the directories that he emptied out, so shouldn't git apply
> also clear the directories to end up in the same state?

Yes, once he commits.  As long as git keeps files tracked in that
directory, there is no reason for it to delete it.

I agree that it is hard to come up with a good logic for this sort of
thing.  git-add checks the _current_ state of a file into the index.
git-rm can actually do the same only by actually _deleting_ the
working copy.  So when should git try deleting the directory?
Probably when the directory becomes empty in the index, for
consistency.  Too bad that the index does not contain any information
about directories at all, so there is no good way to figure this
particular point in time out efficiently.

I guess that git rather attempts deleting the directory when the tree
in the _repository_ rather than the index becomes empty.  And for that
you need to commit.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  parent reply	other threads:[~2007-08-04 20:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-04 19:45 possible bug in git apply? david
2007-08-04 20:00 ` Junio C Hamano
2007-08-04 20:08 ` David Kastrup [this message]
2007-08-05  4:48 ` Linus Torvalds
2007-08-05  4:53   ` Linus Torvalds
2007-08-05  5:11   ` Junio C Hamano
2007-08-05  7:55     ` David Kastrup
2007-08-05 16:59     ` Linus Torvalds
2007-08-05 17:53       ` David Kastrup
2007-08-05 18:18         ` Linus Torvalds
2007-08-05 18:50           ` David Kastrup
2007-08-05 19:20             ` Linus Torvalds
2007-08-05 19:37               ` David Kastrup
2007-08-06  8:29       ` Junio C Hamano
2007-08-06  9:37         ` 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=857iobdpw3.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=david@lang.hm \
    --cc=git@vger.kernel.org \
    --cc=rob@landley.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.