瀏覽代碼

chore: Improve script for fetching remote branches

This commit refactors the `ai-rebase.sh` script to correctly
fetch remote branches specified as "owner/branch".  It also
adds a conditional to avoid fetch when deleting backups,
improving script robustness and preventing errors.
seno 6 天之前
父節點
當前提交
dc15cccc8f
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      ai-rebase.sh

+ 5 - 3
ai-rebase.sh

@@ -15,10 +15,12 @@ if [ ! -f "$HOME/.git-credentials" ]; then
 	exit 1
 fi
 
-IFS='/' read -r part1 part2 <<<"$1"
+if [ ! "$1" = "--delete-backups" ]; then
+	IFS='/' read -r part1 part2 <<<"$1"
 
-echo git fetch $part1 $part2
-git fetch $part1 $part2
+	echo git fetch $part1 $part2
+	git fetch $part1 $part2
+fi
 
 docker run --rm -it \
 	-v "$(pwd):/repo" \