Browse code

symlink fixes and better version exit

Nat! authored on 11/11/2016 14:33:11
Showing 4 changed files
... ...
@@ -1,5 +1,7 @@
1 1
 # mulle-bootstrap, cross platform dependency manager using bash
2 2
 
3
+![Last version](https://img.shields.io/github/tag/mulle-nat/mulle-bootstrap.svg)
4
+
3 5
 ... for Linux, OS X, FreeBSD, Windows
4 6
 
5 7
 ... for C, C++, Objective-C
... ...
@@ -7,6 +9,7 @@
7 7
 ... certainly not a "minimal" or "lightweight" project with ca. 10000 lines of
8 8
   shell script code
9 9
 
10
+
10 11
 ## Why you may want it
11 12
 
12 13
 * You program in C, C++ or in Objective-C, **mulle-bootstrap** is written for you
... ...
@@ -1,3 +1,14 @@
1
+2.4.2
2
+===
3
+
4
+Exit with 0 when printing version.
5
+
6
+
7
+2.4.1
8
+===
9
+
10
+Emit better .gitignore code for symlinked embedded repos
11
+
1 12
 2.4.0
2 13
 ===
3 14
 
... ...
@@ -30,7 +30,7 @@
30 30
 #   POSSIBILITY OF SUCH DAMAGE.
31 31
 MULLE_BOOTSTRAP_VERSION_MAJOR=2
32 32
 MULLE_BOOTSTRAP_VERSION_MINOR=4
33
-MULLE_BOOTSTRAP_VERSION_PATCH=0
33
+MULLE_BOOTSTRAP_VERSION_PATCH=1
34 34
 
35 35
 MULLE_BOOTSTRAP_VERSION="${MULLE_BOOTSTRAP_VERSION_MAJOR}.${MULLE_BOOTSTRAP_VERSION_MINOR}.${MULLE_BOOTSTRAP_VERSION_PATCH}"
36 36
 MULLE_BOOTSTRAP_FAIL_PREFIX="mulle-bootstrap"
... ...
@@ -547,7 +547,8 @@ bootstrap_main()
547 547
       ;;
548 548
 
549 549
       version)
550
-         echo "${MULLE_BOOTSTRAP_VERSION}" || exit 1
550
+         echo "${MULLE_BOOTSTRAP_VERSION}"
551
+         exit 0
551 552
       ;;
552 553
 
553 554
       *)
... ...
@@ -1131,22 +1131,23 @@ append_dir_to_gitignore_if_needed()
1131 1131
    local directory
1132 1132
 
1133 1133
    # make it absolute dir for git -> '/' <subdir> '/'
1134
+   # emit w/o trailing '/' for symlinks
1134 1135
 
1135 1136
    case "$1" in
1136 1137
       /*/)
1137
-         directory="$1"
1138
+         directory="`echo "$1" | sed 's/.$//'`"
1138 1139
       ;;
1139 1140
 
1140 1141
       /*)
1141
-         directory="$1/"
1142
+         directory="$1"
1142 1143
       ;;
1143 1144
 
1144 1145
       */)
1145
-         directory="/$1"
1146
+         directory="`echo "/$1" | sed 's/.$//'`"
1146 1147
       ;;
1147 1148
 
1148 1149
       *)
1149
-         directory="/$1/"
1150
+         directory="/$1"
1150 1151
       ;;
1151 1152
    esac
1152 1153
 
... ...
@@ -1154,14 +1155,14 @@ append_dir_to_gitignore_if_needed()
1154 1154
    local pattern2
1155 1155
    local pattern3
1156 1156
 
1157
-   # also match without trailing slash
1158
-   pattern1="`echo "${directory}" | sed 's|\(.*\)/$|\1|'`"
1157
+   # also match with trailing slash
1158
+   pattern1="${directory}/"
1159 1159
 
1160 1160
    # also match without leading slash
1161 1161
    pattern2="`echo "${directory}" | sed 's|^/\(.*\)|\1|'`"
1162 1162
 
1163
-   # also match without leading or trailing slash
1164
-   pattern3="`echo "${pattern1}"  | sed 's|^/\(.*\)|\1|'`"
1163
+   # also match without leading but with trailing slash
1164
+   pattern3="${pattern2}/"
1165 1165
 
1166 1166
    fgrep -s -x -e "${directory}" -e "${pattern1}" -e "${pattern2}" -e "${pattern3}" .gitignore > /dev/null 2>&1
1167 1167