From c023631d130ae441863d2c23a04eab75278302ea Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Tue, 19 Jun 2018 15:57:15 +0200
Subject: [PATCH] Change .gitignore logic to handle multiple sheets

---
 kicad-git-setup | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/kicad-git-setup b/kicad-git-setup
index 7006445..979805f 100755
--- a/kicad-git-setup
+++ b/kicad-git-setup
@@ -33,6 +33,13 @@ if [ ${#SCHEMATICS[*]} -eq 0  ] ; then
     exit 1
 fi
 
+PROJECT=( *.pro )
+if [ ${#PROJECT[*]} -ne 1  ] ; then
+    echo "Not the expected number of projects (${#PROJECT[*]} != 1)" >&2
+    echo "  ${PROJECT[*]}" >&2
+    exit 1
+fi
+
 if [ ! -d .git ] ; then
     # Initialize git
     git init
@@ -41,11 +48,11 @@ fi
 # Fill in .gitignore
 GITIGNORE=( "*~" "*.net" "*.kicad_pcb-bak" "*.bak" "_autosave*" )
 GITIGNORE+=( "*.csv" "*.tsv" "*.xml" )
-for s in ${SCHEMATICS[@]} ; do
-    if [[ "$s" =~(.*)\.sch ]] ; then
+for s in ${PROJECT[@]} ; do
+    if [[ "$s" =~ (.*)\.pro ]] ; then
         BASE=${BASH_REMATCH[1]}
         # Autoroute files
-        GITIGNORE+=( ${BASE}.bin ${BASE}.dsn ${BASE}.ses )
+        # GITIGNORE+=( ${BASE}.bin ${BASE}.dsn ${BASE}.ses )
         # Other stuff
         GITIGNORE+=( ${BASE}-rescue.lib )
     fi
-- 
GitLab