All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "erik elfström" <erik.elfstrom@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>,
	Jens Lehmann <Jens.Lehmann@web.de>
Subject: Re: [PATCH v2 3/3] clean: improve performance when removing lots of directories
Date: Fri, 17 Apr 2015 15:00:02 -0400	[thread overview]
Message-ID: <20150417190002.GB32578@peff.net> (raw)
In-Reply-To: <CAMpP7NbQ7pmcjT4pDn5dA5yvfgMgirbkoMD6ijjiFp7zmARPbA@mail.gmail.com>

On Fri, Apr 17, 2015 at 08:15:40PM +0200, erik elfström wrote:

> > Doesn't this implementation get confused by modern submodule
> > checkouts and descend into and clean their working tree, though?
> > Module M with path P would have a directory P in the working tree of
> > the top-level project, and P/.git is a regular file that will fail
> > "is_git_directory()" test but records the location of the real
> > submodule repository i.e. ".git/modules/M" via the "gitdir:"
> > mechanism.
> >
> 
> Yes, there is a problem here. I've added the test below and it fails after
> my change by cleaning sub2 (sub1 is not cleaned). Are there more cases
> here that I should test for?

I wonder about the opposite case, too (finding more repos than we used
to).

It looks like your patches will find bare repositories in the tree,
whereas the current code does not (it only cares about ".git"). AFAIK,
submodules will never exist as bare in the working tree. And I have seen
repositories which embed bare repos as test cases. Admittedly this is
because I work on projects that are related to git itself, but I don't
see a reason to regress this case if the submodule code doesn't get any
benefit.

> Base on the previous discussion of the patch topic I can see 3 options
> for how to fix this:
> 
> Option 1:
>  Plug the hole in my new is_git_repository function. A quick and dirty
>  fix that passes the above test would be:

I think that makes sense. It would be nice if you could just call
read_gitfile, but that function is very anxious to die on error. So the
prerequisite step would probably be to refactor that into a
read_gitfile_gently that returns an error code.

-Peff

PS Thank you for working on this. I have been quiet because I haven't
   had a chance to look over your patches carefully yet, but overall
   they look very promising.

  reply	other threads:[~2015-04-17 19:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-11 16:43 [PATCH v2 0/3] Improving performance of git clean Erik Elfström
2015-04-11 16:43 ` Erik Elfström
2015-04-11 16:43 ` [PATCH v2 1/3] t7300: add tests to document behavior of clean and nested git Erik Elfström
2015-04-11 16:43 ` [PATCH v2 2/3] p7300: add performance tests for clean Erik Elfström
2015-04-11 17:59   ` Thomas Gummerer
2015-04-12 15:31     ` erik elfström
2015-04-12 16:52       ` Thomas Gummerer
2015-04-11 16:43 ` [PATCH v2 3/3] clean: improve performance when removing lots of directories Erik Elfström
2015-04-15 17:56   ` Junio C Hamano
2015-04-17 18:15     ` erik elfström
2015-04-17 19:00       ` Jeff King [this message]
2015-04-17 19:13         ` Junio C Hamano
2015-04-15  3:33 ` [PATCH v2 0/3] Improving performance of git clean Eric Sunshine

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=20150417190002.GB32578@peff.net \
    --to=peff@peff.net \
    --cc=Jens.Lehmann@web.de \
    --cc=erik.elfstrom@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 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.