Closed sebastiaanluca closed 3 years ago
Are you using Envoyer?
Custom Forge deploy script, but it'd be the same IMO.
Among other steps, we:
../../storage
(but using a full root path)artisan storage:link
to symlink other directoriesThe git:commit
command works fine if we don't use paths that are in the symlinked directory. We moved it to resources/forms/submissions
for now and that works, but it's not ideal. An alternative would be to not commit directories in symlinked directories, but we need to commit that data.
Ah gotcha - we used Envoyer and it go rid of the .git directory upon deploy so wondered if that was the same for you.
But obviously not π
Hey @sebastiaanluca, are you committing your form submissions to a separate repo, or is the intent to symlink and commit them into your main app repo?
The reason I ask is that I've fixed the error you mention in #4062, but git doesn't seem to allow the tracking and committing of symlinked content through soft symlinks. Instead, git stores the properties of the link (i.e., the path of the file system) in a blob just like it would for a normal file, rather than the Statamic content you change on the other end of the symlink. You can read more on how git deals with symlinks here: http://tdongsi.github.io/blog/2016/02/20/symlinks-in-git/
@jesseleite Same repository. So we deploy the master branch, keep .git around, and when changes occur we commit and push back to master using php please git:commit
.
git doesn't seem to allow the tracking and committing of symlinked content through soft symlinks
Apparently not π Thanks for the link. Never had any issues with such a setup, but perhaps I've never set it up in such a way. We'll keep the content we want to push back to our repository outside of the symlink then.
I do however think the cause of the error message is unrelated to git. It happens before anything git does. Basically it tries to find a .git folder in the current and parent directories of a symlinked storage folder
. The commit command can read the symlinked directory and tries to do its job, but it doesn't anticipate a symlinked directory that outside of the current project directory. It anticipates it's still in the project directory that has a .git directory.
That's something you might or might not want to fix/handle since it's a bit of an edge case. E.g. throw an exception or just ignore the directory if it's (a symlink) outside of the project dir (before git tries to do something). I'll close this since git doesn't support committing contents inside symlinks.
Thanks!
@sebastiaanluca Thanks for following up!
I do however think the cause of the error message is unrelated to git. It happens before anything git does.
100% agree, see https://github.com/statamic/cms/pull/4062 π
Awesome, thanks!
Bug Description
We seem to have an issue related to this bug and fix (although not sure): https://github.com/statamic/cms/pull/3829
After some debugging we've found that it tries to find a
.git
folder in the current and parent directories of a symlinked storage folder. But since that storage directory is outside of the release directory, which contains.git.
, it can't find it and the command (git commit and push) fails.Works fine when we remove the directory or don't use a symlink.
How to Reproduce
With the following directory structure on a DO/Forge server:
and inside
current
or the current release:And a
config/statamic/git.php
config:When committing using
php please git:commit
or any other interaction, it outputs:Extra Detail
Debugging this, we found the issue is
storage_path('forms')
.Getting the return value of
\Statamic\Git\Git::groupTrackedContentPathsByRepo()
on production using Tinker, we get:Environment
Statamic 3.1.9 Pro Laravel 8.34.0 PHP 8.0.5 No addons installed
Install method (choose one): either starter kit or fresh install, not sure