Skip to content

Commit

Permalink
gi: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
XPhyro committed Mar 1, 2024
1 parent 6ada7e9 commit 4523f5a
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/sh/util/integration/git/gi
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,13 @@ git_commit() {
}

git_push() {
git status -sb | head -n 1 | grep -Eq '\[.*behind [0-9]+.*\]$'
ret="$?"

if [ "$ret" -ne 0 ]; then
selection="Normal"
else
selection="$(
{
printf "%s\n" "Normal"
[ "$ret" -eq 0 ] \
&& printf "%s\n" "Force With Lease" "Force"
} | fzf --multi --preview="unbuffer git status"
)"
fi
selection="$(
{
printf "%s\n" "Normal"
git status -sb | head -n 1 | grep -Eq '\[.*behind [0-9]+.*\]$' \
&& printf "%s\n" "Force With Lease" "Force"
} | fzf --select-1 --multi --preview="unbuffer git status"
)"

case "$selection" in
"Normal") git push;;
Expand Down

0 comments on commit 4523f5a

Please sign in to comment.