└── git2feed.sh
/git2feed.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # this code was provided by sixcooler
4 | # the source is hosted at https://gitorious.org/git2feed/git2feed
5 | # this script like it is related to YaCy, but it could be generic as well
6 | # please help to make this a great git tool!
7 |
8 | # preparation of this script:
9 | # cd ..
10 | # mkdir yacy_rc1
11 | # cd yacy_rc1
12 | # git init
13 | # git remote add origin git://gitorious.org/yacy/rc1.git
14 | # git pull origin master
15 | # cd ../git2feed
16 |
17 | # finally call this script (from here) with
18 | # git2feed.sh ../yacy_rc1 .
19 |
20 | cd $1
21 | git pull origin master
22 | cd -
23 |
24 | gitDir=$1/.git
25 | outDir=$2
26 | declare -i counter
27 | counter=30
28 | now=`date -R`
29 |
30 | feed="
31 |
32 |
33 | YaCy commit-feed
34 | Git commits to YaCy
35 | http://www.yacy.net/
36 | $now
37 | $now"
38 | feedEnd=""
39 |
40 | if [ ! -d "$gitDir" ] || [ ! -d "$outDir" ]
41 | then
42 | echo usage: $0 git-directory output-directory
43 | exit 1
44 | fi
45 |
46 | for commit in $( git --git-dir=$gitDir log --pretty=format:%H ); do
47 | outFile="$outDir/$commit.txt"
48 | title=`git --git-dir=$gitDir show -s --pretty=format:"%h from %aN" $commit`
49 | description=`git --git-dir=$gitDir show -s --pretty=format:"%s" $commit`
50 | author=`git --git-dir=$gitDir show -s --pretty=format:"%aN, %aE" $commit`
51 | pubDate=`git --git-dir=$gitDir show -s --pretty=format:"%aD" $commit`
52 | feed+="-
53 | $title
54 | $description
55 | $commit.txt
56 | $author
57 | $commit
58 | $pubDate
59 |
"
60 | if [ ! -f "$outFile" ]
61 | then
62 | git --git-dir=$gitDir show $commit >"$outFile"
63 | fi
64 | let counter-=1
65 | if [ $counter -lt 1 ]
66 | then
67 | feed+="$feedEnd"
68 | echo $feed >"$outDir/shortlog.xml"
69 | exit 0
70 | fi
71 | done
72 |
--------------------------------------------------------------------------------