this is in some cases screwed up:

Project drupal (7.0) downloaded to /home/xl/workspace/drugit-test/drupal-7.0. [107.35 sec, 5.73 MB] [success]
Calling chdir(/home/xl/workspace/drugit-test)
Executing: git rev-parse --git-dir
.git
Calling chdir(/home/xl/workspace/drugit-test)
Calling chdir(.)
Executing: git submodule add git://git.drupal.org/project-stable/drupal.git ome/xl/workspace/drugit-test/drupal-7.0
Initialized empty Git repository in /home/xl/workspace/drugit-test/ome/xl/workspace/drugit-test/drupal-7.0/.git/

Comments

geek-merlin’s picture

StatusFileSize
new1.05 KB

patch in the air.

geek-merlin’s picture

Status: Active » Needs review
moshe weitzman’s picture

Assigned: Unassigned » jonhattan
jonhattan’s picture

@axel.rutz post the command you're running and the complete sequence. I need to figure out what's going on.

Also note you're generating patches in a way that `patch` command don't work AFAIK. I was able to apply it with `git apply`

geek-merlin’s picture

oh thank you for your comment!

as for the patch: sorry, i am a bit git centered - memo to me: figure out the git-format-patch option to play fine with the patch command.
(i think it's just about removing the mail headers in the patch file)

and yes, i was quite unthorough in my report:
what happens:
* git rev-parse --git-dir spits out a relative path
* the script expects an absolute path to calc the git-submodule-add parameters
* so the submodule is not added correctly (second arg wrong, missing in this case)

inserting "realpath" in the right place solves that.

jonhattan’s picture

So I figured out you're preforming

jonhattan@jengibre:/var/www$ git init drugit
Initialized empty Git repository in /var/www/drugit/.git/
jonhattan@jengibre:/var/www$ cd drugit/
jonhattan@jengibre:/var/www/drugit$ drush dl --package-handler=git_drupalorg --gitsubmodule drupal --debug

The git_drupalorg package-handler is almost able to do this by accident: the intention for --gitsubmodule is to add drupal projects as submodules to the cloned drupal codebase. Performing the above usecase should be part of a vcs integration, not a package-handler thing. So I'm declined to fix this the other way by marking --gitsubmodule as an invalid option when the project to clone is drupal. Note also that with the fix in #1 we have this probably undesirable scenario:

jonhattan@jengibre:/var/www$ git init drugit
Initialized empty Git repository in /var/www/drugit/.git/
jonhattan@jengibre:/var/www$ cd drugit/
jonhattan@jengibre:/var/www/drugit$ drush dl --package-handler=git_drupalorg --gitsubmodule drupal
jonhattan@jengibre:/var/www/drugit$ cd drupal-7.0/
jonhattan@jengibre:/var/www/drugit/drupal-7.0$ drush dl --package-handler=git_drupalorg --gitsubmodule devel
jonhattan@jengibre:/var/www/drugit/drupal-7.0$ cd ..
jonhattan@jengibre:/var/www/drugit$ git submodule status
 5b7531ce4f317ab922e299f579ab574e934da01c drupal-7.0 (7.0)
jonhattan@jengibre:/var/www/drugit$ cd drupal-7.0/
jonhattan@jengibre:/var/www/drugit/drupal-7.0$ git submodule status
 4f93512dd69beb334dcf009d9a56db05af680832 sites/all/modules/devel (7.x-1.0)

What do think maintainers and git-trained folks?

geek-merlin’s picture

StatusFileSize
new1.32 KB

i'm not so sure we're on the same construction area - i'll elaborate:

[xl@master:~/workspace/drupal.drugit/content{master}]$ git rev-parse --git-dir
.git
[xl@master:~/workspace/drupal.drugit/content{master}]$ cd sites
[xl@master:~/workspace/drupal.drugit/content/sites{master}]$ git rev-parse --git-dir
/home/xl/workspace/drupal.drugit/content/.git

the problem arises when the output is NOT an absolute path (first case)
which showed ma that i had to fix my fix, see attached.

ps:
as for "drupal core as submodule" - this is my main use case, i'm heavily working on this and show you soon.
but that's another issue and will be told another time.

jonhattan’s picture

StatusFileSize
new1.19 KB

I also hit what you explicit in #7 but didn't elaborate because if we supress --gitsubmodule when the project is drupal we avoid this case. Anyway I also found an alternative solution :)

jonhattan@jengibre:/var/www/drugit/drupal-7.0$ git rev-parse --show-toplevel
/var/www/drugit/drupal-7.0
jonhattan@jengibre:/var/www/drugit/drupal-7.0$ cd sites/
jonhattan@jengibre:/var/www/drugit/drupal-7.0/sites$ git rev-parse --show-toplevel
/var/www/drugit/drupal-7.0
geek-merlin’s picture

yours is so much sexier!
worksforme.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

if it works for you two, then in it goes.

jonhattan’s picture

Title: git_drupalorg handler submodule creation bug » git_drupalorg handler submodule creation bug when the project is drupal
Status: Reviewed & tested by the community » Fixed

So commited.

jonhattan’s picture

Version: » All-versions-4.x-dev
Assigned: jonhattan » msonnabaum
Status: Fixed » Patch (to be ported)
msonnabaum’s picture

Status: Patch (to be ported) » Closed (fixed)