eac_git 0.18.1 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/eac_git/local/changed_file.rb +2 -2
  3. data/lib/eac_git/local/commit/diff_tree_line.rb +1 -1
  4. data/lib/eac_git/local/remote.rb +32 -8
  5. data/lib/eac_git/local/subrepo/config.rb +2 -0
  6. data/lib/eac_git/local.rb +2 -2
  7. data/lib/eac_git/remote_like/ls_result.rb +1 -1
  8. data/lib/eac_git/remote_like.rb +0 -1
  9. data/lib/eac_git/rspec/stubbed_git_local_repo.rb +0 -2
  10. data/lib/eac_git/rspec.rb +0 -1
  11. data/lib/eac_git/version.rb +1 -1
  12. data/lib/eac_git.rb +0 -2
  13. data/vendor/git-subrepo/.fish.rc +20 -0
  14. data/vendor/git-subrepo/.gitattributes +1 -0
  15. data/vendor/git-subrepo/.github/workflows/test.yml +29 -0
  16. data/vendor/git-subrepo/.gitignore +1 -0
  17. data/vendor/git-subrepo/.gitrepo +7 -0
  18. data/vendor/git-subrepo/.rc +32 -0
  19. data/vendor/git-subrepo/Changes +66 -0
  20. data/vendor/git-subrepo/Intro.pod +2 -5
  21. data/vendor/git-subrepo/Makefile +45 -5
  22. data/vendor/git-subrepo/Meta +2 -2
  23. data/vendor/git-subrepo/ReadMe.pod +26 -31
  24. data/vendor/git-subrepo/doc/git-subrepo.swim +22 -18
  25. data/vendor/git-subrepo/doc/intro-to-subrepo.swim +2 -4
  26. data/vendor/git-subrepo/ext/bashplus/.gitrepo +12 -0
  27. data/vendor/git-subrepo/ext/bashplus/.travis.yml +6 -0
  28. data/vendor/git-subrepo/ext/bashplus/Changes +19 -0
  29. data/vendor/git-subrepo/ext/bashplus/License +1 -1
  30. data/vendor/git-subrepo/ext/bashplus/Makefile +25 -0
  31. data/vendor/git-subrepo/ext/bashplus/Meta +4 -4
  32. data/vendor/git-subrepo/ext/bashplus/ReadMe.pod +2 -2
  33. data/vendor/git-subrepo/ext/bashplus/bin/bash+ +8 -7
  34. data/vendor/git-subrepo/ext/bashplus/doc/bash+.swim +1 -1
  35. data/vendor/git-subrepo/ext/bashplus/lib/bash+.bash +85 -38
  36. data/vendor/git-subrepo/ext/bashplus/man/man1/bash+.1 +8 -8
  37. data/vendor/git-subrepo/ext/bashplus/man/man3/bash+.3 +8 -8
  38. data/vendor/git-subrepo/ext/bashplus/test/base.t +4 -5
  39. data/vendor/git-subrepo/ext/bashplus/test/die.t +16 -0
  40. data/vendor/git-subrepo/ext/bashplus/test/fcopy.t +2 -3
  41. data/vendor/git-subrepo/ext/bashplus/test/{test.bash → setup} +18 -8
  42. data/vendor/git-subrepo/ext/bashplus/test/shellcheck.t +37 -0
  43. data/vendor/git-subrepo/ext/bashplus/test/source-bash+-std.t +10 -11
  44. data/vendor/git-subrepo/ext/bashplus/test/source-bash+.t +10 -11
  45. data/vendor/git-subrepo/ext/bashplus/test/use.t +8 -5
  46. data/vendor/git-subrepo/ext/bashplus/test/version-check.t +23 -0
  47. data/vendor/git-subrepo/ext/test-more-bash/.gitrepo +12 -0
  48. data/vendor/git-subrepo/ext/test-more-bash/.travis.yml +6 -0
  49. data/vendor/git-subrepo/ext/test-more-bash/Changes +11 -0
  50. data/vendor/git-subrepo/ext/test-more-bash/License +1 -1
  51. data/vendor/git-subrepo/ext/test-more-bash/Makefile +25 -0
  52. data/vendor/git-subrepo/ext/test-more-bash/Meta +5 -5
  53. data/vendor/git-subrepo/ext/test-more-bash/ReadMe.pod +9 -3
  54. data/vendor/git-subrepo/ext/test-more-bash/doc/test-more.swim +7 -2
  55. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/.gitrepo +12 -0
  56. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/.travis.yml +6 -0
  57. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Changes +11 -0
  58. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/License +1 -1
  59. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Makefile +25 -0
  60. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Meta +3 -3
  61. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/ReadMe.pod +2 -2
  62. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/bin/bash+ +8 -7
  63. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/doc/bash+.swim +1 -1
  64. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/lib/bash+.bash +85 -38
  65. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man1/bash+.1 +8 -8
  66. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man3/bash+.3 +8 -8
  67. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/base.t +4 -4
  68. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/die.t +17 -0
  69. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/fcopy.t +2 -2
  70. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/{test.bash → setup} +17 -8
  71. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/shellcheck.t +38 -0
  72. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+-std.t +10 -10
  73. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+.t +10 -10
  74. data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/use.t +8 -4
  75. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/.gitrepo +12 -0
  76. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/.travis.yml +5 -0
  77. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Changes +11 -0
  78. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/License +1 -1
  79. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Makefile +30 -0
  80. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Meta +3 -3
  81. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/ReadMe.pod +2 -2
  82. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/doc/test-tap.swim +1 -1
  83. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/lib/test/tap.bash +46 -42
  84. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/man/man3/test-tap.3 +8 -8
  85. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/bail_out.t +1 -1
  86. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail.t +1 -1
  87. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail_fast.t +1 -1
  88. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/helper.bash +1 -1
  89. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/shellcheck.t +42 -0
  90. data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/tap.t +11 -5
  91. data/vendor/git-subrepo/ext/test-more-bash/lib/test/more.bash +35 -15
  92. data/vendor/git-subrepo/ext/test-more-bash/man/man3/test-more.3 +16 -10
  93. data/vendor/git-subrepo/ext/test-more-bash/test/fail.t +15 -1
  94. data/vendor/git-subrepo/ext/test-more-bash/test/more.t +12 -4
  95. data/vendor/git-subrepo/ext/test-more-bash/test/setup +3 -3
  96. data/vendor/git-subrepo/ext/test-more-bash/test/shellcheck.t +35 -0
  97. data/vendor/git-subrepo/ext/test-more-bash/test/test/fail1.t +14 -1
  98. data/vendor/git-subrepo/lib/git-subrepo +375 -260
  99. data/vendor/git-subrepo/lib/git-subrepo.d/help-functions.bash +21 -22
  100. data/vendor/git-subrepo/man/man1/git-subrepo.1 +125 -141
  101. data/vendor/git-subrepo/pkg/bin/generate-completion.pl +0 -7
  102. data/vendor/git-subrepo/pkg/bin/generate-help-functions.pl +0 -2
  103. data/vendor/git-subrepo/share/completion.bash +1 -3
  104. data/vendor/git-subrepo/share/enable-completion.sh +3 -3
  105. data/vendor/git-subrepo/share/zsh-completion/_git-subrepo +2 -7
  106. data/vendor/git-subrepo/test/Dockerfile +112 -0
  107. data/vendor/git-subrepo/test/branch-all.t +6 -6
  108. data/vendor/git-subrepo/test/branch-rev-list-one-path.t +7 -8
  109. data/vendor/git-subrepo/test/branch-rev-list.t +7 -8
  110. data/vendor/git-subrepo/test/branch.t +9 -9
  111. data/vendor/git-subrepo/test/clean.t +3 -3
  112. data/vendor/git-subrepo/test/clone-annotated-tag.t +7 -7
  113. data/vendor/git-subrepo/test/clone.t +20 -25
  114. data/vendor/git-subrepo/test/config.t +7 -6
  115. data/vendor/git-subrepo/test/encode.t +17 -17
  116. data/vendor/git-subrepo/test/error.t +18 -18
  117. data/vendor/git-subrepo/test/fetch.t +4 -4
  118. data/vendor/git-subrepo/test/gitignore.t +8 -8
  119. data/vendor/git-subrepo/test/init.t +6 -7
  120. data/vendor/git-subrepo/test/issue29.t +3 -3
  121. data/vendor/git-subrepo/test/issue95.t +2 -2
  122. data/vendor/git-subrepo/test/issue96.t +3 -3
  123. data/vendor/git-subrepo/test/pull-all.t +5 -5
  124. data/vendor/git-subrepo/test/pull-merge.t +16 -15
  125. data/vendor/git-subrepo/test/pull-message.t +12 -12
  126. data/vendor/git-subrepo/test/pull-new-branch.t +8 -7
  127. data/vendor/git-subrepo/test/pull-ours.t +10 -10
  128. data/vendor/git-subrepo/test/pull-theirs.t +8 -8
  129. data/vendor/git-subrepo/test/pull-twice.t +4 -4
  130. data/vendor/git-subrepo/test/pull-worktree.t +5 -5
  131. data/vendor/git-subrepo/test/pull.t +14 -14
  132. data/vendor/git-subrepo/test/push-after-init.t +7 -6
  133. data/vendor/git-subrepo/test/push-after-push-no-changes.t +27 -0
  134. data/vendor/git-subrepo/test/push-force.t +7 -6
  135. data/vendor/git-subrepo/test/push-new-branch.t +10 -10
  136. data/vendor/git-subrepo/test/push-no-changes.t +3 -3
  137. data/vendor/git-subrepo/test/push-squash.t +7 -7
  138. data/vendor/git-subrepo/test/push.t +35 -34
  139. data/vendor/git-subrepo/test/rebase.t +63 -0
  140. data/vendor/git-subrepo/test/reclone.t +15 -8
  141. data/vendor/git-subrepo/test/setup +62 -55
  142. data/vendor/git-subrepo/test/shellcheck.t +37 -0
  143. data/vendor/git-subrepo/test/status.t +47 -27
  144. data/vendor/git-subrepo/test/submodule.t +4 -4
  145. data/vendor/git-subrepo/test/zsh.t +27 -0
  146. metadata +42 -22
