-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues/47 multiple repos #74
base: master
Are you sure you want to change the base?
Conversation
lib/Git.php
Outdated
2 => array('pipe', 'w'), | ||
); | ||
$pipes = array(); | ||
$command = Git::get_bin()." rev-parse --absolute-git-dir"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command --absolute-git-dir was added in git 2.x. RHEL 7 (which is used by most companies that did not move to RHEL8 yet) still ships git 1.8 (yes I know it's so much outdated).
I changed it to --git-dir and it worked well for me. would it be ok to use this one or to have a check on the git version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ochurlaud - --git-dir does not work in my environment, since it is finding a top most .git repo in the directory and not the repo on the nearest parent directory. In my case I have a .git repo in my DokuWiki root directory for this kind of test - and if I use rev-parse --git-dir, then it is ignoring the .git in my data/pages namespace and will get to the top most .git repo in the directory tree. Can you verify this also ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ochurlaud - I have to precise - my answer above was not fully correct. It was based on a test using realpath(<--git-dir result>). This does not work, since --git-dir is behaving different in two cases:
- we are commiting a page in a namespace having a .git path - e.g. nspace1/mypage.txt with nspace1/.git
- in this case --git-dir is providing the relative path ".git"
- we are commiting a page in a sub-namespace - e.g. nspace1/subnspace/mypage.txt
- in this case --git-dir is providing the absolute path "<DOKU_WIKI_ROOT>/data/pages/nspace1/.git
So in case 1. we would have to prepend $path of the git command to the --git-dir result to get the absolute path.
Can you confirm my findings ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's what the got documentation states. I'll propose something to fit both needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ochurlaud - did commit 5e5a67c for using --git-dir. It works so far on my test cases. Please have a look and check.
219b11c
to
17cd8de
Compare
- improvements due to code review: - changed config 'initRepo' -> 'autoDetermineRepos' to leverage self explanation - added missing language description for this config Fixes #47
- fix for auto determining the next parent repo path: - Git.php: - fixed type declaration of $plugin for null initialization - replaced method is_in_git_repo($path) by absolute_git_dir($path) - added method get_repo_path() - editcommit.php: - clear repoWorkDir in case of auto determined repo_path - add --work-tree option only, if repoWorkDir is not empty Fixes #47
- editcommit.php: - streamlined the code of initRepo to improve readability
- editcommit.php: - another simplification of the code - made ->initRepo(...) work for both: a file path name as well as a directory path name
- editcommit.php, Git.php: - fixed issue for non git repo related paths in case of auto determining repos
- editcommit.php: - added a restriction not to use auto determined git repos found in directories above the DokuWiki configured $conf['savedir'].
- Git.php: - in case of auto determined repos: - use git rev-parse --git-dir option rather than --absolute-git-dir to support a maximum range of git versions - function absolute_git_dir($path): - extended the logic to ensure to return an absolute repo_path in any case
- editcommit.php: - improved to be backward compatible with existing single repo path configured installations
- improved description of config settings - set default value to empty string for $conf['repoPath'] and $conf['repoWorkDir'] - changed position of config setting 'autoDetermineRepos' to be listed before 'repoPath'
- improved German description of config settings
17cd8de
to
57bb453
Compare
#47
@ochurlaud - according to your proposal - please use this pull request for commenting your testing results. Many thanks for your efforts!
Please watch my recent commit of today where I added a restriction to limit the auto determination of git repos to the level of the global configured 'savedir'. Probable Git repos above this directory will be ignored.
@woolfg - FYI