Get the list of updated files in the hook after receiving using a separate work tree

I bring out updates for the repo with a "separate work tree" from which Apache maintains its files. Using the post-receive script hook I need a list of modified files to update their permissions, as our suphp requires. However, this does not work. Any ideas why not?

GIT_WORK_TREE=/srv/www/live/ files=`git diff ..FETCH_HEAD --name-only --diff-filter=ACMRTUXB` GIT_WORK_TREE=/srv/www/live/ sudo -u www-run /usr/bin/git checkout -f for file in $files do if [[ $file == *.php ]] then chmod 600 $file else chmod 644 $file fi done 

Content .git / config

 [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true sharedrepository = 1 worktree = /srv/www/live/ [receive] denyNonFastforwards = true denycurrentbranch = ignore 
+4
source share

Source: https://habr.com/ru/post/1438258/


All Articles