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.
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.
@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.
@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.
Yes it's what the got documentation states. I'll propose something to fit both needs.
There was a problem hiding this comment.
@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
17cd8de to
57bb453
Compare
6ecab80 to
d36deb0
Compare
commit 6ecab80 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Mon Feb 2 01:05:54 2026 +0100 Re-base branch to current master - add missing files - align GH actions - align *.md files - align plugin.info.txt commit 52c67e4 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Mon Feb 2 00:29:24 2026 +0100 Re-base branch to current master commit 99861f0 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Mon Feb 2 00:41:40 2026 +0100 Re-base branch to current master - split GitRepo.php from Git.php, no code changes commit 31ed615 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Mon Feb 2 00:31:09 2026 +0100 Re-base branch to current master - move lib -> classes, no code changes commit 57bb453 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Fri May 6 01:52:59 2022 +0200 Allow using several git repos - improved German description of config settings commit d2a66e7 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Fri May 6 01:22:29 2022 +0200 Allow using several git repos - 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' commit 8e783f4 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Fri May 6 01:17:30 2022 +0200 Allow using several git repos - editcommit.php: - improved to be backward compatible with existing single repo path configured installations commit ee6827c Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Sun Mar 20 17:12:11 2022 +0100 Allow using several git repos - 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 commit ff5ae89 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Sat Mar 19 22:34:17 2022 +0100 Allow using several git repos - editcommit.php: - added a restriction not to use auto determined git repos found in directories above the DokuWiki configured $conf['savedir']. commit dbee1e7 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Fri Feb 11 15:24:25 2022 +0100 Allow using several git repos - editcommit.php, Git.php: - fixed issue for non git repo related paths in case of auto determining repos commit 718bdcd Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Thu Feb 10 01:23:29 2022 +0100 Allow using several git repos - editcommit.php: - another simplification of the code - made ->initRepo(...) work for both: a file path name as well as a directory path name commit 634ce79 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Tue Feb 8 23:16:30 2022 +0100 Allow using several git repos - editcommit.php: - streamlined the code of initRepo to improve readability commit 5e54101 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Tue Feb 8 20:11:59 2022 +0100 Allow using several git repos - 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 commit 8be0bb0 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Sun Feb 6 00:47:37 2022 +0100 Allow using several git repos - improvements due to code review: - changed config 'initRepo' -> 'autoDetermineRepos' to leverage self explanation - added missing language description for this config Fixes #47 commit 8574d38 Author: Markus Hoffrogge <mhoffrogge@gmail.com> Date: Sun Feb 6 00:00:09 2022 +0100 Fix editcommit.php line 56: missing variable assignment commit d3a61cd Author: Olivier Churlaud <olivier.churlaud@cnes.fr> Date: Thu Jan 13 17:39:18 2022 +0100 Allow using several git repos Fixes #47
d36deb0 to
e2bc846
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