Skip to content

Commit eb0f7bb

Browse files
committed
Update build path and installation instructions for commit-msg hook
1 parent 2d4d26f commit eb0f7bb

5 files changed

Lines changed: 26 additions & 7 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ install-hook:
1111
curl -fsSL https://raw.githubusercontent.com/inem/dotdotdot/main/install.sh | sh
1212

1313
build:
14-
go build -o _git/hooks/commit-msg-go commit-msg.go
14+
go build -o release/commit-msg-go commit-msg.go

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This repository includes a custom Git commit message hook powered by OpenAI. The
1515
## Quick Install
1616

1717
```sh
18-
curl -fsSL https://raw.githubusercontent.com/inem/dotdotdot/refs/heads/main/install.sh | sh
18+
curl -fsSL https://raw.githubusercontent.com/inem/dotdotdot/main/install.sh | sh
1919
```
2020

2121
## Manual Installation (Go version)
@@ -25,10 +25,11 @@ curl -fsSL https://raw.githubusercontent.com/inem/dotdotdot/refs/heads/main/inst
2525
```bash
2626
make build
2727
```
28-
3. Install the hook (this will overwrite `.git/hooks/commit-msg`):
28+
3. Install the hook and binary (this will overwrite `.git/hooks/commit-msg` and `.git/hooks/commit-msg-go`):
2929
```bash
3030
cp _git/hooks/commit-msg .git/hooks/commit-msg
31-
chmod +x .git/hooks/commit-msg
31+
cp release/commit-msg-go .git/hooks/commit-msg-go
32+
chmod +x .git/hooks/commit-msg .git/hooks/commit-msg-go
3233
```
3334
4. Set your OpenAI API key in the environment:
3435
```bash

_git/hooks/commit-msg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
# Git commit-msg hook (Go version)
3+
4+
HOOK_BIN="$(dirname "$0")/commit-msg-go"
5+
6+
if [ ! -x "$HOOK_BIN" ]; then
7+
echo "commit-msg-go binary not found or not executable: $HOOK_BIN" >&2
8+
exit 1
9+
fi
10+
11+
exec "$HOOK_BIN" "$@"

install.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@
22
set -e
33

44
HOOK_PATH=".git/hooks/commit-msg"
5-
REPO_URL="https://raw.githubusercontent.com/inem/dotdotdot/refs/heads/main/_git/hooks/commit-msg-go"
5+
BIN_PATH=".git/hooks/commit-msg-go"
6+
SCRIPT_SRC="_git/hooks/commit-msg"
7+
BIN_SRC="release/commit-msg-go"
68

79
if [ ! -d .git/hooks ]; then
810
echo "Error: .git/hooks directory not found. Please run this script from the root of your git repository."
911
exit 1
1012
fi
1113

12-
echo "Downloading commit_msg hook..."
13-
curl -fsSL "$REPO_URL" -o "$HOOK_PATH"
14+
echo "Installing shell wrapper hook..."
15+
cp "$SCRIPT_SRC" "$HOOK_PATH"
1416
chmod +x "$HOOK_PATH"
1517
echo "Hook installed to $HOOK_PATH"
1618

19+
echo "Copying Go binary to .git/hooks..."
20+
cp "$BIN_SRC" "$BIN_PATH"
21+
chmod +x "$BIN_PATH"
22+
echo "Binary installed to $BIN_PATH"
23+
1724
if [ -z "$OPENAI_API_KEY" ]; then
1825
echo "WARNING: OPENAI_API_KEY is not set. Please export it in your shell."
1926
fi

0 commit comments

Comments
 (0)