I need to get a list of changed files in server-side hook. Example:
Local commit 1:
M test.txt
M test2.txt
Local commit 2:
M test.txt
A test3.txt
Both commits get pushed to the server (bare repo). I need to loop through the list of files AND post each of them through curl elsewhere:
M test.txt
M test2.txt
A test3.txt
I'm struggling to find the documentation to achieve this. I know the revisions are spit out to stdin. How do I actually loop through the pushed files, and reference them for a curl upload (this seems difficult since it's a bare repo)?
#!/bin/bash
while read oldrev newrev refname; do
echo $oldrev
echo $newrev
echo $refname
done < "${1:-/dev/stdin}"
git show
orgit cat-file
? – Proulx