Skip to content

Add support for custom location of .git directory - #459

Merged
Landerstraeten merged 2 commits into
phpro:masterfrom
pascal-hofmann:support_non_default_.git_location
Mar 30, 2018
Merged

Landerstraeten merged 2 commits into
phpro:masterfrom
pascal-hofmann:support_non_default_.git_location

Conversation

@pascal-hofmann

Copy link
Copy Markdown
Contributor
Q A
Branch master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Documented? no
Fixed tickets -

git supports using a custom path for the .git directory. When used, .git is a file containing gitdir: <path> to point at the real directory.

Currently grumphp does not support this, because the path used to install the git hooks is incorrect (there obviously can't be a .git/hooks in this case). This also can't be worked around with the config param git-dir (which by the way is badly named) because the path used will always end with .git/hooks, but the custom directory may be named differently (not .git).

This PR adds support for custom repository paths by reading .git if it's a file and using the path contained.

@SerkanYildiz

SerkanYildiz commented Feb 2, 2018 •

Copy link
Copy Markdown
Contributor

PS: your git email is not correctly configured in your working dir, git didn't recognize your authorship (see cat avatar on your commit)

@pascal-hofmann
pascal-hofmann force-pushed the support_non_default_.git_location branch from 64c223d to ac724c2 Compare February 2, 2018 14:37
@pascal-hofmann

Copy link
Copy Markdown
Contributor Author

@SerkanYildiz Thanks for pointing that out. Fixed.

@veewee

veewee commented Feb 7, 2018

Copy link
Copy Markdown
Contributor

Hi @pascal-hofmann,

Thanks for the PR!

Didn't know people actually used custom git paths. The configuration option was mostly introduced for installations in which the source code is not in the git base folder but one or more directories underneath. That is why the naming is a bit confusing.

I'll have to play around with this PR to make sure everything works. This will take me some time.

@pascal-hofmann

Copy link
Copy Markdown
Contributor Author

Can be reproduced like this (tested using git version 2.15.1):

mkdir -p issue459/sub
cd issue459/sub
composer require --dev phpro/grumphp
ls -l
git init
git add composer.json composer.lock grumphp.yml
git commit -m 'Added grumphp'
cd ../
mkdir main
cd main/
git init
git submodule add ../sub/
cd sub/
cat .git
composer install

@pascal-hofmann

Copy link
Copy Markdown
Contributor Author

This PR has now been open for 4 weeks. How can I help to get this merged?

@ddebasilio

Copy link
Copy Markdown

This is happening to me too. Could this get merged?

@Landerstraeten
Landerstraeten force-pushed the support_non_default_.git_location branch from ac724c2 to 548f480 Compare March 30, 2018 09:28
@Landerstraeten
Landerstraeten merged commit a54be73 into phpro:master Mar 30, 2018
@Landerstraeten

Landerstraeten commented Mar 30, 2018 •

Copy link
Copy Markdown
Contributor

Thank you @pascal-hofmann!

@veewee veewee added this to the Version 0.14.1 milestone Mar 30, 2018
@pascalhofmann

Copy link
Copy Markdown

Thanks for merging! 👍

@pascal-hofmann
pascal-hofmann deleted the support_non_default_.git_location branch April 3, 2018 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants