1
1
#! /bin/sh
2
2
3
3
oneTimeSetUp () {
4
- BASE_PATH=$( readlink -f $TESTDIR /..) /
5
- # Maybe this is more robust?
6
- # BASE_PATH=$TESTDIR/../
4
+ cd " $TESTDIR /../"
7
5
8
- GIT_FTP_CMD=" ${BASE_PATH} git-ftp"
6
+ GIT_FTP_CMD=" $( pwd ) / git-ftp"
9
7
: ${GIT_FTP_USER=ftp}
10
8
: ${GIT_FTP_PASSWD=}
11
9
: ${GIT_FTP_ROOT=localhost/ }
@@ -57,7 +55,7 @@ test_displays_usage() {
57
55
58
56
test_prints_version () {
59
57
version=$( $GIT_FTP_CMD 2>&1 --version)
60
- assertEquals = " git-ftp version 1.0.0-rc.1 " " $version "
58
+ assertEquals = " git-ftp version 1.0.0-rc.2 " " $version "
61
59
}
62
60
63
61
test_inits_and_pushes () {
@@ -261,6 +259,32 @@ test_ignore_dir() {
261
259
assertTrue ' test failed: wrong dir was ignored' " remote_file_exists 'dir 2/test 2.txt'"
262
260
}
263
261
262
+ test_ignore_pattern () {
263
+ cd $GIT_PROJECT_PATH
264
+ echo " test" > .git-ftp-ignore
265
+
266
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
267
+
268
+ for i in 1 2 3 4 5
269
+ do
270
+ assertFalse ' test failed: was not ignored' " remote_file_exists 'test $i .txt'"
271
+ done ;
272
+ }
273
+
274
+ test_ignore_pattern_single () {
275
+ cd $GIT_PROJECT_PATH
276
+ echo ' test' > ' test'
277
+ echo " ^test$" > .git-ftp-ignore
278
+
279
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
280
+
281
+ assertFalse ' test failed: was not ignored' " remote_file_exists 'test'"
282
+ for i in 1 2 3 4 5
283
+ do
284
+ assertTrue ' test failed: was ignored' " remote_file_exists 'test $i .txt'"
285
+ done ;
286
+ }
287
+
264
288
test_ignore_wildcard_files () {
265
289
cd $GIT_PROJECT_PATH
266
290
echo " test.*\.txt" > .git-ftp-ignore
@@ -285,6 +309,17 @@ test_include_init() {
285
309
assertTrue ' unversioned.txt was not uploaded' " remote_file_exists 'unversioned.txt'"
286
310
}
287
311
312
+ test_include_whitespace_init () {
313
+ cd $GIT_PROJECT_PATH
314
+ echo ' unversioned' > unversioned.txt
315
+ echo ' unversioned.txt' >> .gitignore
316
+ echo ' unversioned.txt:test X.txt' > .git-ftp-include
317
+ git add .
318
+ git commit -m ' unversioned file unversioned.txt should not be uploaded. test X.txt does not exist.' > /dev/null
319
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
320
+ assertFalse ' unversioned.txt was uploaded' " remote_file_exists 'unversioned.txt'"
321
+ }
322
+
288
323
test_include_push () {
289
324
cd $GIT_PROJECT_PATH
290
325
init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
@@ -325,6 +360,48 @@ test_include_ignore_push() {
325
360
assertFalse ' .htaccess.prod was uploaded' " remote_file_exists '.htaccess.prod'"
326
361
}
327
362
363
+ test_include_ftp_ignore_init () {
364
+ cd $GIT_PROJECT_PATH
365
+ echo ' htaccess' > .htaccess
366
+ echo ' htaccess.prod' > .htaccess.prod
367
+ echo ' .htaccess:.htaccess.prod' > .git-ftp-include
368
+ echo ' .htaccess.prod' > .git-ftp-ignore
369
+ git add .
370
+ git commit -m ' htaccess setup' > /dev/null
371
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
372
+ assertTrue ' .htaccess was ignored' " remote_file_exists '.htaccess'"
373
+ assertFalse ' .htaccess.prod was uploaded' " remote_file_exists '.htaccess.prod'"
374
+ }
375
+
376
+ test_include_ftp_ignore_push () {
377
+ cd $GIT_PROJECT_PATH
378
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
379
+ echo ' htaccess' > .htaccess
380
+ echo ' htaccess.prod' > .htaccess.prod
381
+ echo ' .htaccess:.htaccess.prod' > .git-ftp-include
382
+ echo ' .htaccess.prod' > .git-ftp-ignore
383
+ git add .
384
+ git commit -m ' htaccess setup' > /dev/null
385
+ push=$( $GIT_FTP_CMD push -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
386
+ assertTrue ' .htaccess was ignored' " remote_file_exists '.htaccess'"
387
+ assertFalse ' .htaccess.prod was uploaded' " remote_file_exists '.htaccess.prod'"
388
+ }
389
+
390
+ # addresses issue #41
391
+ test_include_similar () {
392
+ cd $GIT_PROJECT_PATH
393
+ echo ' unversioned' > foo.html
394
+ echo ' /foo.html' >> .gitignore
395
+ echo ' foo.html:templates/foo.html' > .git-ftp-include
396
+ mkdir templates
397
+ echo ' new content' >> ' templates/foo.html'
398
+ git add .
399
+ git commit -m ' unversioned file foo.html should be uploaded with templates/foo.html' > /dev/null
400
+ init=$( $GIT_FTP_CMD init -u $GIT_FTP_USER -p $GIT_FTP_PASSWD $GIT_FTP_URL )
401
+ assertTrue ' foo.html was not uploaded' " remote_file_exists 'foo.html'"
402
+ assertTrue ' templates/foo.html was not uploaded' " remote_file_exists 'templates/foo.html'"
403
+ }
404
+
328
405
test_hidden_file_only () {
329
406
cd $GIT_PROJECT_PATH
330
407
echo " test" > .htaccess
0 commit comments