Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/flakebox/id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8bb96192c03f0918867d33632de433abfa4729d089956f3bd74b46ca6947aeaa50692d77fcc909cceb6c5656814182a519f4ba6550a02996cb7aafc3e06281c0
b9ad9ff04d98afd64227c97d2239109110e1c6eb8224763f33b22f0fbad9d1973063cd3a9a27fd3a94829ead5606baf251741ec51dafba229ad9035cf3d7ce22
28 changes: 21 additions & 7 deletions .config/flakebox/shellHook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,34 @@ root="$(git rev-parse --show-toplevel)"
dot_git="$(git rev-parse --git-common-dir)"
if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
# fix old bug
rm -f "${dot_git}/hooks/comit-msg"
rm -f "${dot_git}/hooks/commit-msg"
ln -sf "${root}/misc/git-hooks/commit-msg" "${dot_git}/hooks/commit-msg"
if [[ -e "${dot_git}/hooks/comit-msg" || -L "${dot_git}/hooks/comit-msg" ]]; then
rm -f "${dot_git}/hooks/comit-msg"
fi
hook="${dot_git}/hooks/commit-msg"
source="${root}/misc/git-hooks/commit-msg"
if [[ ! -e "${hook}" ]] || ! cmp -s "${source}" "${hook}"; then
rm -f "${hook}"
ln -sf "${source}" "${hook}"
fi

root="$(git rev-parse --show-toplevel)"
dot_git="$(git rev-parse --git-common-dir)"
if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
# fix old bug
rm -f "${dot_git}/hooks/pre-comit"
rm -f "${dot_git}/hooks/pre-commit"
ln -sf "${root}/misc/git-hooks/pre-commit" "${dot_git}/hooks/pre-commit"
if [[ -e "${dot_git}/hooks/pre-comit" || -L "${dot_git}/hooks/pre-comit" ]]; then
rm -f "${dot_git}/hooks/pre-comit"
fi
hook="${dot_git}/hooks/pre-commit"
source="${root}/misc/git-hooks/pre-commit"
if [[ ! -e "${hook}" ]] || ! cmp -s "${source}" "${hook}"; then
rm -f "${hook}"
ln -sf "${source}" "${hook}"
fi

# set template
git config commit.template misc/git-hooks/commit-template.txt
if [[ "$(git config --get commit.template || true)" != "misc/git-hooks/commit-template.txt" ]]; then
git config commit.template misc/git-hooks/commit-template.txt
fi

if ! flakebox lint --silent; then
>&2 echo "ℹ️ Project recommendations detected. Run 'flakebox lint' for more info."
Expand Down
28 changes: 21 additions & 7 deletions lib/modules/git.nix
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ in
dot_git="$(git rev-parse --git-common-dir)"
if [[ ! -d "''${dot_git}/hooks" ]]; then mkdir -p "''${dot_git}/hooks"; fi
# fix old bug
rm -f "''${dot_git}/hooks/comit-msg"
rm -f "''${dot_git}/hooks/commit-msg"
ln -sf "''${root}/misc/git-hooks/commit-msg" "''${dot_git}/hooks/commit-msg"
if [[ -e "''${dot_git}/hooks/comit-msg" || -L "''${dot_git}/hooks/comit-msg" ]]; then
rm -f "''${dot_git}/hooks/comit-msg"
fi
hook="''${dot_git}/hooks/commit-msg"
source="''${root}/misc/git-hooks/commit-msg"
if [[ ! -e "''${hook}" ]] || ! cmp -s "''${source}" "''${hook}"; then
rm -f "''${hook}"
ln -sf "''${source}" "''${hook}"
fi
''
];

Expand Down Expand Up @@ -215,9 +221,15 @@ in
dot_git="$(git rev-parse --git-common-dir)"
if [[ ! -d "''${dot_git}/hooks" ]]; then mkdir -p "''${dot_git}/hooks"; fi
# fix old bug
rm -f "''${dot_git}/hooks/pre-comit"
rm -f "''${dot_git}/hooks/pre-commit"
ln -sf "''${root}/misc/git-hooks/pre-commit" "''${dot_git}/hooks/pre-commit"
if [[ -e "''${dot_git}/hooks/pre-comit" || -L "''${dot_git}/hooks/pre-comit" ]]; then
rm -f "''${dot_git}/hooks/pre-comit"
fi
hook="''${dot_git}/hooks/pre-commit"
source="''${root}/misc/git-hooks/pre-commit"
if [[ ! -e "''${hook}" ]] || ! cmp -s "''${source}" "''${hook}"; then
rm -f "''${hook}"
ln -sf "''${source}" "''${hook}"
fi
''
];

Expand All @@ -236,7 +248,9 @@ in
env.shellHooks = [
''
# set template
git config commit.template misc/git-hooks/commit-template.txt
if [[ "$(git config --get commit.template || true)" != "misc/git-hooks/commit-template.txt" ]]; then
git config commit.template misc/git-hooks/commit-template.txt
fi
''
];

Expand Down
Loading