@@ -19,26 +19,26 @@ note "Pull - Conflict - Use theirs - Push"
19
19
  #
20
20
 
21
21
  (
22
- cd $OWNER/bar
22
+ cd "$OWNER/bar"
23
23
  add-new-files Bar2
24
24
  git push
25
25
  ) &> /dev/null || die
26
26
 
27
27
  (
28
- cd $OWNER/foo
28
+ cd "$OWNER/foo"
29
29
  git subrepo pull bar
30
30
  modify-files-ex bar/Bar2
31
31
  git push
32
32
  ) &> /dev/null || die
33
33
 
34
34
  (
35
- cd $OWNER/bar
35
+ cd "$OWNER/bar"
36
36
  modify-files-ex Bar2
37
37
  git push
38
38
  ) &> /dev/null || die
39
39
 
40
40
  (
41
- cd $OWNER/foo
41
+ cd "$OWNER/foo"
42
42
  git subrepo pull bar || {
43
43
  cd .git/tmp/subrepo/bar
44
44
  git checkout --theirs Bar2
@@ -54,18 +54,18 @@ test-exists \
54
54
  "$OWNER/foo/bar/Bar2" \
55
55
  "$OWNER/bar/Bar2" \
56
56
 
57
- is "$(cat $OWNER/foo/bar/Bar2)" \
57
+ is "$(cat "$OWNER/foo/bar/Bar2")" \
58
58
  "new file Bar2"$'\n'"Bar2" \
59
59
  "The readme file in the mainrepo is theirs"
60
60
 
61
61
  (
62
- cd $OWNER/foo
62
+ cd "$OWNER/foo"
63
63
  cat bar/Bar2
64
64
  git subrepo push bar
65
65
  ) &> /dev/null || die
66
66
 
67
67
  (
68
- cd $OWNER/bar
68
+ cd "$OWNER/bar"
69
69
  git pull
70
70
  ) &> /dev/null || die
71
71
 
@@ -73,7 +73,7 @@ test-exists \
73
73
  "$OWNER/foo/bar/Bar2" \
74
74
  "$OWNER/bar/Bar2" \
75
75
 
76
- is "$(cat $OWNER/bar/Bar2)" \
76
+ is "$(cat "$OWNER/bar/Bar2")" \
77
77
  "new file Bar2"$'\n'"Bar2" \
78
78
  "The readme file in the subrepo is theirs"
79
79
 
@@ -11,26 +11,26 @@ clone-foo-and-bar
11
11
  subrepo-clone-bar-into-foo
12
12
 
13
13
  (
14
- cd $OWNER/bar
14
+ cd "$OWNER/bar"
15
15
  add-new-files Bar2
16
16
  git push
17
17
  ) &> /dev/null || die
18
18
 
19
19
  (
20
- cd $OWNER/foo
20
+ cd "$OWNER/foo"
21
21
  add-new-files bar/Foo2
22
22
  git push
23
23
  git subrepo pull bar
24
24
  ) &> /dev/null || die
25
25
 
26
26
  (
27
- cd $OWNER/bar
27
+ cd "$OWNER/bar"
28
28
  add-new-files Bar3
29
29
  git push
30
30
  ) &> /dev/null || die
31
31
 
32
32
  (
33
- cd $OWNER/foo
33
+ cd "$OWNER/foo"
34
34
  git subrepo pull bar
35
35
  ) &> /dev/null || die
36
36
 
@@ -9,28 +9,28 @@ use Test::More
9
9
  clone-foo-and-bar
10
10
 
11
11
  (
12
- cd $OWNER/foo
12
+ cd "$OWNER/foo"
13
13
  git subrepo clone ../bar bar
14
14
  git worktree add -b test ../wt
15
15
  ) &> /dev/null || die
16
16
 
17
17
  (
18
- cd $OWNER/bar
18
+ cd "$OWNER/bar"
19
19
  modify-files Bar
20
20
  ) &> /dev/null || die
21
21
 
22
22
  (
23
- cd $OWNER/wt
23
+ cd "$OWNER/wt"
24
24
  git subrepo pull --all
25
25
  ) &> /dev/null || die
26
26
 
27
27
  (
28
- cd $OWNER/foo
28
+ cd "$OWNER/foo"
29
29
  git merge test
30
30
  ) &> /dev/null || die
31
31
 
32
32
  {
33
- is "$(cat $OWNER/foo/bar/Bar)" \
33
+ is "$(cat "$OWNER/foo/bar/Bar")" \
34
34
  "a new line" \
35
35
  'bar/Bar content correct'
36
36
  }
@@ -11,7 +11,7 @@ clone-foo-and-bar
11
11
  subrepo-clone-bar-into-foo
12
12
 
13
13
  (
14
- cd $OWNER/bar
14
+ cd "$OWNER/bar"
15
15
  add-new-files Bar2
16
16
  git push
17
17
  ) &> /dev/null || die
@@ -20,10 +20,10 @@ subrepo-clone-bar-into-foo
20
20
  # Do the pull and check output:
21
21
  {
22
22
  is "$(
23
- cd $OWNER/foo
23
+ cd "$OWNER/foo"
24
24
  git subrepo pull bar
25
25
  )" \
26
- "Subrepo 'bar' pulled from '../../../tmp/upstream/bar' (master)." \
26
+ "Subrepo 'bar' pulled from '$UPSTREAM/bar' (master)." \
27
27
  'subrepo pull command output is correct'
28
28
  }
29
29
 
@@ -37,33 +37,33 @@ gitrepo=$OWNER/foo/bar/.gitrepo
37
37
 
38
38
  # Test foo/bar/.gitrepo file contents:
39
39
  {
40
- foo_pull_commit="$(cd $OWNER/foo; git rev-parse HEAD^)"
41
- bar_head_commit="$(cd $OWNER/bar; git rev-parse HEAD)"
40
+ foo_pull_commit=$(cd "$OWNER/foo"; git rev-parse HEAD^)
41
+ bar_head_commit=$(cd "$OWNER/bar"; git rev-parse HEAD)
42
42
  test-gitrepo-comment-block
43
- test-gitrepo-field "remote" "../../../$UPSTREAM/bar"
43
+ test-gitrepo-field "remote" "$UPSTREAM/bar"
44
44
  test-gitrepo-field "branch" "master"
45
45
  test-gitrepo-field "commit" "$bar_head_commit"
46
46
  test-gitrepo-field "parent" "$foo_pull_commit"
47
- test-gitrepo-field "cmdver" "`git subrepo --version`"
47
+ test-gitrepo-field "cmdver" "$(git subrepo --version)"
48
48
  }
49
49
 
50
50
  # Check commit messages
51
51
  {
52
- foo_new_commit_message="$(cd $OWNER/foo; git log --format=%B -n 1)"
52
+ foo_new_commit_message=$(cd "$OWNER/foo"; git log --format=%B -n 1)
53
53
  like "$foo_new_commit_message" \
54
54
  "git subrepo pull bar" \
55
55
  "Subrepo pull commit message OK"
56
- bar_commit_short="$(git rev-parse --short $bar_head_commit)"
56
+ bar_commit_short=$(git rev-parse --short "$bar_head_commit")
57
57
  like "$foo_new_commit_message" \
58
- 'merged: \"'$bar_commit_short \
58
+ "merged: \"$bar_commit_short" \
59
59
  "Pull commit contains merged"
60
60
  }
61
61
 
62
62
  # Check that we detect that we don't need to pull
63
63
  {
64
64
  is "$(
65
- cd $OWNER/foo
66
- git subrepo pull bar
65
+ cd "$OWNER/foo"
66
+ git subrepo pull bar
67
67
  )" \
68
68
  "Subrepo 'bar' is up to date." \
69
69
  'subrepo detects that we dont need to pull'
@@ -72,7 +72,7 @@ gitrepo=$OWNER/foo/bar/.gitrepo
72
72
  # Test pull if we have rebased the original subrepo so that our clone
73
73
  # commit is no longer present in the history
74
74
  (
75
- cd $OWNER/bar
75
+ cd "$OWNER/bar"
76
76
  git reset --hard master^^
77
77
  add-new-files Bar3
78
78
  git push --force
@@ -84,7 +84,7 @@ gitrepo=$OWNER/foo/bar/.gitrepo
84
84
  }
85
85
 
86
86
  (
87
- cd $OWNER/foo
87
+ cd "$OWNER/foo"
88
88
  git subrepo pull bar || touch pull_failed
89
89
  ) &> /dev/null || die
90
90
 
@@ -10,8 +10,8 @@ use Test::More
10
10
  # cases when you don't have any previous commits to rely on
11
11
  # see issue/122
12
12
  (
13
- mkdir -p $OWNER/init
14
- cd $OWNER/init
13
+ mkdir -p "$OWNER/init"
14
+ cd "$OWNER/init"
15
15
  git init
16
16
  mkdir doc
17
17
  add-new-files doc/FooBar
@@ -20,15 +20,16 @@ use Test::More
20
20
  git init --bare ../upstream || die
21
21
  ) &> /dev/null
22
22
 
23
- output="$(
24
- cd $OWNER/init
23
+ output=$(
24
+ cd "$OWNER/init"
25
25
  git subrepo push doc --remote=../upstream
26
- )"
26
+ )
27
27
 
