Closed danielmarschall closed 1 year ago
@tushev That's odd, because the check for the local installation has nothing to do with network access. I think it fails to check the GIT logs.
Unfortunately, I don't have a GIT working copy at the moment; maybe you can check the following for me:
In includes/classes/OIDplus.class.php:
OIDplus::getVersion()
should detect the install type "git-wc" and then call OIDplus::getGitsvnRevision()
.OIDplus::getGitsvnRevision()
, can you see where the error happens? Does findGitFolder
fail, does git_get_latest_commit_message
fail, or is the string "git-svn-id"
not found in the log message?Thank you for the help.
OIDplus needs to know the latest log message of the latest commit, because the corresponding SVN revision is noted there.
So, my goal in vendor/danielmarschall/php_utils/git_utils.inc.php is to read the log message of the latest commit.
I implemented it this way:
First, it tries to execute the command line $cmd = "git --git-dir=".escapeshellarg("$git_dir")." log -1 2>&1";
If that fails, it will try to parse the binary index and pack files in the .git folder (In 2021, spent days implementing this parser...).
On all my systems, the command line works. To test the binary parser, I have removed the command-line-code to enforce the binary parsing. I have found two major problems:
Problem 1: There seems to be a problem with the detection of version 1 and version 2 index files. It might be just my Raspberry Pi, though, because it has 32-bit PHP. I fixed the issue so the detection for version 2 should work now.
Problem 2: At the moment (on my Raspberry Pi), the latest commit object has the type OFS_REF_DELTA
which is not implemented. Back in 2021, my working copy always had the type OBJ_COMMIT
. Since I have no idea how to implement a delta-parser, I think this problem is not solvable.
@tushev With the latest version of OIDplus, can you please check if the part "command line" (start of method git_get_latest_commit_message
) fails on your side? This would explain the issue.
I have found a way to read deltified objects from the .git
directory, by using the "glip" library which I found fortunately.
So, the new version svn-1192 should be able to detect the git version, even if the command line is not available.
Please verify that it works now. (Though I still wonder why the command line failed on your side?)
Just got my hands on the server.
I updated OIDplus to svn-1193, and yes, it works now. Many thanks, @danielmarschall !
Though I still wonder why the command line failed on your side?
I've sent my update logs in an email.
can you please check if the part "command line" (start of method git_get_latest_commit_message) fails on your side? This would explain the issue.
$cmd = "git --git-dir=".escapeshellarg("$git_dir")." log -1 2>&1";
outputs:git --git-dir='/var/www/html//.git' log -1 2>&1
It seems that git is just unavailable inside php:8.2-fpm, which is actually expected
root@server01:/home/oidplus/www# dcctl bash oidplus fpm
bash [ oidplus ]: /home/oidplus/docker
oidplus@e9d279d34fa1:/var/www/html$ git --git-dir='/var/www/html//.git' log -1
bash: git: command not found
oidplus@e9d279d34fa1:/var/www/html$
Docker images are minimalistic and most 'essential' utilities are missing. So, it's better
Thank you for the update!
The GIT command is one of the very few things where a shell access is required. But with the help of the new GLIP library, we can determine the GIT version without shell access.
Some more changes in re this topic:
svn-rev-1194 fixes the wrong log entry if a version check failed (update version 0 to xyz), config setting "last_known_version".
svn-rev-1195 fixes the double-slash in the OIDplus::findGitFolder()
(not important, but it bothered me).
svn-rev-1196 updated the latest versions of GLIP and php_utils/git_utils.inc.php . Both projects took advantage from each other.
In case the version check would fail again, please don't hesitate re-opening this issue!
@danielmarschall Thank you very much!!
(After update on April 8th:) "The only thing missing is local version on Software update page (it says
Local installation: unknown
)."Originally posted by @tushev in https://github.com/danielmarschall/oidplus/issues/5#issuecomment-1500964480