From 1a48d5e8fb5c88024cd87e3a893e36e8fc42cd39 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Sat, 22 Mar 2025 04:05:16 -0400 Subject: [PATCH] Added commit option to git.fish --- .../optional/hyprland/ags/scripts/git.fish | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/home/toph/common/optional/hyprland/ags/scripts/git.fish b/home/toph/common/optional/hyprland/ags/scripts/git.fish index 5126cb0..e6fe485 100644 --- a/home/toph/common/optional/hyprland/ags/scripts/git.fish +++ b/home/toph/common/optional/hyprland/ags/scripts/git.fish @@ -13,9 +13,28 @@ set branch "main" cd (git rev-parse --show-toplevel) switch $action case push + set changes (git status --porcelain "$subtree_path") + if test -n "$changes" + set_color yellow; echo " Cannot push. There are uncommitted changes in $subtree_path." + exit 1 + end git subtree push --prefix="$subtree_path" $remote $branch case pull git subtree pull --prefix="$subtree_path" $remote $branch + case commit + set changes (git status --porcelain "$subtree_path") + if test -z "$changes" + echo "No changes to commit in $subtree_path." + exit 0 + end + echo " Enter commit message:" + read commit_message + if test -z "$commit_message" + echo "Commit message cannot be empty." + exit 1 + end + git add "$subtree_path" + git commit -m "$commit_message" case '*' echo "Unknown argument. Use push or pull." exit 1