git-hg-sub-import: Ajout des subrepos à .gitignore
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 28 Jun 2013 14:35:06 +0000 (10:35 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 31 Jul 2013 18:05:11 +0000 (14:05 -0400)
scripts/git-hg-sub-import

index d5d947f..6d18dc3 100755 (executable)
@@ -53,6 +53,11 @@ if [ ! -f .hgsub ]; then
     exit 1
 fi
 
+if [ ! -f .gitignore ]; then
+    # We do not want to track .gitignore itself
+    echo ".gitignore" > .gitignore
+fi
+
 # Read lines from .hgsub
 while read sub; do
     # Remove CR (DOS)
@@ -94,6 +99,11 @@ while read sub; do
                 git checkout "branches/${branch}"
                 cd ..
             fi
+
+            if ! grep -q "${dest}" .gitignore ; then
+                # Ignore subrepo in top-level git repository
+                echo "${dest}" >> .gitignore
+            fi
         else
             pushd "${dest}"
             git pull