X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=handlers%2F30_edit.sh;h=6dfe2e863f26d86862a5ee0d3c11183967f66052;hb=9f4240c2867a03627e7b1615790255f1bbf7e568;hp=60b1b25e1089a35eddbfc558afec209c83362c54;hpb=b86e88d2d6acd3eda7d9858539818a290db67d41;p=shellwiki diff --git a/handlers/30_edit.sh b/handlers/30_edit.sh index 60b1b25..6dfe2e8 100755 --- a/handlers/30_edit.sh +++ b/handlers/30_edit.sh @@ -1,6 +1,5 @@ #!/bin/sh -. "${_EXEC}/themes/default.sh" . "${_EXEC}/session_lock.sh" wiki_text() { @@ -26,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 -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\]}"