X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F30_edit.sh;h=315b5c9b996125ac70f6447a86a02242aa514fd4;hb=5e41ef419be25a2c23c8eff06acb5ebadf523f5a;hp=aa55796ccce501fae8af249458bbef2513ee5994;hpb=1861b7d2167a225930ff04d38d5d835a98c5d5c5;p=shellwiki diff --git a/handlers/30_edit.sh b/handlers/30_edit.sh index aa55796..315b5c9 100755 --- a/handlers/30_edit.sh +++ b/handlers/30_edit.sh @@ -25,16 +25,25 @@ if [ "$edit_page" = "$PATH_INFO" ]; then # 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 -qm \ + "Page # ${edit_page} # updated by user @ ${USER_NAME} @" \ + -- "pages/$edit_page/#page.md" + fi 1>&2 + + REDIRECT "${_BASE}${PATH_INFO%\[edit\]}" + elif [ "$edit_action" = cancel ]; then S_RELEASE "$edit_file" REDIRECT "${_BASE}${PATH_INFO%\[edit\]}"