From bd1a29f1a4810fae7d4ff66f64fcd90416267d26 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 5 Jul 2025 00:46:41 +0800 Subject: [PATCH] feat(commit): exit early if no staged changes exist --- packages/commit/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/commit/default.nix b/packages/commit/default.nix index e50ab41..f6d9c1b 100644 --- a/packages/commit/default.nix +++ b/packages/commit/default.nix @@ -1,6 +1,8 @@ { pkgs, ... }: pkgs.writeShellScriptBin "commit" # bash '' + if git diff-index --quiet HEAD --; then exit 0; fi + PROMPT="Please generate a commit message for this diff." GUIDELINES="1. Use conventional commit syntax, following the context. 2. Cap the commit message at 80 characters, preferably less. You must not go beyond this limit. 3. Do not include backticks. Only generate the raw text. 4. Be as succint as possible. Each commit should be atomic. You may throw a warning if it is not." NUM_ANCESTORS=0