mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
dev: fix --commit
when the worktree is dirty
This commit is contained in:
parent
cff06c8570
commit
c1feceda64
1 changed files with 8 additions and 3 deletions
|
@ -43,13 +43,14 @@
|
||||||
cd "$generated_dir"
|
cd "$generated_dir"
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
# Construct a msg body from `git status`
|
# Construct a msg body from `git status -- .`
|
||||||
body=$(
|
body=$(
|
||||||
git status \
|
git status \
|
||||||
--short \
|
--short \
|
||||||
--ignored=no \
|
--ignored=no \
|
||||||
--untracked-files=no \
|
--untracked-files=no \
|
||||||
--no-ahead-behind \
|
--no-ahead-behind \
|
||||||
|
-- . \
|
||||||
| sed \
|
| sed \
|
||||||
-e 's/^\s*\([A-Z]\)\s*/\1 /' \
|
-e 's/^\s*\([A-Z]\)\s*/\1 /' \
|
||||||
-e 's/^A/Added/' \
|
-e 's/^A/Added/' \
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
# Construct the commit message based on the body
|
# Construct the commit message based on the body
|
||||||
count=$(echo "$body" | wc -l)
|
count=$(echo -n "$body" | wc -l)
|
||||||
if [ "$count" -gt 1 ] || [ ''${#body} -gt 50 ]; then
|
if [ "$count" -gt 1 ] || [ ''${#body} -gt 50 ]; then
|
||||||
msg=$(echo -e "generated: Update\n\n$body")
|
msg=$(echo -e "generated: Update\n\n$body")
|
||||||
else
|
else
|
||||||
|
@ -68,7 +69,11 @@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Commit if there are changes
|
# Commit if there are changes
|
||||||
[ "$count" -gt 0 ] && git commit -m "$msg" --no-verify
|
if [ "$count" -gt 0 ]; then
|
||||||
|
echo "Committing $count changes..."
|
||||||
|
echo "$msg"
|
||||||
|
git commit -m "$msg" --no-verify
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue