Skip to content

Commit

Permalink
Update prepare-commit-msg (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco authored Oct 22, 2024
1 parent 1619520 commit af0c6ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ fi

COMMIT_MSG_FILE=$1
GIT_DIFF=$(git diff --staged)
CURRENT=$(cat "$COMMIT_MSG_FILE")
GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
CURRENT_MESSAGE=$(cat "$COMMIT_MSG_FILE")

# Run dotnet-aicommitmessage with error handling
if ! AI_MESSAGE=$(dotnet-aicommitmessage generate-message -m "$CURRENT" -b "branch-name" -d "$GIT_DIFF" ); then
if ! AI_MESSAGE=$(dotnet-aicommitmessage generate-message -m "$CURRENT_MESSAGE" -b "$GIT_BRANCH_NAME" -d "$GIT_DIFF" ); then
echo "Error: Failed to generate AI commit message. Using original message." >&2
exit 0
fi
Expand Down

0 comments on commit af0c6ab

Please sign in to comment.