-
Notifications
You must be signed in to change notification settings - Fork 45
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
Empty files on server when deploying to server for the first time #73
Comments
I fixed the problem by modifying the following line in the file Git.php at line: 85. old line: new line: I'm using git-deploy-php from a folder different from the root folder of the project, maybe this is the real problem. |
Did you rebuild git-deploy afterward, by the way? I use git-deploy from its repo folder daily so I'm not sure what could be going on here (I've got a "deploy [folder name]" command that I use that calls git-deploy with the right arguments). I'm glad you were able to fix it. I'm currently working on a test suite for git-deploy so that I can change things without being afraid of breaking stuff - right now I don't know if adding that "./" would ruin things for those of us that don't have that problem, so I'm going to have to have a look at this issue once we've got the test suite up and running. |
Hi Bruno! I have rebuilt everything several times because I put different traces until I found the problem. In the last traces I got:
Running same command from terminal:
And that's why I added the "./" so that now the code is: } Else {
foreach ($ result as $ file) {
if (! in_array ($ file, $ submodule_paths)) {
Helpers :: LogMessage ( "get_file_contents:" "$ target_commit: $ file.");
$ Return [ 'upload'] [$ file] = $ this-> get_file_contents ( "$ target_commit: ./$ file");
}
}
}
return $ return;
}
get_file_contents protected function ($ path) {
$ Temp = tempnam (sys_get_temp_dir (), "git-deploy-");
$ This-> exec ( 'show' '$ path..' " '"> \ "$ Temp \" ");
return file_get_contents ($ temp);
}
protected function exec ($ command, $ suffix = "") {
if (chdir ($ this-> repo_path)) {
$ Console = trim (shell_exec (self :: $ git_executable_path "2> & 1" $ suffix). "$ Command...");
Helpers :: LogMessage ( "trim (sell_exec ())");
Helpers :: LogMessage (self :: $ git_executable_path "2> & 1" $ suffix. "$ Command...");
return $ console;
} Else {
Helpers :: error ( "Unable to access the git repository's folder.");
}
} Are you going to release a version with deploy[folder name] funcionality? I'll use my modified fork (I've to clean the traces on the code previously) by'll now pending possible changes. I am also automating tests in my project using simpletest and Travis CI, my idea is to also use git-deploy for the deploy through Travis CI. Thanks a lot! |
Hi Bruno, Some news: When I run diff command inside the folder where I have the files to deploy , the path in each line is the absolute path of the repo. Meanwhile when I run ls-files, the path in each line haven't the root folder, is relative path. Moreover, when I run git diff without --relative, this command includes all files with differences in the repo. For this reason at the end I've made 3 changes on the code in Git.php: Git.php Line 46 old: $command = "diff --no-renames --name-status {$current_commit} {$target_commit}"; Git.php Line 46 new: $command = "diff --no-renames --name-status --relative {$current_commit} {$target_commit}"; Git.php Line 71 old: $return['upload'][$path] = $this->get_file_contents("$target_commit:\"$path\""); Git.php Line 71 new: $return['upload'][$path] = $this->get_file_contents("$target_commit:./\"$path\""); Git.php Line 85 old: $return['upload'][$file] = $this->get_file_contents("$target_commit:$file"); Git.php Line 85 new: $return['upload'][$file] = $this->get_file_contents("$target_commit:./$file"); (Note the difference between |
I ran the script after configuring the ini files. It made empty files on the server. All the files were just empty. (Maybe related with #48)
I've check file size with this code and all files have >0 bytes:
Helpers::logmessage("File: " . $file . ' size: ' . filesize($file) . ' bytes');
Files PREVIOUS_REVISION and REVISION are succesfully created, both with 40 bytes size.
Thanks a lot!
git version 2.7.4
PHP 5.6.25-1+deb.sury.org~xenial+1 (cli)
Linux Mint 18 Sarah (GNU/Linux 4.4.0-21-generic x86_64)
The text was updated successfully, but these errors were encountered: