init.sh: record the HEADs of each subproject in the initialization commit log

This commit is contained in:
Zihao Yu
2017-08-23 22:41:17 +08:00
parent d53485895c
commit bfdc521994

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
log=""
function init() { function init() {
if test -d $1; then if test -d $1; then
echo "$1 is already initialized, exiting..." echo "$1 is already initialized, exiting..."
@ -7,6 +9,7 @@ function init() {
fi fi
git clone -b ics2017 https://github.com/NJU-ProjectN/$1.git git clone -b ics2017 https://github.com/NJU-ProjectN/$1.git
log="$log$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
rm -rf $1/.git rm -rf $1/.git
if test $2; then if test $2; then
@ -25,7 +28,7 @@ case $input in
source ~/.bashrc source ~/.bashrc
git add -A git add -A
git commit -am "ics2017 initialized" git commit -am "ics2017 initialized"$'\n\n'"$log"
echo "Initialization finishes!" echo "Initialization finishes!"
;; ;;