#!/bin/sh
-. "${_EXEC}/themes/default.sh"
. "${_EXEC}/session_lock.sh"
wiki_text() {
# END EDIT SCRIPT, continue in index.cgi
elif [ "$edit_action" = update ]; then
- if mkdir -p -- "${edit_file%/#page.md}" \
- && S_LOCK "$edit_file"; then
+ if mkdir -p -- "${edit_file%/#page.md}" \
+ && S_LOCK "$edit_file"; then
POST pagetext >"$edit_file"
S_RELEASE "$edit_file"
- REDIRECT "${_BASE}${PATH_INFO%\[edit\]}"
else
export ERRMSG="ERR_NOLOCK"
REDIRECT "${_BASE}${PATH_INFO%\[edit\]}/[edit]"
fi
+ if [ "$(which git)" ]; then
+ git -C "$_DATA" add \
+ -- "pages/$edit_page/#page.md"
+ git -C "$_DATA" commit -m \
+ "Page # ${edit_page} # updated by user @ ${USER_NAME} @" \
+ -- "pages/$edit_page/#page.md"
+ fi
+
+ REDIRECT "${_BASE}${PATH_INFO%\[edit\]}"
+
elif [ "$edit_action" = cancel ]; then
S_RELEASE "$edit_file"
REDIRECT "${_BASE}${PATH_INFO%\[edit\]}"