28
28
  is "$output" "Subrepo 'doc' pushed to '../upstream' (master)." \
29
29
  'Command output is correct'
30
30
 
31
31
  # Test init/doc/.gitrepo file contents:
32
+ # shellcheck disable=2034
32
33
  gitrepo=$OWNER/init/doc/.gitrepo
33
34
  {
34
35
  test-gitrepo-field "remote" "../upstream"
@@ -36,7 +37,7 @@ gitrepo=$OWNER/init/doc/.gitrepo
36
37
  }
37
38
 
38
39
  (
39
- cd $OWNER
40
+ cd "$OWNER"
40
41
  git clone upstream up
41
42
  ) &>/dev/null
42
43
 
@@ -0,0 +1,27 @@
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
+ subrepo-clone-bar-into-foo
11
+
12
+ {
13
+ message=$(
14
+ cd "$OWNER/foo"
15
+ git subrepo push bar > /dev/null
16
+ add-new-files bar/Bar1
17
+ catch git subrepo push bar
18
+ )
19
+
20
+ is "$message" \
21
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
22
+ "Output OK: Check that 'push' after an empty push works."
23
+ }
24
+
25
+ done_testing 1
26
+
27
+ teardown
@@ -11,19 +11,19 @@ clone-foo-and-bar
11
11
  subrepo-clone-bar-into-foo
12
12
 
13
13
  (
14
- cd $OWNER/bar
14
+ cd "$OWNER/bar"
15
15
  add-new-files Bar2
16
16
  git push
17
17
  ) &> /dev/null || die
18
18
 
19
19
  (
20
- cd $OWNER/foo
20
+ cd "$OWNER/foo"
21
21
  add-new-files bar/Foo1
22
22
  git subrepo push bar --force
23
23
  ) &> /dev/null || die
24
24
 
25
25
  (
26
- cd $OWNER/foo
26
+ cd "$OWNER/foo"
27
27
  git subrepo pull bar
28
28
  ) &> /dev/null || die
29
29
 
@@ -34,17 +34,18 @@ test-exists \
34
34
  # Pull here will actually merge the old master with the new one
35
35
  (
36
36
  set +x
37
- cd $OWNER/bar
38
- git pull
37
+ cd "$OWNER/bar"
38
+ git pull --rebase=false
39
39
  ) &> /dev/null || die
40
40
 
41
41
  test-exists \
42
42
  "$OWNER/bar/Bar2" \
43
43
  "$OWNER/bar/Foo1" \
44
44
 
45
+
45
46
  # Test that a fresh repo is not contaminated
46
47
  (
47
- git clone $UPSTREAM/bar $OWNER/newbar
48
+ git clone "$UPSTREAM/bar" "$OWNER/newbar"
48
49
  ) &> /dev/null || die
49
50
 
50
51
  test-exists \
@@ -11,10 +11,10 @@ clone-foo-and-bar
11
11
  # Make various changes to the repos for testing subrepo push:
12
12
  (
13
13
  # In the main repo:
14
- cd $OWNER/foo
14
+ cd "$OWNER/foo"
15
15
 
16
16
  # Clone the subrepo into a subdir
17
- git subrepo clone ../../../$UPSTREAM/bar
17
+ git subrepo clone "$UPSTREAM/bar"
18
18
 
19
19
  # Make a commit:
20
20
  add-new-files bar/FooBar
@@ -22,23 +22,23 @@ clone-foo-and-bar
22
22
 
23
23
  # Do the subrepo push to another branch:
24
24
  {
25
- message="$(
26
- cd $OWNER/foo
25
+ message=$(
26
+ cd "$OWNER/foo"
27
27
  git subrepo push bar --branch newbar
28
- )"
28
+ )
29
29
 
30
30
  # Test the output:
31
31
  is "$message" \
32
- "Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (newbar)." \
32
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (newbar)." \
33
33
  'First push message is correct '
34
34
  }
35
35
 
36
36
  # Do the subrepo push to another branch again:
37
37
  {
38
- message="$(
39
- cd $OWNER/foo
38
+ message=$(
39
+ cd "$OWNER/foo"
40
40
  git subrepo push bar --branch newbar
41
- )"
41
+ )
42
42
 
43
43
  # Test the output:
44
44
  is "$message" \
@@ -48,7 +48,7 @@ clone-foo-and-bar
48
48
 
49
49
  # Pull the changes from UPSTREAM/bar in OWNER/bar
50
50
  (
51
- cd $OWNER/bar
51
+ cd "$OWNER/bar"
52
52
  git fetch
53
53
  git checkout newbar
54
54
  ) &> /dev/null || die
@@ -12,14 +12,14 @@ clone-foo-and-bar
12
12
 
13
13
  {
14
14
  is "$(
15
- cd $OWNER/bar
16
- git subrepo --quiet clone ../../../$UPSTREAM/foo
15
+ cd "$OWNER/bar"
16
+ git subrepo --quiet clone "$UPSTREAM/foo"
17
17
  catch git subrepo push foo
18
18
  )" \
19
19
  "Subrepo 'foo' has no new commits to push." \
20
20
  "Output OK: Check that 'push' requires changes to push"
21
21
  (
22
- cd $OWNER/bar
22
+ cd "$OWNER/bar"
23
23
  git subrepo --quiet clean foo
24
24
  )
25
25
  }
@@ -11,10 +11,10 @@ clone-foo-and-bar
11
11
  # Make various changes to the repos for testing subrepo push:
12
12
  (
13
13
  # In the main repo:
14
- cd $OWNER/foo
14
+ cd "$OWNER/foo"
15
15
 
16
16
  # Clone the subrepo into a subdir
17
- git subrepo clone ../../../$UPSTREAM/bar
17
+ git subrepo clone "$UPSTREAM/bar"
18
18
 
19
19
  # Make a series of commits:
20
20
  add-new-files bar/FooBar1
@@ -26,19 +26,19 @@ clone-foo-and-bar
26
26
 
27
27
  # Do the subrepo push and test the output:
28
28
  {
29
- message="$(
30
- cd $OWNER/foo
29
+ message=$(
30
+ cd "$OWNER/foo"
31
31
  git subrepo push bar --squash
32
- )"
32
+ )
33
33
 
34
34
  # Test the output:
35
35
  is "$message" \
36
- "Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (master)." \
36
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
37
37
  'push message is correct'
38
38
  }
39
39
 
40
40
  (
41
- cd $OWNER/bar
41
+ cd "$OWNER/bar"
42
42
  git pull
43
43
  ) &> /dev/null || die
44
44
 
@@ -13,10 +13,10 @@ clone-foo-and-bar
13
13
  # Make various changes to the repos for testing subrepo push:
14
14
  (
15
15
  # In the main repo:
16
- cd $OWNER/foo
16
+ cd "$OWNER/foo"
17
17
 
18
18
  # Clone the subrepo into a subdir
19
- git subrepo clone ../../../$UPSTREAM/bar
19
+ git subrepo clone "$UPSTREAM/bar"
20
20
 
21
21
  # Make a series of commits:
22
22
  add-new-files bar/FooBar
@@ -27,37 +27,37 @@ clone-foo-and-bar
27
27
  ) &> /dev/null || die
28
28
 
29
29
  (
30
- cd $OWNER/bar
30
+ cd "$OWNER/bar"
31
31
  add-new-files bargy
32
32
  git push
33
33
  ) &> /dev/null || die
34
34
 
35
35
  # Do the subrepo push and test the output:
36
36
  {
37
- message="$(
38
- cd $OWNER/foo
37
+ message=$(
38
+ cd "$OWNER/foo"
39
39
  git config user.name 'PushUser'
40
40
  git config user.email 'push@push'
41
41
  git subrepo pull --quiet bar
42
42
  git subrepo push bar
43
- )"
43
+ )
44
44
 
45
45
  # Test the output:
46
46
  is "$message" \
47
- "Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (master)." \
47
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
48
48
  'push message is correct'
49
49
  }
50
50
 
51
51
  (
52
- cd $OWNER/bar
52
+ cd "$OWNER/bar"
53
53
  git pull
54
54
  ) &> /dev/null || die
55
55
 
56
56
  {
57
- pullCommit="$(
58
- cd $OWNER/bar
57
+ pullCommit=$(
58
+ cd "$OWNER/bar"
59
59
  git log HEAD -1 --pretty='format:%an %ae %cn %ce'
60
- )"
60
+ )
61
61
 
62
62
  is "$pullCommit" \
63
63
  "PushUser push@push PushUser push@push" \
@@ -65,10 +65,10 @@ clone-foo-and-bar
65
65
  }
66
66
 
67
67
  {
68
- subrepoCommit="$(
69
- cd $OWNER/bar
68
+ subrepoCommit=$(
69
+ cd "$OWNER/bar"
70
70
  git log HEAD^ -1 --pretty='format:%an %ae %cn %ce'
71
- )"
71
+ )
72
72
 
73
73
  is "$subrepoCommit" \
74
74
  "FooUser foo@foo PushUser push@push" \
@@ -79,39 +79,40 @@ clone-foo-and-bar
79
79
  test-commit-count "$OWNER/bar" HEAD 7
80
80
 
81
81
  # Test foo/bar/.gitrepo file contents:
82
+ # shellcheck disable=2034
82
83
  gitrepo=$OWNER/foo/bar/.gitrepo
83
84
  {
84
- foo_pull_commit="$(cd $OWNER/foo; git rev-parse HEAD^)"
85
- bar_head_commit="$(cd $OWNER/bar; git rev-parse HEAD)"
86
- test-gitrepo-field "remote" "../../../$UPSTREAM/bar"
85
+ foo_pull_commit=$(cd "$OWNER/foo"; git rev-parse HEAD^)
86
+ bar_head_commit=$(cd "$OWNER/bar"; git rev-parse HEAD)
87
+ test-gitrepo-field "remote" "$UPSTREAM/bar"
87
88
  test-gitrepo-field "branch" "master"
88
89
  test-gitrepo-field "commit" "$bar_head_commit"
89
90
  test-gitrepo-field "parent" "$foo_pull_commit"
90
- test-gitrepo-field "cmdver" "`git subrepo --version`"
91
+ test-gitrepo-field "cmdver" "$(git subrepo --version)"
91
92
  }
92
93
 
93
94
  (
94
95
  # In the main repo:
95
- cd $OWNER/foo
96
+ cd "$OWNER/foo"
96
97
  add-new-files bar/FooBar2
97
98
  modify-files bar/FooBar
98
99
  ) &> /dev/null || die
99
100
 
100
101
  {
101
- message="$(
102
- cd $OWNER/foo
102
+ message=$(
103
+ cd "$OWNER/foo"
103
104
  git subrepo push bar
104
- )"
105
+ )
105
106
 
106
107
  # Test the output:
107
108
  is "$message" \
108
- "Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (master)." \
109
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
109
110
  'push message is correct'
110
111
  }
111
112
 
112
113
  # Pull the changes from UPSTREAM/bar in OWNER/bar
113
114
  (
114
- cd $OWNER/bar
115
+ cd "$OWNER/bar"
115
116
  git pull
116
117
  ) &> /dev/null || die
117
118
 
@@ -124,7 +125,7 @@ test-exists \
124
125
 
125
126
  (
126
127
  # In the main repo:
127
- cd $OWNER/foo
128
+ cd "$OWNER/foo"
128
129
  add-new-files bar/FooBar3
129
130
  modify-files bar/FooBar
130
131
  git subrepo push bar
@@ -133,20 +134,20 @@ test-exists \
133
134
  ) &> /dev/null || die
134
135
 
135
136
  {
136
- message="$(
137
- cd $OWNER/foo
137
+ message=$(
138
+ cd "$OWNER/foo"
138
139
  git subrepo push bar
139
- )"
140
+ )
140
141
 
141
142
  # Test the output:
142
143
  is "$message" \
143
- "Subrepo 'bar' pushed to '../../../tmp/upstream/bar' (master)." \
144
+ "Subrepo 'bar' pushed to '$UPSTREAM/bar' (master)." \
144
145
  'Seqential pushes are correct'
145
146
  }
146
147
 
147
148
  (
148
149
  # In the subrepo
149
- cd $OWNER/bar
150
+ cd "$OWNER/bar"
150
151
  git pull
151
152
  add-new-files barBar2
152
153
  git push
@@ -154,16 +155,16 @@ test-exists \
154
155
 
155
156
  (
156
157
  # In the main repo:
157
- cd $OWNER/foo
158
+ cd "$OWNER/foo"
158
159
  add-new-files bar/FooBar5
159
160
  modify-files bar/FooBar3
160
161
  ) &> /dev/null || die
161
162
 
162
163
  {
163
- message="$(
164
- cd $OWNER/foo
164
+ message=$(
165
+ cd "$OWNER/foo"
165
166
  git subrepo push bar 2>&1 || true
166
- )"
167
+ )
167
168
 
168
169
  # Test the output:
169
170
  is "$message" \
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ source test/setup
6
+
7
+ use Test::More
8
+
9
+ # Setup foo with 2 branches, one before the subrepo
10
+ # is added and one after so that we can rebase
11
+ # thus destroying the parent in two ways. The first
12
+ # destroys the second parent, but leave a reference to
13
+ # a merge point. The second such that no history of
14
+ # a merge point exists.
15
+
16
+ clone-foo-and-bar
17
+
18
+ (
19
+ cd "$OWNER/foo"
20
+ git switch -c branch1
21
+ add-new-files foo1
22
+ subrepo-clone-bar-into-foo
23
+ git branch branch2
24
+ add-new-files foo2
25
+ ) &> /dev/null || die
26
+
27
+ (
28
+ cd "$OWNER/bar"
29
+ add-new-files bar2
30
+ git push
31
+ ) &> /dev/null || die
32
+
33
+ (
34
+ cd "$OWNER/foo"
35
+ # Rebasing onto this merge point will still
36
+ # be able to find the merge point at branch1
37
+ git subrepo pull bar
38
+ )
39
+
40
+ (
41
+ cd "$OWNER/foo"
42
+ git switch branch2
43
+ add-new-files foo-branch2
44
+ git switch branch1
45
+ git rebase branch2
46
+ ) &> /dev/null || die
47
+
48
+ # Force subrepo to search of the parent SHA,
49
+ # validate it found the prevous merge point
50
+ {
51
+ output=$(
52
+ cd "$OWNER/foo"
53
+ git subrepo clean --force --all
54
+ catch git subrepo branch bar
55
+ )
56
+
57
+ like "$output" "caused by a rebase" \
58
+ "subrepo detected merge point"
59
+ }
60
+
61
+ done_testing 1
62
+
63
+ teardown