Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='pull options' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 7 | test_expect_success 'setup' ' |
| 8 | mkdir parent && |
| 9 | (cd parent && git init && |
| 10 | echo one >file && git add file && |
| 11 | git commit -m one) |
| 12 | ' |
| 13 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 14 | test_expect_success 'git pull -q' ' |
| 15 | mkdir clonedq && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 16 | (cd clonedq && git init && |
| 17 | git pull -q "../parent" >out 2>err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 18 | test_must_be_empty err && |
| 19 | test_must_be_empty out) |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 20 | ' |
| 21 | |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 22 | test_expect_success 'git pull -q --rebase' ' |
| 23 | mkdir clonedqrb && |
| 24 | (cd clonedqrb && git init && |
| 25 | git pull -q --rebase "../parent" >out 2>err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 26 | test_must_be_empty err && |
| 27 | test_must_be_empty out && |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 28 | git pull -q --rebase "../parent" >out 2>err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 29 | test_must_be_empty err && |
| 30 | test_must_be_empty out) |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 31 | ' |
| 32 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 33 | test_expect_success 'git pull' ' |
| 34 | mkdir cloned && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 35 | (cd cloned && git init && |
| 36 | git pull "../parent" >out 2>err && |
| 37 | test -s err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 38 | test_must_be_empty out) |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 39 | ' |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 40 | |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 41 | test_expect_success 'git pull --rebase' ' |
| 42 | mkdir clonedrb && |
| 43 | (cd clonedrb && git init && |
| 44 | git pull --rebase "../parent" >out 2>err && |
| 45 | test -s err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 46 | test_must_be_empty out) |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 47 | ' |
| 48 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 49 | test_expect_success 'git pull -v' ' |
| 50 | mkdir clonedv && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 51 | (cd clonedv && git init && |
| 52 | git pull -v "../parent" >out 2>err && |
| 53 | test -s err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 54 | test_must_be_empty out) |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 55 | ' |
| 56 | |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 57 | test_expect_success 'git pull -v --rebase' ' |
| 58 | mkdir clonedvrb && |
| 59 | (cd clonedvrb && git init && |
| 60 | git pull -v --rebase "../parent" >out 2>err && |
| 61 | test -s err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 62 | test_must_be_empty out) |
Peter Eisentraut | ce4c4d4 | 2013-03-14 22:26:08 -0400 | [diff] [blame] | 63 | ' |
| 64 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 65 | test_expect_success 'git pull -v -q' ' |
| 66 | mkdir clonedvq && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 67 | (cd clonedvq && git init && |
| 68 | git pull -v -q "../parent" >out 2>err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 69 | test_must_be_empty out && |
| 70 | test_must_be_empty err) |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 71 | ' |
| 72 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 73 | test_expect_success 'git pull -q -v' ' |
| 74 | mkdir clonedqv && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 75 | (cd clonedqv && git init && |
| 76 | git pull -q -v "../parent" >out 2>err && |
Junio C Hamano | ca8d148 | 2013-06-09 11:29:20 -0700 | [diff] [blame] | 77 | test_must_be_empty out && |
Junio C Hamano | 13e65fe | 2010-02-24 10:22:05 -0800 | [diff] [blame] | 78 | test -s err) |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 79 | ' |
| 80 | |
Junio C Hamano | bba5322 | 2010-02-24 10:22:06 -0800 | [diff] [blame] | 81 | test_expect_success 'git pull --force' ' |
| 82 | mkdir clonedoldstyle && |
| 83 | (cd clonedoldstyle && git init && |
| 84 | cat >>.git/config <<-\EOF && |
| 85 | [remote "one"] |
| 86 | url = ../parent |
| 87 | fetch = refs/heads/master:refs/heads/mirror |
| 88 | [remote "two"] |
| 89 | url = ../parent |
| 90 | fetch = refs/heads/master:refs/heads/origin |
| 91 | [branch "master"] |
| 92 | remote = two |
| 93 | merge = refs/heads/master |
| 94 | EOF |
| 95 | git pull two && |
| 96 | test_commit A && |
| 97 | git branch -f origin && |
| 98 | git pull --all --force |
| 99 | ) |
| 100 | ' |
| 101 | |
Junio C Hamano | e6cc510 | 2010-02-24 11:02:05 -0800 | [diff] [blame] | 102 | test_expect_success 'git pull --all' ' |
| 103 | mkdir clonedmulti && |
| 104 | (cd clonedmulti && git init && |
| 105 | cat >>.git/config <<-\EOF && |
| 106 | [remote "one"] |
| 107 | url = ../parent |
| 108 | fetch = refs/heads/*:refs/remotes/one/* |
| 109 | [remote "two"] |
| 110 | url = ../parent |
| 111 | fetch = refs/heads/*:refs/remotes/two/* |
| 112 | [branch "master"] |
| 113 | remote = one |
| 114 | merge = refs/heads/master |
| 115 | EOF |
| 116 | git pull --all |
| 117 | ) |
| 118 | ' |
| 119 | |
Paul Tan | 5504f13 | 2015-05-29 19:44:44 +0800 | [diff] [blame] | 120 | test_expect_success 'git pull --dry-run' ' |
| 121 | test_when_finished "rm -rf clonedry" && |
| 122 | git init clonedry && |
| 123 | ( |
| 124 | cd clonedry && |
| 125 | git pull --dry-run ../parent && |
| 126 | test_path_is_missing .git/FETCH_HEAD && |
| 127 | test_path_is_missing .git/refs/heads/master && |
| 128 | test_path_is_missing .git/index && |
| 129 | test_path_is_missing file |
| 130 | ) |
| 131 | ' |
| 132 | |
Paul Tan | eb2a8d9 | 2015-06-02 22:22:52 +0800 | [diff] [blame] | 133 | test_expect_success 'git pull --all --dry-run' ' |
| 134 | test_when_finished "rm -rf cloneddry" && |
| 135 | git init clonedry && |
| 136 | ( |
| 137 | cd clonedry && |
| 138 | git remote add origin ../parent && |
| 139 | git pull --all --dry-run && |
| 140 | test_path_is_missing .git/FETCH_HEAD && |
| 141 | test_path_is_missing .git/refs/remotes/origin/master && |
| 142 | test_path_is_missing .git/index && |
| 143 | test_path_is_missing file |
| 144 | ) |
| 145 | ' |
| 146 | |
Tuncer Ayaz | 7f87aff | 2008-11-15 01:14:24 +0100 | [diff] [blame] | 147 | test_done |