eac_git 0.1.0 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/lib/eac_git/executables.rb +24 -4
  3. data/lib/eac_git/local.rb +5 -1
  4. data/lib/eac_git/local/dirty_files.rb +37 -0
  5. data/lib/eac_git/rspec.rb +17 -0
  6. data/lib/eac_git/version.rb +1 -1
  7. data/vendor/git-subrepo/Changes +110 -0
  8. data/vendor/git-subrepo/Intro.pod +509 -0
  9. data/vendor/git-subrepo/License +21 -0
  10. data/vendor/git-subrepo/Makefile +82 -0
  11. data/vendor/git-subrepo/Meta +28 -0
  12. data/vendor/git-subrepo/ReadMe.pod +698 -0
  13. data/vendor/git-subrepo/doc/comparison.swim +35 -0
  14. data/vendor/git-subrepo/doc/git-subrepo.swim +608 -0
  15. data/vendor/git-subrepo/doc/intro-to-subrepo.swim +387 -0
  16. data/vendor/git-subrepo/ext/bashplus/Changes +15 -0
  17. data/vendor/git-subrepo/ext/bashplus/License +21 -0
  18. data/vendor/git-subrepo/ext/bashplus/Makefile +45 -0
  19. data/vendor/git-subrepo/ext/bashplus/Meta +28 -0
  20. data/vendor/git-subrepo/ext/bashplus/ReadMe.pod +77 -0
  21. data/vendor/git-subrepo/ext/bashplus/bin/bash+ +43 -0
  22. data/vendor/git-subrepo/ext/bashplus/doc/bash+.swim +61 -0
  23. data/vendor/git-subrepo/ext/bashplus/lib/bash+.bash +92 -0
  24. data/vendor/git-subrepo/ext/bashplus/man/man1/bash+.1 +134 -0
  25. data/vendor/git-subrepo/ext/bashplus/man/man3/bash+.3 +134 -0
  26. data/vendor/git-subrepo/ext/bashplus/test/base.t +12 -0
  27. data/vendor/git-subrepo/ext/bashplus/test/fcopy.t +22 -0
  28. data/vendor/git-subrepo/ext/bashplus/test/lib/foo/bar.bash +3 -0
  29. data/vendor/git-subrepo/ext/bashplus/test/lib/foo/foo.bash +3 -0
  30. data/vendor/git-subrepo/ext/bashplus/test/source-bash+-std.t +18 -0
  31. data/vendor/git-subrepo/ext/bashplus/test/source-bash+.t +23 -0
  32. data/vendor/git-subrepo/ext/bashplus/test/test.bash +70 -0
  33. data/vendor/git-subrepo/ext/bashplus/test/use.t +19 -0
  34. data/vendor/git-subrepo/ext/test-more-bash/Changes +15 -0
  35. data/vendor/git-subrepo/ext/test-more-bash/License +21 -0
  36. data/vendor/git-subrepo/ext/test-more-bash/Makefile +20 -0
  37. data/vendor/git-subrepo/ext/test-more-bash/Meta +30 -0
  38. data/vendor/git-subrepo/ext/test-more-bash/ReadMe.pod +115 -0
  39. data/vendor/git-subrepo/ext/test-more-bash/doc/test-more.swim +89 -0
  40. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Changes +15 -0
  41. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/License +21 -0
  42. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Makefile +45 -0
  43. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Meta +28 -0
  44. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/ReadMe.pod +77 -0
  45. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/bin/bash+ +43 -0
  46. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/doc/bash+.swim +61 -0
  47. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/lib/bash+.bash +92 -0
  48. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man1/bash+.1 +134 -0
  49. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man3/bash+.3 +134 -0
  50. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/base.t +12 -0
  51. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/fcopy.t +22 -0
  52. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/lib/foo/bar.bash +3 -0
  53. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/lib/foo/foo.bash +3 -0
  54. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+-std.t +18 -0
  55. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+.t +23 -0
  56. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/test.bash +70 -0
  57. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/use.t +19 -0
  58. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Changes +15 -0
  59. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/License +21 -0
  60. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Makefile +37 -0
  61. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Meta +28 -0
  62. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/ReadMe.pod +66 -0
  63. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/doc/test-tap.swim +48 -0
  64. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/lib/test/tap.bash +153 -0
  65. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/man/man3/test-tap.3 +119 -0
  66. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/bail_out.t +13 -0
  67. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/done.t +10 -0
  68. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail.t +20 -0
  69. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail_fast.t +15 -0
  70. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/helper.bash +9 -0
  71. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/pass.t +9 -0
  72. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/plan.t +10 -0
  73. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/skip_all.t +20 -0
  74. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/tap.t +13 -0
  75. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/bail.t +14 -0
  76. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/fail.t +7 -0
  77. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/fail_fast.t +12 -0
  78. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/skip-all-init.t +8 -0
  79. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/test/skip-all-plan.t +9 -0
  80. data/vendor/git-subrepo/ext/test-more-bash/lib/test/more.bash +95 -0
  81. data/vendor/git-subrepo/ext/test-more-bash/man/man3/test-more.3 +173 -0
  82. data/vendor/git-subrepo/ext/test-more-bash/test/fail.t +20 -0
  83. data/vendor/git-subrepo/ext/test-more-bash/test/more.t +20 -0
  84. data/vendor/git-subrepo/ext/test-more-bash/test/pass.t +9 -0
  85. data/vendor/git-subrepo/ext/test-more-bash/test/setup +8 -0
  86. data/vendor/git-subrepo/ext/test-more-bash/test/skip_all.t +11 -0
  87. data/vendor/git-subrepo/ext/test-more-bash/test/test/fail1.t +12 -0
  88. data/vendor/git-subrepo/ext/test-more-bash/test/test/skip_all.t +10 -0
  89. data/vendor/git-subrepo/lib/git-subrepo +1903 -0
  90. data/vendor/git-subrepo/lib/git-subrepo.d/bash+.bash +1 -0
  91. data/vendor/git-subrepo/lib/git-subrepo.d/help-functions.bash +339 -0
  92. data/vendor/git-subrepo/man/man1/git-subrepo.1 +743 -0
  93. data/vendor/git-subrepo/note/0.4.0 +12 -0
  94. data/vendor/git-subrepo/note/AllGitCmds +148 -0
  95. data/vendor/git-subrepo/note/Cases +32 -0
  96. data/vendor/git-subrepo/note/Commands +33 -0
  97. data/vendor/git-subrepo/note/Dags +199 -0
  98. data/vendor/git-subrepo/note/Gists +7 -0
  99. data/vendor/git-subrepo/note/Links +25 -0
  100. data/vendor/git-subrepo/note/Plugins +10 -0
  101. data/vendor/git-subrepo/note/Spec +39 -0
  102. data/vendor/git-subrepo/note/Story1 +57 -0
  103. data/vendor/git-subrepo/note/ToDo +55 -0
  104. data/vendor/git-subrepo/note/design.swim +137 -0
  105. data/vendor/git-subrepo/note/design2.swim +85 -0
  106. data/vendor/git-subrepo/note/init-test +38 -0
  107. data/vendor/git-subrepo/note/pull-dance.txt +18 -0
  108. data/vendor/git-subrepo/note/recreate-rebase-conflict.sh +56 -0
  109. data/vendor/git-subrepo/note/subtree-rebase-fail-example/test.bash +29 -0
  110. data/vendor/git-subrepo/note/test-subrepo-push.sh +69 -0
  111. data/vendor/git-subrepo/note/test.sh +58 -0
  112. data/vendor/git-subrepo/pkg/bin/generate-completion.pl +210 -0
  113. data/vendor/git-subrepo/pkg/bin/generate-help-functions.pl +89 -0
  114. data/vendor/git-subrepo/share/completion.bash +42 -0
  115. data/vendor/git-subrepo/share/enable-completion.sh +50 -0
  116. data/vendor/git-subrepo/share/git-completion.bash +2738 -0
  117. data/vendor/git-subrepo/share/zsh-completion/_git-subrepo +81 -0
  118. data/vendor/git-subrepo/test/branch-all.t +41 -0
  119. data/vendor/git-subrepo/test/branch-rev-list-one-path.t +43 -0
  120. data/vendor/git-subrepo/test/branch-rev-list.t +47 -0
  121. data/vendor/git-subrepo/test/branch.t +52 -0
  122. data/vendor/git-subrepo/test/clean.t +43 -0
  123. data/vendor/git-subrepo/test/clone-annotated-tag.t +45 -0
  124. data/vendor/git-subrepo/test/clone.t +107 -0
  125. data/vendor/git-subrepo/test/compile.t +19 -0
  126. data/vendor/git-subrepo/test/config.t +58 -0
  127. data/vendor/git-subrepo/test/encode.t +91 -0
  128. data/vendor/git-subrepo/test/error.t +171 -0
  129. data/vendor/git-subrepo/test/fetch.t +43 -0
  130. data/vendor/git-subrepo/test/gitignore.t +61 -0
  131. data/vendor/git-subrepo/test/init.t +64 -0
  132. data/vendor/git-subrepo/test/issue29.t +98 -0
  133. data/vendor/git-subrepo/test/issue95.t +98 -0
  134. data/vendor/git-subrepo/test/issue96.t +96 -0
  135. data/vendor/git-subrepo/test/pull-all.t +38 -0
  136. data/vendor/git-subrepo/test/pull-merge.t +113 -0
  137. data/vendor/git-subrepo/test/pull-message.t +88 -0
  138. data/vendor/git-subrepo/test/pull-new-branch.t +58 -0
  139. data/vendor/git-subrepo/test/pull-ours.t +90 -0
  140. data/vendor/git-subrepo/test/pull-theirs.t +82 -0
  141. data/vendor/git-subrepo/test/pull-twice.t +44 -0
  142. data/vendor/git-subrepo/test/pull-worktree.t +40 -0
  143. data/vendor/git-subrepo/test/pull.t +99 -0
  144. data/vendor/git-subrepo/test/push-after-init.t +51 -0
  145. data/vendor/git-subrepo/test/push-force.t +56 -0
  146. data/vendor/git-subrepo/test/push-new-branch.t +61 -0
  147. data/vendor/git-subrepo/test/push-no-changes.t +29 -0
  148. data/vendor/git-subrepo/test/push-squash.t +56 -0
  149. data/vendor/git-subrepo/test/push.t +176 -0
  150. data/vendor/git-subrepo/test/reclone.t +45 -0
  151. data/vendor/git-subrepo/test/repo/bar/HEAD +1 -0
  152. data/vendor/git-subrepo/test/repo/bar/config +4 -0
  153. data/vendor/git-subrepo/test/repo/bar/objects/1f/0c4b264caed0126814a0ede851a1e0b4e16ae6 +0 -0
  154. data/vendor/git-subrepo/test/repo/bar/objects/87/46903fdb1b9c2101377880125917c2e05b4d69 +0 -0
  155. data/vendor/git-subrepo/test/repo/bar/objects/94/c86ffc745232d89f78c6f895e11e71272518db +0 -0
  156. data/vendor/git-subrepo/test/repo/bar/objects/c6/76c57b6576743fa56278527aa60ebd2e202a7c +0 -0
  157. data/vendor/git-subrepo/test/repo/bar/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  158. data/vendor/git-subrepo/test/repo/bar/objects/f6/2a8ff3feadf39b0a98f1a86ec6d1eb33858ee9 +0 -0
  159. data/vendor/git-subrepo/test/repo/bar/refs/heads/master +1 -0
  160. data/vendor/git-subrepo/test/repo/bar/refs/tags/A +1 -0
  161. data/vendor/git-subrepo/test/repo/foo/HEAD +1 -0
  162. data/vendor/git-subrepo/test/repo/foo/config +4 -0
  163. data/vendor/git-subrepo/test/repo/foo/objects/a0/f4cdaaf533a936296cdebbed8206c3b9ededa8 +0 -0
  164. data/vendor/git-subrepo/test/repo/foo/objects/e2/1291a1ad392a9d4c51dd9586804f1467b28afd +0 -0
  165. data/vendor/git-subrepo/test/repo/foo/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  166. data/vendor/git-subrepo/test/repo/foo/refs/heads/master +1 -0
  167. data/vendor/git-subrepo/test/repo/init/HEAD +1 -0
  168. data/vendor/git-subrepo/test/repo/init/config +5 -0
  169. data/vendor/git-subrepo/test/repo/init/objects/11/523f5dcf03b4c89b592dc8a3d0308f68da2386 +0 -0
  170. data/vendor/git-subrepo/test/repo/init/objects/14/2addf8ec5f37334e837440122c62f2c68a29ad +0 -0
  171. data/vendor/git-subrepo/test/repo/init/objects/32/5180321750a21cd7a4e7ecda319e557a4f6a09 +2 -0
  172. data/vendor/git-subrepo/test/repo/init/objects/3d/918c6901c02f43af5d31779dd5e1f9166aeb36 +0 -0
  173. data/vendor/git-subrepo/test/repo/init/objects/3e/4cb596066dce63ba4d047abddb677389b65e19 +0 -0
  174. data/vendor/git-subrepo/test/repo/init/objects/4b/6e53022e7a04f07887697e4f3d7c377fd9822b +0 -0
  175. data/vendor/git-subrepo/test/repo/init/objects/58/931fc1bd559b59c41ea738fc7ad04f9ad01bd3 +0 -0
  176. data/vendor/git-subrepo/test/repo/init/objects/5e/c0c28e1b806f25efdca18fcf7a74b49c3755bd +0 -0
  177. data/vendor/git-subrepo/test/repo/init/objects/75/fa6584e748f57eff06eebdc55e9ac21d4fcbf2 +1 -0
  178. data/vendor/git-subrepo/test/repo/init/objects/80/2d5edbd5e1cb7fca82b5bd38e7c8a0a496fb20 +0 -0
  179. data/vendor/git-subrepo/test/repo/init/objects/94/7b3d714c38791e95ad6f928b48c98bb8708acd +0 -0
  180. data/vendor/git-subrepo/test/repo/init/objects/95/e1f2df3f4d5f3d7a60588c25a7ca8a913d3c2a +1 -0
  181. data/vendor/git-subrepo/test/repo/init/objects/b1/5f4a7666baf40d949548ead946a3370e273479 +0 -0
  182. data/vendor/git-subrepo/test/repo/init/objects/c3/ee8978c4c5d84c3b7d00ba8e5906933d027882 +0 -0
  183. data/vendor/git-subrepo/test/repo/init/objects/c8/b0bffbc405ef3fad7354ff833fbec36d67ddfa +3 -0
  184. data/vendor/git-subrepo/test/repo/init/objects/dd/8bdb934ec848137f011fe423b185505c343626 +2 -0
  185. data/vendor/git-subrepo/test/repo/init/objects/e2/9be58c767cfeb27235c995d293a7d71aac0135 +2 -0
  186. data/vendor/git-subrepo/test/repo/init/objects/ee/1224401fc6aac595145fa727dcf6706ac8aec1 +1 -0
  187. data/vendor/git-subrepo/test/repo/init/objects/f1/cc1a657b2e805c400f5dcaaa76bd29c6178b1b +0 -0
  188. data/vendor/git-subrepo/test/repo/init/refs/heads/master +1 -0
  189. data/vendor/git-subrepo/test/setup +205 -0
  190. data/vendor/git-subrepo/test/status.t +68 -0
  191. data/vendor/git-subrepo/test/submodule.t +45 -0
  192. metadata +190 -4
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+ {
10
+ source lib/git-subrepo
11
+ pass 'source lib/git-subrepo'
12
+
13
+ source ext/bashplus/lib/bash+.bash
14
+ pass 'source ext/bashplus/lib/bash+.bash'
15
+ }
16
+
17
+ done_testing 2
18
+
19
+ teardown
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+ git clone $UPSTREAM/init $OWNER/init &>/dev/null
10
+
11
+ gitrepo=$OWNER/init/doc/.gitrepo
12
+
13
+ (
14
+ cd "$OWNER/init"
15
+ git subrepo init doc
16
+ ) > /dev/null
17
+
18
+ # Test init/doc/.gitrepo file contents:
19
+ {
20
+ test-gitrepo-field "remote" "none"
21
+ test-gitrepo-field "branch" "master"
22
+ test-gitrepo-field "commit" ""
23
+ test-gitrepo-field "parent" ""
24
+ test-gitrepo-field "method" "merge"
25
+ test-gitrepo-field "cmdver" "`git subrepo --version`"
26
+ }
27
+
28
+ is "$(
29
+ cd $OWNER/init
30
+ git subrepo config doc method rebase
31
+ )" \
32
+ "Subrepo 'doc' option 'method' set to 'rebase'."
33
+
34
+ {
35
+ test-gitrepo-field "remote" "none"
36
+ test-gitrepo-field "branch" "master"
37
+ test-gitrepo-field "commit" ""
38
+ test-gitrepo-field "parent" ""
39
+ test-gitrepo-field "method" "rebase"
40
+ test-gitrepo-field "cmdver" "`git subrepo --version`"
41
+ }
42
+
43
+ is "$(
44
+ cd $OWNER/init
45
+ git subrepo config doc method
46
+ )" \
47
+ "Subrepo 'doc' option 'method' has value 'rebase'."
48
+
49
+ is "$(
50
+ cd $OWNER/init
51
+ catch git subrepo config doc branch new
52
+ )" \
53
+ "git-subrepo: This option is autogenerated, use '--force' to override."
54
+
55
+
56
+ done_testing
57
+
58
+ teardown
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+
10
+ export round=0
11
+ test_round() {
12
+ clone-foo-and-bar
13
+
14
+ round=$(( round + 1 ))
15
+ normalize_dir="$1"
16
+ normalize_dir="${normalize_dir#./}"
17
+ normalize_dir="${normalize_dir%/}"
18
+ while [[ $normalize_dir =~ (//+) ]]; do normalize_dir=${normalize_dir//${BASH_REMATCH[1]}/\/}; done
19
+
20
+ clone_output="$(
21
+ cd $OWNER/foo
22
+ git subrepo clone ../../../$UPSTREAM/bar -- "$normalize_dir"
23
+ )"
24
+
25
+ # Check output is correct:
26
+ is "$clone_output" \
27
+ "Subrepo '../../../tmp/upstream/bar' (master) cloned into '$normalize_dir'." \
28
+ 'subrepo clone command output is correct'
29
+
30
+ test-exists "$OWNER/foo/$normalize_dir/"
31
+
32
+ (
33
+ cd $OWNER/bar
34
+ git pull
35
+ add-new-files Bar2-$round
36
+ git push
37
+ ) &> /dev/null || die
38
+
39
+ # Do the pull and check output:
40
+ {
41
+ is "$(
42
+ cd $OWNER/foo
43
+ git subrepo pull -- "$normalize_dir"
44
+ )" \
45
+ "Subrepo '$normalize_dir' pulled from '../../../tmp/upstream/bar' (master)." \
46
+ 'subrepo pull command output is correct'
47
+ }
48
+
49
+ test-exists "$OWNER/foo/$normalize_dir/"
50
+
51
+ (
52
+ cd "$OWNER/foo/$normalize_dir"
53
+ git pull
54
+ add-new-files new-$round
55
+ git push
56
+ ) &> /dev/null || die
57
+
58
+ # Do the push and check output:
59
+ {
60
+ is "$(
61
+ cd $OWNER/foo
62
+ git subrepo push -- "$normalize_dir"
63
+ )" \
64
+ "Subrepo '$normalize_dir' pushed to '../../../tmp/upstream/bar' (master)." \
65
+ 'subrepo push command output is correct'
66
+ }
67
+ }
68
+
69
+ test_round normal
70
+ test_round .dot
71
+ test_round ......dots
72
+ test_round 'spa ce'
73
+ test_round 'per%cent'
74
+ test_round 'back-sl\ash'
75
+ test_round 'end-with.lock'
76
+ test_round '@'
77
+ test_round '@{'
78
+ test_round '['
79
+ test_round '-begin-with-minus'
80
+ test_round 'tailing-slash/'
81
+ test_round 'tailing-dots...'
82
+ test_round 'special-char:^[?*'
83
+ test_round 'many////slashes'
84
+ test_round '_under_scores_'
85
+
86
+ test_round '.str%a\nge...'
87
+ test_round '~////......s:a^t?r a*n[g@{e.lock'
88
+
89
+ done_testing
90
+
91
+ teardown
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+ export GIT_SUBREPO_TEST_ERRORS=true
9
+
10
+ note "Test all error message conditions in git-subrepo"
11
+
12
+ clone-foo-and-bar
13
+
14
+ {
15
+ is "$(
16
+ cd $OWNER/bar
17
+ git subrepo --quiet clone ../../../$UPSTREAM/foo
18
+ add-new-files foo/file
19
+ git subrepo --quiet branch foo
20
+ catch git subrepo branch foo
21
+ )" \
22
+ "git-subrepo: Branch 'subrepo/foo' already exists. Use '--force' to override." \
23
+ "Error OK: can't create a branch that exists"
24
+
25
+ (
26
+ cd $OWNER/bar
27
+ git subrepo --quiet clean foo
28
+ git reset --quiet --hard HEAD^
29
+ )
30
+ }
31
+
32
+ {
33
+ like "$(catch git subrepo clone --foo)" \
34
+ "error: unknown option \`foo" \
35
+ "Error OK: unknown command option"
36
+ }
37
+
38
+ {
39
+ is "$(catch git subrepo main 1 2 3)" \
40
+ "git-subrepo: 'main' is not a command. See 'git subrepo help'." \
41
+ "Error OK: unknown command"
42
+ }
43
+
44
+ {
45
+ is "$(catch git subrepo pull --update)" \
46
+ "git-subrepo: Can't use '--update' without '--branch' or '--remote'." \
47
+ "Error OK: --update requires --branch or --remote options"
48
+ }
49
+
50
+ {
51
+ is "$(catch git subrepo clone --all)" \
52
+ "git-subrepo: Invalid option '--all' for 'clone'." \
53
+ "Error OK: Invalid option '--all' for 'clone'"
54
+ }
55
+
56
+ {
57
+ like "$(
58
+ cd $OWNER/bar
59
+ catch git subrepo pull /home/user/bar/foo
60
+ )" \
61
+ "git-subrepo: The subdir '.*/home/user/bar/foo' should not be absolute path." \
62
+ "Error OK: check subdir is not absolute path"
63
+ }
64
+
65
+ {
66
+ # XXX add 'commit' to cmds here when implemented:
67
+ for cmd in pull push fetch branch commit clean; do
68
+ is "$(
69
+ cd $OWNER/bar
70
+ catch git subrepo $cmd
71
+ )" \
72
+ "git-subrepo: Command '$cmd' requires arg 'subdir'." \
73
+ "Error OK: check that '$cmd' requires subdir"
74
+ done
75
+ }
76
+
77
+ {
78
+ is "$(
79
+ cd $OWNER/bar
80
+ catch git subrepo clone foo bar baz quux
81
+ )" \
82
+ "git-subrepo: Unknown argument(s) 'baz quux' for 'clone' command." \
83
+ "Error OK: extra arguments for clone"
84
+ }
85
+
86
+ {
87
+ is "$(
88
+ cd $OWNER/bar
89
+ catch git subrepo clone .git
90
+ )" \
91
+ "git-subrepo: Can't determine subdir from '.git'." \
92
+ "Error OK: check error in subdir guess"
93
+ }
94
+
95
+ {
96
+ is "$(
97
+ cd $OWNER/bar
98
+ catch git subrepo pull lala
99
+ )" \
100
+ "git-subrepo: No 'lala/.gitrepo' file." \
101
+ "Error OK: check for valid subrepo subdir"
102
+ }
103
+
104
+ {
105
+ is "$(
106
+ cd $OWNER/bar
107
+ git checkout --quiet $(git rev-parse master)
108
+ catch git subrepo status
109
+ )" \
110
+ "git-subrepo: Must be on a branch to run this command." \
111
+ "Error OK: check repo is on a branch"
112
+ (
113
+ cd $OWNER/bar
114
+ git checkout --quiet master
115
+ )
116
+ }
117
+
118
+ {
119
+ is "$(
120
+ cd .git
121
+ catch git subrepo status
122
+ )" \
123
+ "git-subrepo: Can't 'subrepo status' outside a working tree." \
124
+ "Error OK: check inside working tree"
125
+ }
126
+
127
+ {
128
+ like "$(
129
+ cd $OWNER/bar
130
+ touch me
131
+ git add me
132
+ catch git subrepo clone ../../../$UPSTREAM/foo
133
+ )" \
134
+ "git-subrepo: Can't clone subrepo. Working tree has changes." \
135
+ "Error OK: check no working tree changes"
136
+ (
137
+ cd $OWNER/bar
138
+ git reset --quiet --hard
139
+ )
140
+ }
141
+
142
+ {
143
+ is "$(
144
+ cd lib
145
+ catch git subrepo status
146
+ )" \
147
+ "git-subrepo: Need to run subrepo command from top level directory of the repo." \
148
+ "Error OK: check cwd is at top level"
149
+ }
150
+
151
+ {
152
+ is "$(
153
+ cd $OWNER/bar
154
+ catch git subrepo clone dummy bard
155
+ )" \
156
+ "git-subrepo: The subdir 'bard' exists and is not empty." \
157
+ "Error OK: non-empty clone subdir target"
158
+ }
159
+
160
+ {
161
+ is "$(
162
+ cd $OWNER/bar
163
+ catch git subrepo clone dummy-repo
164
+ )" \
165
+ "git-subrepo: Command failed: 'git ls-remote dummy-repo'." \
166
+ "Error OK: clone non-repo"
167
+ }
168
+
169
+ done_testing
170
+
171
+ teardown
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+ clone-foo-and-bar
10
+
11
+ subrepo-clone-bar-into-foo
12
+
13
+ (
14
+ cd $OWNER/bar
15
+ add-new-files Bar2
16
+ git tag -a CoolTag -m "Should stay in subrepo"
17
+ git push
18
+ ) &> /dev/null || die
19
+
20
+
21
+ # Fetch information
22
+ {
23
+ is "$(
24
+ cd $OWNER/foo
25
+ git subrepo fetch bar
26
+ )" \
27
+ "Fetched 'bar' from '../../../tmp/upstream/bar' (master)." \
28
+ 'subrepo fetch command output is correct'
29
+ }
30
+
31
+ # Check that there is no tags fetched
32
+ {
33
+ is "$(
34
+ cd $OWNER/foo
35
+ git tag -l 'CoolTag'
36
+ )" \
37
+ "" \
38
+ 'No tag is available'
39
+ }
40
+
41
+ done_testing
42
+
43
+ teardown
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+ clone-foo-and-bar
10
+
11
+ subrepo-clone-bar-into-foo
12
+
13
+ (
14
+ cd $OWNER/bar
15
+ add-new-files Bar2
16
+ git push
17
+ ) &> /dev/null || die
18
+
19
+ (
20
+ cd $OWNER/foo
21
+ echo ".*" >> .gitignore
22
+ git add .gitignore
23
+ git commit -m "Add gitignore"
24
+ git push
25
+ ) &> /dev/null || die
26
+
27
+
28
+
29
+ # Do the pull and check output:
30
+ {
31
+ is "$(
32
+ cd $OWNER/foo
33
+ git subrepo pull bar
34
+ )" \
35
+ "Subrepo 'bar' pulled from '../../../tmp/upstream/bar' (master)." \
36
+ 'subrepo pull command output is correct'
37
+ }
38
+
39
+ # Test subrepo file content:
40
+ gitrepo=$OWNER/foo/bar/.gitrepo
41
+ {
42
+ test-exists \
43
+ "$OWNER/foo/bar/Bar2" \
44
+ "$gitrepo"
45
+ }
46
+
47
+ # Test foo/bar/.gitrepo file contents:
48
+ {
49
+ foo_pull_commit="$(cd $OWNER/foo; git rev-parse HEAD^)"
50
+ bar_head_commit="$(cd $OWNER/bar; git rev-parse HEAD)"
51
+ test-gitrepo-comment-block
52
+ test-gitrepo-field "remote" "../../../$UPSTREAM/bar"
53
+ test-gitrepo-field "branch" "master"
54
+ test-gitrepo-field "commit" "$bar_head_commit"
55
+ test-gitrepo-field "parent" "$foo_pull_commit"
56
+ test-gitrepo-field "cmdver" "`git subrepo --version`"
57
+ }
58
+
59
+ done_testing
60
+
61
+ teardown