From: Jeff King <peff@peff.net>
To: Andreas Krey <a.krey@gmx.de>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC 3/3] ls-files/dir: use is_git_repo to detect submodules
Date: Sat, 5 Dec 2015 02:37:44 -0500 [thread overview]
Message-ID: <20151205073744.GC21639@sigill.intra.peff.net> (raw)
In-Reply-To: <1449252917-3877-3-git-send-email-a.krey@gmx.de>
On Fri, Dec 04, 2015 at 07:15:17PM +0100, Andreas Krey wrote:
> Using resolve_gitlink_ref to check for submodules
> creates submodule list entries even when it isn't
> one, and causes O(n^2) runtime behaviour in repos
> with many untracked directories.
>
> Use is_git_repo instead for detection.
>
> Signed-off-by: Andreas Krey <a.krey@gmx.de>
> ---
> This looks good, but it breaks test - at least
> number 67 ('../bar/a/b/c works with relative local
> path - ../foo/bar.git') in t7400-submodule-basic.sh
>
> I don't really understand yet how to fix that,
> but it is due to resolve_gitlink_ref looking
> for a valid HEAD which is_git_repo doesn't.
Hrm. Weird. You'd think it would break with the existing code if I do
this, then:
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 540771c..944e9f5 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -754,7 +754,7 @@ test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.gi
cp pristine-.git-config .git/config &&
cp pristine-.gitmodules .gitmodules &&
mkdir -p a/b/c &&
- (cd a/b/c; git init) &&
+ (cd a/b/c; git init && git commit --allow-empty -m foo) &&
git config remote.origin.url ../foo/bar.git &&
git submodule add ../bar/a/b/c ./a/b/c &&
git submodule init &&
But it doesn't. So presumably there is a mismatch where some other code
expects that anything which gets marked as a repo in the code you
changed can also be resolved to a sha1. I'm not sure where that other
code is though (in git-submodule.sh, or elsewhere in add).
Perhaps we end up in index_path(), which then barfs? That would explain
this (run in the trash directory after the test fails):
$ cd reltest && git add a/b/c
error: unable to index file a/b/c/
fatal: adding files failed
We know it is a git dir, but there is no sha1 for us to actually add as
the gitlink entry.
If that is the case, then there is either some very tricky refactoring
required, or what we are trying to do here is simply wrong. Maybe it
would be simpler to just speed up resolve_gitlink_ref with a better data
structure.
-Peff
next prev parent reply other threads:[~2015-12-05 7:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1449252917-3877-1-git-send-email-a.krey@gmx.de>
2015-12-05 6:58 ` [PATCH 1/3] externalize is_git_repository Jeff King
[not found] ` <1449252917-3877-2-git-send-email-a.krey@gmx.de>
2015-12-05 7:01 ` [PATCH 2/3] add is_git_repo (is_git_repository for char*) Jeff King
[not found] ` <1449252917-3877-3-git-send-email-a.krey@gmx.de>
2015-12-05 7:37 ` Jeff King [this message]
2015-12-06 16:59 ` [PATCH/RFC 3/3] ls-files/dir: use is_git_repo to detect submodules Andreas Krey
2015-12-07 21:10 ` Jeff King
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=20151205073744.GC21639@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=a.krey@gmx.de \
--cc=git@vger.kernel.org \
/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).