From ecb2ff96a9cb219af7e2935afe6ad8c2ef065dcb Mon Sep 17 00:00:00 2001 From: panika Date: Wed, 14 Dec 2022 14:33:42 +0100 Subject: [PATCH] moved windows hooks, git does not want to add .git, too lazy to fix hard way --- windows/logseq-gitea/hooks/post-commit | 3 +++ windows/logseq-gitea/hooks/pre-commit | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 windows/logseq-gitea/hooks/post-commit create mode 100644 windows/logseq-gitea/hooks/pre-commit diff --git a/windows/logseq-gitea/hooks/post-commit b/windows/logseq-gitea/hooks/post-commit new file mode 100644 index 0000000..ba0e510 --- /dev/null +++ b/windows/logseq-gitea/hooks/post-commit @@ -0,0 +1,3 @@ +#!/bin/sh + +git push origin main diff --git a/windows/logseq-gitea/hooks/pre-commit b/windows/logseq-gitea/hooks/pre-commit new file mode 100644 index 0000000..b07a7c1 --- /dev/null +++ b/windows/logseq-gitea/hooks/pre-commit @@ -0,0 +1,25 @@ +#!/bin/sh +# +# +# Pull before committing +# Credential handling options: +# - hardcode credentials in URL +# - use ssh with key auth +# - https://git-scm.com/docs/git-credential-store +# - git credential helper on windows + +# Redirect output to stderr, uncomment for more output for debugging +# exec 1>&2 + +output=$(git pull --no-rebase) + +# Handle non error output as otherwise it gets shown with any exit code by logseq +if [ "$output" = "Already up to date." ]; then + # no ouput + exit 0 +else + # probably error print it to screen + echo "${output}" +fi + +git add -A