mricon/grokmirror — pull request #13 by kscherer (2014-01-10 17:13:08+00:00)
Title: Add param for manifest file permissions

If pushes to git server use ssh, the post-receive git hook that executes grok-manifest will run as the user doing the push. Since the permissions default to 644, that user may not be able to write the manifest.js.gz file.

The patch was tested using the following script. If there is a better way to do the tests, please let me know.

#!/bin/bash
set -x

grok_manifest=$HOME/repos/grokmirror/grok-manifest.py
top=$PWD
rm -rf test
mkdir test
cd test
git init repo1
cd repo1
touch a
git add a
git commit -m "Commit #1"
cd ..
mkdir git
cd git
git clone --bare ../repo1 bare1

cd $top

$grok_manifest -m $top/manifest.js.gz -t $top/git --use-now -v $top/test/git/bare1/
ls -al $top/manifest.js.gz

$grok_manifest -m $top/manifest.js.gz --manifest-permissions=0664 -t $top/git --use-now -v $top/test/git/bare1/
ls -al $top/manifest.js.gz

$grok_manifest -m $top/manifest.js.gz --manifest-permissions=0666 -t $top/git --use-now -v $top/test/git/bare1/
ls -al $top/manifest.js.gz

$grok_manifest -m $top/manifest.js.gz --manifest-permissions=0669 -t $top/git --use-now -v $top/test/git/bare1/