-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgit2historage.sh
executable file
·43 lines (33 loc) · 1 KB
/
git2historage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
if [ ! -f ./conf ]; then
echo "[ERR] Cannot find ./conf"
exit
fi
source ./conf
GIT_TMP=$TMP_DIR/Historage.tmp
ELSE_DIR=$TMP_DIR/Historage.else
GINDEX=$ELSE_DIR/index
HERE=$(pwd)
MASU_DIR=$HERE/extractor
PERL_DIR=$HERE/perl
MASU_PATH=$MASU_DIR/bin/:$MASU_DIR/lib/antlr.jar:$MASU_DIR/lib/asm-all-3.3.jar:$MASU_DIR/lib/commons-cli-1.1.jar
rm -rf $GIT_TMP $ELSE_DIR $HISTORAGE_REPOSITORY
mkdir $TMP_DIR $ELSE_DIR
echo '[1] cloning to tmporal repository...'
git clone file://$GIT_REPOSITORY $GIT_TMP
echo '[2] reconstructing...'
cd $GIT_TMP
git rev-list \
--reverse --topo-order --default HEAD \
--simplify-merges $rev_args \
> $ELSE_DIR/coms
git filter-branch \
--env-filter "GIT_INDEX_FILE=$GINDEX; export GIT_INDEX_FILE" \
--index-filter "$HERE"'/filter/filter_index.sh'" $ELSE_DIR $GIT_TMP $MASU_DIR $PERL_DIR $MASU_PATH" \
--prune-empty \
--tag-name-filter cat
cd -
echo '[3] finishing...'
git clone file://$GIT_TMP $HISTORAGE_REPOSITORY
rm -rf $GIT_TMP $TMP_DIR
exit 0