diff --git a/README.md b/README.md index 1a34229..88699ab 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,14 @@ git-subsplit can also be installed as a git command by: ./install.sh +Caveats +------- + +There is a known bug in the underlying git-subtree command that this script uses. Your disk will eventually run out of inodes because a cache directory isn't cleaned up after every run. I suggest you to create a cronjob to clean the cache directory every month: + +``` +0 0 1 * * rm -rf /dflydev-git-subsplit-github-webhook/temp/$projectname/.subsplit/.git/subtree-cache/* +``` Hooks ----- @@ -118,7 +126,7 @@ Do not sync any tags. #### --rebuild-tags Ordinarily tags will not be synced more than once. This is because in general -tags should be considered or or less static. +tags should be considered more or less static. If for some reason tags need to be resynced from scratch (history changed so tags might point to somewhere else) this flag will get the job done. @@ -135,6 +143,10 @@ Does not actually publish information to the subsplit repos for each subtree split. Instead, display the command and execute the command with `--dry-run` included. +#### --debug + +Allows you to see the logic behind the scenes. + Not Invented Here ----------------- diff --git a/git-subsplit.sh b/git-subsplit.sh index f1fb257..5c84c3b 100755 --- a/git-subsplit.sh +++ b/git-subsplit.sh @@ -216,11 +216,13 @@ subsplit_publish() fi say " - syncing branch '${HEAD}'" + git checkout master >/dev/null 2>&1 git branch -D "$LOCAL_BRANCH" >/dev/null 2>&1 git branch -D "${LOCAL_BRANCH}-checkout" >/dev/null 2>&1 git checkout -b "${LOCAL_BRANCH}-checkout" "origin/${HEAD}" >/dev/null 2>&1 git subtree split -q --prefix="$SUBPATH" --branch="$LOCAL_BRANCH" "origin/${HEAD}" >/dev/null + RETURNCODE=$? if [ -n "$VERBOSE" ]; then @@ -231,7 +233,7 @@ subsplit_publish() echo "${DEBUG} git subtree split -q --prefix=\"$SUBPATH\" --branch=\"$LOCAL_BRANCH\" \"origin/${HEAD}\" >/dev/null" fi - if [ $? -eq 0 ] + if [ $RETURNCODE -eq 0 ] then PUSH_CMD="git push -q ${DRY_RUN} --force $REMOTE_NAME ${LOCAL_BRANCH}:${HEAD}" @@ -291,6 +293,7 @@ subsplit_publish() say " - subtree split for '${TAG}'" git subtree split -q --annotate="${ANNOTATE}" --prefix="$SUBPATH" --branch="$LOCAL_TAG" "$TAG" >/dev/null + RETURNCODE=$? if [ -n "$VERBOSE" ]; then @@ -298,7 +301,7 @@ subsplit_publish() fi say " - subtree split for '${TAG}' [DONE]" - if [ $? -eq 0 ] + if [ $RETURNCODE -eq 0 ] then PUSH_CMD="git push -q ${DRY_RUN} --force ${REMOTE_NAME} ${LOCAL_TAG}:refs/tags/${TAG}" @@ -327,14 +330,12 @@ subsplit_update() say "Updating subsplit from origin" - git fetch -q origin git fetch -q -t origin git checkout master git reset --hard origin/master if [ -n "$VERBOSE" ]; then - echo "${DEBUG} git fetch -q origin" echo "${DEBUG} git fetch -q -t origin" echo "${DEBUG} git checkout master" echo "${DEBUG} git reset --hard origin/master"