update mkdocs
authorNiki Roo <niki@nikiroo.be>
Wed, 3 Jul 2024 13:27:52 +0000 (15:27 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 3 Jul 2024 13:27:52 +0000 (15:27 +0200)
git.md
mkdocs/site
mkdocs/update.sh

diff --git a/git.md b/git.md
index f5bda7549620f758d0bec894306443061e0dd86e..ca262820bd35e7ecb47c4f46275e3c5a421438c8 100644 (file)
--- a/git.md
+++ b/git.md
@@ -1,50 +1,62 @@
 # Git
 
 Set upstream:
+
 * `git push --set-upstream remote_name local_branch`
 * `git pull --set-upstream remote_name local_branch`
 
 Delete branch:
+
 * `git branch -d xxx`
 * `git branch -D xxx` (force delete)
 * `git push MY_REMOTE --delete XXX`
 * `git push MY_REMOTE :XXX` (identical to above)
 
-Move branch
+Move branch:
+
 * `git checkout OLD_NAME`
 * `git branch -m NEW_NAME`
 
 
 Active branch in a bare repository:
+
 * see `repo/HEAD` (and change it if needed)
 
 Create a new branch and switch to it:
+
 * `git checkout -b BRANCH`
 
 Merge unrelated repositories:
+
 * `git pull ../other/ master --allow-unrelated-histories --no-rebase`
 
 ## Submodules
 
 At start:
+
 * `git clone XXX --recurse-submodules`
 
 At new one:
+
 * git submodule add https://github.com/... path
 * `./` is allowed, `.` is not *but only on remote paths, not local paths*
 * `../other-prj.git` is also allowed
 
 Manually:
+
 * git submodule init
 * git submodule update (--recursive)
 
 Or in one command:
+
 * git submodule update --init (--recursive)
 
 If problems:
+
 * git submodule deinit (--all)
 
 If head detached:
+
 * `git branch -u <origin>/<branch> <branch>`
 * `git checkout -b <branch> --track <origin>/<branch>`
 
index 222a2306973db10bc76ff67f16fb1f6a44832a1f..51b84c72be735fd8efcb880b1af1e9aac4ac4dc8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 222a2306973db10bc76ff67f16fb1f6a44832a1f
+Subproject commit 51b84c72be735fd8efcb880b1af1e9aac4ac4dc8
index a28c1e6368ae59006693e286bcf7937700bf4e8c..a4a6aa7beecda815c30967f4e0b69a694fa7f7d9 100755 (executable)
@@ -4,9 +4,14 @@ DDIR=/home/user/Notes
 
 if [ "$1" = "" ]; then
        # Host
-       cd "`dirname "$0"`" || exit 42
+       cd "`dirname "$0"`"
+       if [ $? != 0 ]; then
+               echo Cannot find directory \
+                       | tee mkdocs/error.txt >&2
+               exit 42
+       fi
        cd ..
-       rm -f mkdocs/ok
+       rm -f mkdocs/ok mkdocs/error.txt
        touch mkdocs/wip
        OPTS="-v $PWD:$DDIR:rw" /opt/docker/launch.sh \
                --start $DDIR/mkdocs/update.sh mkdocs \
@@ -20,21 +25,26 @@ if [ "$1" = "" ]; then
                cd mkdocs/site
                git add .
                if [ $? != 0 ]; then
-                       echo Failure to add newly built html site >&2
+                       echo Failure to add newly built html site \
+                               | tee mkdocs/error.txt >&2
                        exit 20
                fi
                git commit -m "`date +"Auto commit %Y-%m-%d %H:%M"`"
                if [ $? != 0 ]; then
-                       echo Failure to commit to git >&2
+                       echo Failure to commit to git \
+                               | tee mkdocs/error.txt >&2
                        exit 21
                fi
                git push nikiroo html
                if [ $? != 0 ]; then
-                       echo Failure to push html branch to nikiroo >&2
+                       echo Failure to push html branch to nikiroo \
+                               | tee mkdocs/error.txt >&2
                        exit 22
                fi
+               cd - >/dev/null
        else
-               echo Failed to update, no remote copy started: $rep >&2
+               echo Failed to update, no remote copy started: $rep \
+                               | tee mkdocs/error.txt >&2
        fi
        rm -f mkdocs/wip
        exit $rep
@@ -49,5 +59,6 @@ cd
 cp "$DDIR/mkdocs/mkdocs.yml" "$HOME/" || exit
 ln -s "$DDIR" docs || exit
 mkdocs build -d "$DDIR"/mkdocs/site || exit
+rm -rf "$DDIR"/mkdocs/site/mkdocs || exit
 touch "$DDIR/mkdocs/ok"