Procházet zdrojové kódy

Fix adding new app

Willy-JL před 1 rokem
rodič
revize
54d7fe3eeb
1 změnil soubory, kde provedl 7 přidání a 3 odebrání
  1. 7 3
      .utils/add-subtree.sh

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

@@ -44,9 +44,13 @@ if [ "${prevremotedir}" != "" ]; then
     mv -T "${prevremotedir}" "${path}"
     mv -T "${prevremotedir}" "${path}"
 fi
 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 add "${gitsubtree}"
 git commit --amend --no-edit
 git commit --amend --no-edit