浏览代码

Fix adding new app

Willy-JL 1 年之前
父节点
当前提交
54d7fe3eeb
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      .utils/add-subtree.sh

+ 7 - 3
.utils/add-subtree.sh

@@ -44,9 +44,13 @@ if [ "${prevremotedir}" != "" ]; then
     mv -T "${prevremotedir}" "${path}"
 fi
 
-# Add new remote at the top
-echo "${repo} ${branch} ${subdir}" | cat - "${gitsubtree}" 2> /dev/null > "${gitsubtree}.new"
-mv "${gitsubtree}.new" "${gitsubtree}"
+if [ -e "${gitsubtree}" ]; then
+    # Add new remote at the top
+    echo "${repo} ${branch} ${subdir}" | cat - "${gitsubtree}" > "${gitsubtree}.new"
+    mv "${gitsubtree}.new" "${gitsubtree}"
+else
+    echo "${repo} ${branch} ${subdir}" > "${gitsubtree}"
+fi
 git add "${gitsubtree}"
 git commit --amend --no-edit