So I am attempting to create list of modified files between two git commands:
shell_exec("
git diff --name-only $remoteCommitId $localCommitId > diff &&
SET /p DIFF=<diff &&
git archive --output=$zipName HEAD %DIFF%
");
However, no zip file is created I also tried separating commands with &
and ;
. If a run these commands in batch file, everything works.
I am on windows and the reason why I am doing it that way is here.
I just want to create zip file between two git commits via shell_exec
so any other method which works via shell_exec
is also welcome.
Update
If I run these commands directly on console:
git diff --name-only 207b606c270fc14a7161647c2fbe8f9a7d8e05a1 17dcc2233678df4ce86c8713e0349d68e45c3c96 > diff&& SET /p DIFF=<diff&& git archive --output=deployment.zip HEAD %DIFF%
It does create deployment.zip file but problem is that deployment.zip file only contains single root path file in it not ones from other folder (vendor in this case):
Here is diff file:
composer.json
vendor/anlutro/l4-settings/.gitignore
vendor/anlutro/l4-settings/.travis.yml
vendor/anlutro/l4-settings/CONTRIBUTING.md
vendor/anlutro/l4-settings/LICENSE
vendor/anlutro/l4-settings/README.md
vendor/anlutro/l4-settings/composer.json
vendor/anlutro/l4-settings/phpunit.xml
vendor/anlutro/l4-settings/src/ArrayUtil.php
vendor/anlutro/l4-settings/src/DatabaseSettingStore.php
vendor/anlutro/l4-settings/src/Facade.php
vendor/anlutro/l4-settings/src/JsonSettingStore.php
vendor/anlutro/l4-settings/src/MemorySettingStore.php
But deployment.zip file only contains composer.json
file.