Bug 95177 - check-webkit-style fails when WebKit is in a Git submodule
Summary: check-webkit-style fails when WebKit is in a Git submodule
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-28 00:55 PDT by Kevin Funk
Modified: 2012-08-29 15:47 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.07 KB, patch)
2012-08-28 01:03 PDT, Kevin Funk
abarth: review-
Details | Formatted Diff | Diff
Patch v2 (1.97 KB, patch)
2012-08-29 07:35 PDT, Kevin Funk
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Funk 2012-08-28 00:55:34 PDT
The problem is in /Tools/Scripts/webkitpy/common/checkout/scm/git.py, function find_checkout_root().

If WebKit is checked out using git submodules, git.py identifies "$WEBKIT_SUBMODULE\..\.git\modules" as the checkout root, which is wrong.

===
Example (here: Qt5 repository layout):
qt5
- qtbase (submodule)
- ...
- qtwebkit (submodule)

Issue: find_checkout_root() then returns "qt5/.git/modules" as the checkout root (wrong!).
===

Patch following.
Comment 1 Kevin Funk 2012-08-28 01:03:17 PDT
Created attachment 160925 [details]
Patch
Comment 2 Adam Barth 2012-08-28 08:16:33 PDT
Comment on attachment 160925 [details]
Patch

We need to use self._filesystem, not os.path so that this code will work properly in unit tests.
Comment 3 Kevin Funk 2012-08-28 08:43:28 PDT
Okay. Would you accept the patch if I am re-adding the two lines with the self._filesystem* calls?
Comment 4 Adam Barth 2012-08-28 08:55:12 PDT
I would either need to ask a git expert or read the documentation about the difference between those two flags.  We would like to fix this bug, and I'm willing to believe you're doing it the right way.  I just need to check.  :)

Also, please be sure to run ./Tools/Scripts/test-webkitpy.  Ideally, you'd also add a test to make sure we don't regress this bug.
Comment 5 Simon Hausmann 2012-08-28 10:06:07 PDT
I think using --show-toplevel is indeed better than using --git-dir and then trying to parse away the .git portion of the path.
Comment 6 Adam Barth 2012-08-28 10:11:18 PDT
Thanks.  Ok, so it sounds like we just need to go through self._filesystem.
Comment 7 Kevin Funk 2012-08-29 07:35:33 PDT
Created attachment 161224 [details]
Patch v2
Comment 8 Dirk Pranke 2012-08-29 09:43:35 PDT
Interesting. It does look like --show-toplevel is a better thing to use, but from the documentation, it sounds like --git-dir is supposed to be returning path-to/.git and we're getting path-to/.git/modules instead. Is this a git bug?
Comment 9 Kevin Funk 2012-08-29 11:38:04 PDT
Just checked again: In Qt5's qtwebkit submodule there is a *file* named ".git" which breaks the assumed behaviour. Reading out the file yields:

$ cat qtwebkit/.git
gitdir: ../.git/modules/qtwebkit

So git rev-parse --git-dir within qtwebkit will refer to "../.git/modules/qtwebkit" (hard-coded).

I am not entirely sure, but I think the reason for doing this is to share the Git history between several submodules (there are at least "qtwebkit" and "qtwebkit1" registered as submodules).

So, Dirk, you are probably right. In normal cases --git-dir works fine, but not with that "separate-git-dir" feature used within qtwebkit.

Reference: http://www.kernel.org/pub/software/scm/git/docs/git-init.html - '--separate-git-dir'
Comment 10 Dirk Pranke 2012-08-29 11:43:30 PDT
interesting. I could believe separate-git-dir might confuse things. I'll have to play around with it a bit more.
Comment 11 WebKit Review Bot 2012-08-29 15:47:21 PDT
Comment on attachment 161224 [details]
Patch v2

Clearing flags on attachment: 161224

Committed r127059: <http://trac.webkit.org/changeset/127059>
Comment 12 WebKit Review Bot 2012-08-29 15:47:24 PDT
All reviewed patches have been landed.  Closing bug.