dokuwiki-plugin-gitbacked icon indicating copy to clipboard operation
dokuwiki-plugin-gitbacked copied to clipboard

Extra info for usability if setting custom repoPath and repoWorkDir

Open imrehg opened this issue 2 years ago • 2 comments

I've followed the setup as described in the suggestions. Now however all the content changes seem to happen in repoPath, rather than repoWorkDir, and thus I end up with ever single page created in the root of the repo, committed, DocuWiki moving the page to the right folder, and I end up with the files showing up as deleted...

The configuration:

# local.php content
# [..snip...]
$conf['plugin']['gitbacked']['repoPath'] = './data/gitrepo';
$conf['plugin']['gitbacked']['repoWorkDir'] = './data/gitrepo/wiki';
$conf['datadir'] = './data/gitrepo/wiki/pages';
$conf['mediadir'] = './data/gitrepo/wiki/media';

The git status as shows now:

/srv/web/wiki/data/gitrepo$ git status
On branch main
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    media/elle_liang-287.jpg
        deleted:    pages/start.txt
        deleted:    pages/test.txt
        deleted:    pages/test2.txt

The last commit:

/srv/web/wikidata/gitrepo$ git show
commit 309223a6e71b85339a8ba03870da9dc5825b5829 (HEAD -> main)
Author: Gergely Imreh <[email protected]>
Date:   Wed Mar 30 02:24:31 2022 +0000

    Wiki page test2 changed with summary [] by Gergely Imreh

diff --git a/pages/test2.txt b/pages/test2.txt
new file mode 100644
index 0000000..579c911
--- /dev/null
+++ b/pages/test2.txt
@@ -0,0 +1 @@
+Once more
\ No newline at end of file

which shoes that it indeed put the file file not in wiki/pages within the repo as expected just in pages, while the final location after DokuWiki is done with things is in the correct place:

/srv/web/lifewiki.imreh.net/data/gitrepo$ ls -la wiki/pages/
[..snip...]
-rw-r--r-- 1 www-data www-data    9 Mar 30 02:24 test2.txt

The installed version of the plugin is 2022-02-06.

Am I missing anything, or any problem with the configuration?

imrehg avatar Mar 30 '22 02:03 imrehg

A small lightbulb moment. Following the source code, maybe my problem problem is that given the settings, i cannot just do git status, rather have to always apply the correct --work-tree setting as well (the same way the code does), such as:

git --work-tree wiki status

which will give the expected results, expected changed/updated files, etc.

Though then does the user guide miss one aspect, currently? It says:

The plugin creates a new repository in the specified repoPath, if needed. If you want to use an existing git repository, clone the repository to e.g. /tmp/yourrepo. Subsequently, copy all data (don't forget the .git folder) from /tmp/yourrepo to ./data/gitrepo,

but shouldn't it be something like

The plugin creates a new repository in the specified repoPath, if needed. If you want to use an existing git repository, clone the repository to e.g. /tmp/yourrepo. Subsequently, copy your .git folder from /tmp/yourrepo to ./data/gitrepo, and the contents of the repo (the media and pages folders) into repoWorkDir (such a ./data/gitrepo/wiki if following the suggested folder structure).

imrehg avatar Mar 30 '22 03:03 imrehg

gitrepo contains the git repo (and .git folder), the repoWorkDir just defines where inside the repo the dokuwiki pages should be saved. For example if you want to store doc files in your repo which also contains code, you would store it in the folder docs as your source code is also in the repo. So this setting is mainly to be able to use a subfolder inside a repo to store all dokuwiki data.

woolfg avatar Mar 30 '22 14:03 woolfg