From: John Keeping <john@keeping.me.uk>
To: David Aguilar <davvid@gmail.com>, Petr Baudis <pasky@ucw.cz>
Cc: "Jens Lehmann" <Jens.Lehmann@web.de>,
"Gábor Lipták" <gabor.liptak@gmail.com>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: Fwd: Git Directory Diff for submodule
Date: Fri, 21 Feb 2014 09:27:25 +0000 [thread overview]
Message-ID: <20140221092725.GE1048@serenity.lan> (raw)
In-Reply-To: <CAJDDKr5czZezBZC1HtS9EjKvpPn-sxQTJOWLABRBVw2ei2BFVg@mail.gmail.com>
On Thu, Feb 20, 2014 at 02:41:23PM -0800, David Aguilar wrote:
> On Thu, Feb 20, 2014 at 1:03 PM, Jens Lehmann <Jens.Lehmann@web.de> wrote:
> > Sorry for the late reply, but here we go ...
> >
> > Am 10.02.2014 07:33, schrieb Gábor Lipták:
> >> Hi Jens,
> >>
> >> So "git status" says:
> >>
> >> liptak@liptak-kubuntu:~/Projects/MAIN_MODULE/platform/SUBMODULE
> >> [master]$ git status
> >> # On branch master
> >> # Your branch is up-to-date with 'origin/master'.
> >> #
> >> # Changes not staged for commit:
> >> # (use "git add <file>..." to update what will be committed)
> >> # (use "git checkout -- <file>..." to discard changes in working
> >> directory)
> >> #
> >> # modified: xxxxxx.java
> >> # modified: xxxxxxx.java
> >> # ...
> >> # ...
> >> # ...
> >> # ...
> >> # ...
> >> #
> >> no changes added to commit (use "git add" and/or "git commit -a")
> >>
> >> git config core.worktree gives back: "../../../../platform/SUBMODULE"
> >
> > Which looks a bit strange but is perfectly ok for a repository
> > that uses a gitfile, as the core.worktree setting is relative
> > to the git directory the gitfile references and not the directory
> > the gitfile lives in. A quick glance at the find_worktree
> > subroutine in git-difftool.perl makes me think that difftool is
> > not aware of that fact. David, does that make sense?
>
> That does make sense. It sounds like that may need to be adjusted.
>
> What does `git rev-parse --show-toplevel` print? It seems like the
> find_worktree() logic needs to be extended to handle .git files.
Having tried it with a submodule here, it looks like rev-parse gets this
right.
> >> The submodule was inited simply with "git submodule init" +
> >> "git.submodule update"
>
> Or possibly, as you mention below, it could be that "git submodule
> init" ended up writing the wrong core.worktree value. I'm not very
> familiar with how they are initialized, but the paths do seem sane, so
> I doesn't seem like that's the issue.
>
> If it's a problem in difftool we can probably find a way to do the
> right thing. It looks like the core.worktree is relative to the
> .git/modules/XXX directory rather than the submodule (and
> super-project)'s worktree.
>
> Here's our current logic:
>
> sub find_worktree
> {
> my ($repo) = @_;
>
> # Git->repository->wc_path() does not honor changes to the working
> # tree location made by $ENV{GIT_WORK_TREE} or the 'core.worktree'
> # config variable.
> my $worktree;
> my $env_worktree = $ENV{GIT_WORK_TREE};
> my $core_worktree = Git::config('core.worktree');
>
> if (defined($env_worktree) and (length($env_worktree) > 0)) {
> $worktree = $env_worktree;
> } elsif (defined($core_worktree) and (length($core_worktree) > 0)) {
> $worktree = $core_worktree;
> } else {
> $worktree = $repo->wc_path();
> }
> return $worktree;
> }
>
> John, any thoughts?
I don't really like reimplementing logic from core Git here, so I think
it might be best to just call "git rev-parse --show-toplevel" here; it
would also be sufficient to make sure we resolve $core_worktree against
$GIT_DIR - should we be doing that for $env_worktree as well? It looks
like git-rev-parse treats a relative GIT_WORK_TREE as relative to the
current working directory, so we're OK there.
Does anyone know why repository->wc_path() does not obey the config
variable or $GIT_WORK_TREE? It seems like the most correct fix is to
fix it there.
prev parent reply other threads:[~2014-02-21 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAN-m_UmNudmxJnA95h1nYqi7GGxtzKqqpgFHmJZ+MTnxRoEd6g@mail.gmail.com>
[not found] ` <CAN-m_UnQ7Yzuq7n6mxmsd3XcfLSVxMdnLiGFDiN1Ph3ZiFqwew@mail.gmail.com>
2014-02-07 9:15 ` Fwd: Git Directory Diff for submodule Gábor Lipták
2014-02-07 20:38 ` Jens Lehmann
2014-02-10 7:33 ` Gábor Lipták
2014-02-20 21:03 ` Jens Lehmann
2014-02-20 22:41 ` David Aguilar
2014-02-21 9:27 ` John Keeping [this message]
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=20140221092725.GE1048@serenity.lan \
--to=john@keeping.me.uk \
--cc=Jens.Lehmann@web.de \
--cc=davvid@gmail.com \
--cc=gabor.liptak@gmail.com \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/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.