eac_git 0.18.1 → 0.18.2
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.
- checksums.yaml +4 -4
- data/lib/eac_git/local/remote.rb +0 -2
- data/lib/eac_git/local/subrepo/config.rb +2 -0
- data/lib/eac_git/remote_like/ls_result.rb +1 -1
- data/lib/eac_git/remote_like.rb +0 -1
- data/lib/eac_git/rspec/stubbed_git_local_repo.rb +0 -2
- data/lib/eac_git/rspec.rb +0 -1
- data/lib/eac_git/version.rb +1 -1
- data/lib/eac_git.rb +0 -2
- data/vendor/git-subrepo/.fish.rc +20 -0
- data/vendor/git-subrepo/.gitattributes +1 -0
- data/vendor/git-subrepo/.github/workflows/test.yml +29 -0
- data/vendor/git-subrepo/.gitignore +1 -0
- data/vendor/git-subrepo/.gitrepo +7 -0
- data/vendor/git-subrepo/.rc +32 -0
- data/vendor/git-subrepo/Changes +66 -0
- data/vendor/git-subrepo/Intro.pod +2 -5
- data/vendor/git-subrepo/Makefile +45 -5
- data/vendor/git-subrepo/Meta +2 -2
- data/vendor/git-subrepo/ReadMe.pod +26 -31
- data/vendor/git-subrepo/doc/git-subrepo.swim +22 -18
- data/vendor/git-subrepo/doc/intro-to-subrepo.swim +2 -4
- data/vendor/git-subrepo/ext/bashplus/.gitrepo +12 -0
- data/vendor/git-subrepo/ext/bashplus/.travis.yml +6 -0
- data/vendor/git-subrepo/ext/bashplus/Changes +19 -0
- data/vendor/git-subrepo/ext/bashplus/License +1 -1
- data/vendor/git-subrepo/ext/bashplus/Makefile +25 -0
- data/vendor/git-subrepo/ext/bashplus/Meta +4 -4
- data/vendor/git-subrepo/ext/bashplus/ReadMe.pod +2 -2
- data/vendor/git-subrepo/ext/bashplus/bin/bash+ +8 -7
- data/vendor/git-subrepo/ext/bashplus/doc/bash+.swim +1 -1
- data/vendor/git-subrepo/ext/bashplus/lib/bash+.bash +85 -38
- data/vendor/git-subrepo/ext/bashplus/man/man1/bash+.1 +8 -8
- data/vendor/git-subrepo/ext/bashplus/man/man3/bash+.3 +8 -8
- data/vendor/git-subrepo/ext/bashplus/test/base.t +4 -5
- data/vendor/git-subrepo/ext/bashplus/test/die.t +16 -0
- data/vendor/git-subrepo/ext/bashplus/test/fcopy.t +2 -3
- data/vendor/git-subrepo/ext/bashplus/test/{test.bash → setup} +18 -8
- data/vendor/git-subrepo/ext/bashplus/test/shellcheck.t +37 -0
- data/vendor/git-subrepo/ext/bashplus/test/source-bash+-std.t +10 -11
- data/vendor/git-subrepo/ext/bashplus/test/source-bash+.t +10 -11
- data/vendor/git-subrepo/ext/bashplus/test/use.t +8 -5
- data/vendor/git-subrepo/ext/bashplus/test/version-check.t +23 -0
- data/vendor/git-subrepo/ext/test-more-bash/.gitrepo +12 -0
- data/vendor/git-subrepo/ext/test-more-bash/.travis.yml +6 -0
- data/vendor/git-subrepo/ext/test-more-bash/Changes +11 -0
- data/vendor/git-subrepo/ext/test-more-bash/License +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/Makefile +25 -0
- data/vendor/git-subrepo/ext/test-more-bash/Meta +5 -5
- data/vendor/git-subrepo/ext/test-more-bash/ReadMe.pod +9 -3
- data/vendor/git-subrepo/ext/test-more-bash/doc/test-more.swim +7 -2
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/.gitrepo +12 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/.travis.yml +6 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Changes +11 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/License +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Makefile +25 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/Meta +3 -3
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/ReadMe.pod +2 -2
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/bin/bash+ +8 -7
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/doc/bash+.swim +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/lib/bash+.bash +85 -38
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man1/bash+.1 +8 -8
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/man/man3/bash+.3 +8 -8
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/base.t +4 -4
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/die.t +17 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/fcopy.t +2 -2
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/{test.bash → setup} +17 -8
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/shellcheck.t +38 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+-std.t +10 -10
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/source-bash+.t +10 -10
- data/vendor/git-subrepo/ext/test-more-bash/ext/bashplus/test/use.t +8 -4
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/.gitrepo +12 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/.travis.yml +5 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Changes +11 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/License +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Makefile +30 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/Meta +3 -3
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/ReadMe.pod +2 -2
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/doc/test-tap.swim +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/lib/test/tap.bash +46 -42
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/man/man3/test-tap.3 +8 -8
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/bail_out.t +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail.t +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/fail_fast.t +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/helper.bash +1 -1
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/shellcheck.t +42 -0
- data/vendor/git-subrepo/ext/test-more-bash/ext/test-tap-bash/test/tap.t +11 -5
- data/vendor/git-subrepo/ext/test-more-bash/lib/test/more.bash +35 -15
- data/vendor/git-subrepo/ext/test-more-bash/man/man3/test-more.3 +16 -10
- data/vendor/git-subrepo/ext/test-more-bash/test/fail.t +15 -1
- data/vendor/git-subrepo/ext/test-more-bash/test/more.t +12 -4
- data/vendor/git-subrepo/ext/test-more-bash/test/setup +3 -3
- data/vendor/git-subrepo/ext/test-more-bash/test/shellcheck.t +35 -0
- data/vendor/git-subrepo/ext/test-more-bash/test/test/fail1.t +14 -1
- data/vendor/git-subrepo/lib/git-subrepo +375 -260
- data/vendor/git-subrepo/lib/git-subrepo.d/help-functions.bash +21 -22
- data/vendor/git-subrepo/man/man1/git-subrepo.1 +125 -141
- data/vendor/git-subrepo/pkg/bin/generate-completion.pl +0 -7
- data/vendor/git-subrepo/pkg/bin/generate-help-functions.pl +0 -2
- data/vendor/git-subrepo/share/completion.bash +1 -3
- data/vendor/git-subrepo/share/enable-completion.sh +3 -3
- data/vendor/git-subrepo/share/zsh-completion/_git-subrepo +2 -7
- data/vendor/git-subrepo/test/Dockerfile +112 -0
- data/vendor/git-subrepo/test/branch-all.t +6 -6
- data/vendor/git-subrepo/test/branch-rev-list-one-path.t +7 -8
- data/vendor/git-subrepo/test/branch-rev-list.t +7 -8
- data/vendor/git-subrepo/test/branch.t +9 -9
- data/vendor/git-subrepo/test/clean.t +3 -3
- data/vendor/git-subrepo/test/clone-annotated-tag.t +7 -7
- data/vendor/git-subrepo/test/clone.t +20 -25
- data/vendor/git-subrepo/test/config.t +7 -6
- data/vendor/git-subrepo/test/encode.t +17 -17
- data/vendor/git-subrepo/test/error.t +18 -18
- data/vendor/git-subrepo/test/fetch.t +4 -4
- data/vendor/git-subrepo/test/gitignore.t +8 -8
- data/vendor/git-subrepo/test/init.t +6 -7
- data/vendor/git-subrepo/test/issue29.t +3 -3
- data/vendor/git-subrepo/test/issue95.t +2 -2
- data/vendor/git-subrepo/test/issue96.t +3 -3
- data/vendor/git-subrepo/test/pull-all.t +5 -5
- data/vendor/git-subrepo/test/pull-merge.t +16 -15
- data/vendor/git-subrepo/test/pull-message.t +12 -12
- data/vendor/git-subrepo/test/pull-new-branch.t +8 -7
- data/vendor/git-subrepo/test/pull-ours.t +10 -10
- data/vendor/git-subrepo/test/pull-theirs.t +8 -8
- data/vendor/git-subrepo/test/pull-twice.t +4 -4
- data/vendor/git-subrepo/test/pull-worktree.t +5 -5
- data/vendor/git-subrepo/test/pull.t +14 -14
- data/vendor/git-subrepo/test/push-after-init.t +7 -6
- data/vendor/git-subrepo/test/push-after-push-no-changes.t +27 -0
- data/vendor/git-subrepo/test/push-force.t +7 -6
- data/vendor/git-subrepo/test/push-new-branch.t +10 -10
- data/vendor/git-subrepo/test/push-no-changes.t +3 -3
- data/vendor/git-subrepo/test/push-squash.t +7 -7
- data/vendor/git-subrepo/test/push.t +35 -34
- data/vendor/git-subrepo/test/rebase.t +63 -0
- data/vendor/git-subrepo/test/reclone.t +15 -8
- data/vendor/git-subrepo/test/setup +62 -55
- data/vendor/git-subrepo/test/shellcheck.t +37 -0
- data/vendor/git-subrepo/test/status.t +47 -27
- data/vendor/git-subrepo/test/submodule.t +4 -4
- data/vendor/git-subrepo/test/zsh.t +27 -0
- metadata +45 -19
|
@@ -9,34 +9,41 @@ use Test::More
|
|
|
9
9
|
clone-foo-and-bar
|
|
10
10
|
|
|
11
11
|
(
|
|
12
|
-
cd $OWNER/foo
|
|
13
|
-
git subrepo --quiet clone
|
|
12
|
+
cd "$OWNER/foo"
|
|
13
|
+
git subrepo --quiet clone "$UPSTREAM/bar"
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
test-exists \
|
|
17
17
|
"$OWNER/foo/bar/bard/"
|
|
18
18
|
|
|
19
|
+
# Test that reclone is not done if not needed.
|
|
19
20
|
export XYZ=1
|
|
20
21
|
is "$(
|
|
21
|
-
cd $OWNER/foo
|
|
22
|
-
git subrepo --force clone
|
|
22
|
+
cd "$OWNER/foo"
|
|
23
|
+
git subrepo --force clone "$UPSTREAM/bar"
|
|
23
24
|
)" \
|
|
24
25
|
"Subrepo 'bar' is up to date." \
|
|
25
26
|
"No reclone if same commit"
|
|
26
27
|
|
|
28
|
+
# Test that reclone of a different ref works.
|
|
27
29
|
(
|
|
28
|
-
cd $OWNER/foo
|
|
29
|
-
git subrepo --quiet clone --force
|
|
30
|
+
cd "$OWNER/foo"
|
|
31
|
+
git subrepo --quiet clone --force "$UPSTREAM/bar" --branch=refs/tags/A
|
|
30
32
|
)
|
|
31
33
|
|
|
34
|
+
is "$(git -C "$OWNER"/foo subrepo config bar branch)" \
|
|
35
|
+
"Subrepo 'bar' option 'branch' has value 'refs/tags/A'."
|
|
32
36
|
test-exists \
|
|
33
37
|
"!$OWNER/foo/bar/bard/"
|
|
34
38
|
|
|
39
|
+
# Test that reclone back to (implicit) master works.
|
|
35
40
|
(
|
|
36
|
-
cd $OWNER/foo
|
|
37
|
-
git subrepo --quiet clone -f
|
|
41
|
+
cd "$OWNER/foo"
|
|
42
|
+
git subrepo --quiet clone -f "$UPSTREAM/bar"
|
|
38
43
|
)
|
|
39
44
|
|
|
45
|
+
is "$(git -C "$OWNER"/foo subrepo config bar branch)" \
|
|
46
|
+
"Subrepo 'bar' option 'branch' has value 'master'."
|
|
40
47
|
test-exists \
|
|
41
48
|
"$OWNER/foo/bar/bard/"
|
|
42
49
|
|
|
@@ -1,53 +1,59 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
+
# Set this locally for Windows:
|
|
4
|
+
git config core.autocrlf input
|
|
5
|
+
|
|
3
6
|
set -e
|
|
4
7
|
|
|
5
8
|
# Set the GIT_SUBREPO_ROOT for testing.
|
|
6
|
-
source $PWD/.rc
|
|
9
|
+
source "$PWD"/.rc
|
|
7
10
|
|
|
8
|
-
#
|
|
9
|
-
|
|
11
|
+
# Get the location of this script
|
|
12
|
+
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
13
|
+
|
|
14
|
+
BASHLIB=$(
|
|
15
|
+
find "$PWD"/ -type d -name bin -o -type d -name lib | tr '\n' ':'
|
|
16
|
+
)
|
|
17
|
+
export BASHLIB
|
|
10
18
|
|
|
11
|
-
export BASHLIB
|
|
12
|
-
find $PWD -type d |
|
|
13
|
-
grep -E '/(bin|lib)$' |
|
|
14
|
-
xargs -n1 printf "%s:"
|
|
15
|
-
`"
|
|
16
|
-
export PATH="$BASHLIB:$PATH"
|
|
19
|
+
export PATH=$BASHLIB:$PATH
|
|
17
20
|
source bash+ :std
|
|
18
21
|
|
|
19
22
|
source 'lib/git-subrepo'
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rm -fr $TMP
|
|
24
|
+
export TMP=$SCRIPT_DIR/tmp
|
|
25
|
+
rm -fr "$TMP"
|
|
24
26
|
|
|
25
|
-
#export GIT_EXEC_PATH
|
|
26
|
-
export UPSTREAM
|
|
27
|
-
export OWNER
|
|
28
|
-
export COLLAB
|
|
27
|
+
#export GIT_EXEC_PATH=$PWD/lib:$(git --exec-path)
|
|
28
|
+
export UPSTREAM=$TMP/upstream
|
|
29
|
+
export OWNER=$TMP/owner
|
|
30
|
+
export COLLAB=$TMP/collab
|
|
29
31
|
|
|
30
32
|
mkdir -p "$UPSTREAM" "$OWNER" "$COLLAB"
|
|
31
33
|
|
|
32
34
|
cp -r test/repo/{foo,bar,init} "$UPSTREAM/"
|
|
33
35
|
|
|
36
|
+
DEFAULTBRANCH=$( git config --global --get init.defaultbranch || true )
|
|
37
|
+
[[ -z $DEFAULTBRANCH ]] && DEFAULTBRANCH="master"
|
|
38
|
+
export DEFAULTBRANCH
|
|
39
|
+
|
|
34
40
|
###
|
|
35
41
|
# Test helper functions:
|
|
36
42
|
###
|
|
37
43
|
clone-foo-and-bar() {
|
|
38
44
|
(
|
|
39
45
|
# foo will act as the main repo
|
|
40
|
-
git clone $UPSTREAM/foo $OWNER/foo
|
|
46
|
+
git clone "$UPSTREAM/foo" "$OWNER/foo"
|
|
41
47
|
(
|
|
42
|
-
cd $OWNER/foo
|
|
48
|
+
cd "$OWNER/foo"
|
|
43
49
|
git config core.autocrlf input
|
|
44
50
|
git config user.name "FooUser"
|
|
45
51
|
git config user.email "foo@foo"
|
|
46
52
|
)
|
|
47
53
|
# bar will act as the subrepo
|
|
48
|
-
git clone $UPSTREAM/bar $OWNER/bar
|
|
54
|
+
git clone "$UPSTREAM/bar" "$OWNER/bar"
|
|
49
55
|
(
|
|
50
|
-
cd $OWNER/bar
|
|
56
|
+
cd "$OWNER/bar"
|
|
51
57
|
git config core.autocrlf input
|
|
52
58
|
git config user.name "BarUser"
|
|
53
59
|
git config user.email "bar@bar"
|
|
@@ -57,23 +63,23 @@ clone-foo-and-bar() {
|
|
|
57
63
|
|
|
58
64
|
subrepo-clone-bar-into-foo() {
|
|
59
65
|
(
|
|
60
|
-
cd $OWNER/foo
|
|
61
|
-
git subrepo clone
|
|
66
|
+
cd "$OWNER/foo"
|
|
67
|
+
git subrepo clone "$UPSTREAM/bar"
|
|
62
68
|
) &> /dev/null || die
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
add-new-files() {
|
|
66
72
|
local file
|
|
67
|
-
for file in
|
|
73
|
+
for file in "$@"; do
|
|
68
74
|
echo "new file $file" > "$file"
|
|
69
|
-
git add "$file"
|
|
75
|
+
git add --force "$file"
|
|
70
76
|
done
|
|
71
77
|
git commit --quiet -m "add new file: $file" &> /dev/null
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
remove-files() {
|
|
75
81
|
local file
|
|
76
|
-
for file in
|
|
82
|
+
for file in "$@"; do
|
|
77
83
|
git rm "$file"
|
|
78
84
|
done
|
|
79
85
|
git commit --quiet -m "Removed file: $file" &> /dev/null
|
|
@@ -81,7 +87,7 @@ remove-files() {
|
|
|
81
87
|
|
|
82
88
|
modify-files() {
|
|
83
89
|
local file
|
|
84
|
-
for file in
|
|
90
|
+
for file in "$@"; do
|
|
85
91
|
echo 'a new line' >> "$file"
|
|
86
92
|
git add "$file"
|
|
87
93
|
done
|
|
@@ -90,7 +96,7 @@ modify-files() {
|
|
|
90
96
|
|
|
91
97
|
modify-files-ex() {
|
|
92
98
|
local file
|
|
93
|
-
for file in
|
|
99
|
+
for file in "$@"; do
|
|
94
100
|
echo "$file" >> "$file"
|
|
95
101
|
git add "$file"
|
|
96
102
|
done
|
|
@@ -100,20 +106,20 @@ modify-files-ex() {
|
|
|
100
106
|
test-exists() {
|
|
101
107
|
for f in "$@"; do
|
|
102
108
|
if [[ $f =~ ^! ]]; then
|
|
103
|
-
f
|
|
109
|
+
f=${f#!}
|
|
104
110
|
if [[ $f =~ /$ ]]; then
|
|
105
|
-
ok "
|
|
111
|
+
ok "$([ ! -d "$f" ])" \
|
|
106
112
|
"Directory '$f' does not exist"
|
|
107
113
|
else
|
|
108
|
-
ok "
|
|
114
|
+
ok "$([ ! -f "$f" ])" \
|
|
109
115
|
"File '$f' does not exist"
|
|
110
116
|
fi
|
|
111
117
|
else
|
|
112
118
|
if [[ $f =~ /$ ]]; then
|
|
113
|
-
ok "
|
|
119
|
+
ok "$([ -d "$f" ])" \
|
|
114
120
|
"Directory '$f' exists"
|
|
115
121
|
else
|
|
116
|
-
ok "
|
|
122
|
+
ok "$([ -f "$f" ])" \
|
|
117
123
|
"File '$f' exists"
|
|
118
124
|
fi
|
|
119
125
|
fi
|
|
@@ -121,22 +127,22 @@ test-exists() {
|
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
test-exists-in-index() {
|
|
124
|
-
for f in
|
|
125
|
-
if [[
|
|
126
|
-
f
|
|
127
|
-
if [[
|
|
128
|
-
ok "
|
|
130
|
+
for f in "$@"; do
|
|
131
|
+
if [[ $f =~ ^! ]]; then
|
|
132
|
+
f=${f#!}
|
|
133
|
+
if [[ $f =~ /$ ]]; then
|
|
134
|
+
ok "$([ ! "$(git ls-tree --full-tree --name-only -r HEAD "$f")" ])" \
|
|
129
135
|
"Directory '$f' does not exist in index"
|
|
130
136
|
else
|
|
131
|
-
ok "
|
|
137
|
+
ok "$([ ! "$(git ls-tree --full-tree --name-only -r HEAD "$f")" ])" \
|
|
132
138
|
"File '$f' does not exist in index"
|
|
133
139
|
fi
|
|
134
140
|
else
|
|
135
|
-
if [[
|
|
136
|
-
ok "
|
|
141
|
+
if [[ $f =~ /$ ]]; then
|
|
142
|
+
ok "$([ "$(git ls-tree --full-tree --name-only -r HEAD "$f")" ])" \
|
|
137
143
|
"Directory '$f' exists in index"
|
|
138
144
|
else
|
|
139
|
-
ok "
|
|
145
|
+
ok "$([ "$(git ls-tree --full-tree --name-only -r HEAD "$f")" ])" \
|
|
140
146
|
"File '$f' exists in index"
|
|
141
147
|
fi
|
|
142
148
|
fi
|
|
@@ -144,39 +150,40 @@ test-exists-in-index() {
|
|
|
144
150
|
}
|
|
145
151
|
|
|
146
152
|
test-gitrepo-comment-block() {
|
|
147
|
-
|
|
153
|
+
# shellcheck disable=2154
|
|
154
|
+
is "$(grep -E '^;' "$gitrepo")" "\
|
|
148
155
|
; DO NOT EDIT (unless you know what you are doing)
|
|
149
156
|
;
|
|
150
157
|
; This subdirectory is a git \"subrepo\", and this file is maintained by the
|
|
151
|
-
; git-subrepo command. See https://github.com/
|
|
158
|
+
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme
|
|
152
159
|
;" \
|
|
153
160
|
'Comment header block is correct'
|
|
154
161
|
}
|
|
155
162
|
|
|
156
163
|
test-gitrepo-field() {
|
|
157
|
-
is "
|
|
164
|
+
is "$(git config -f "$gitrepo" subrepo."$1")" \
|
|
158
165
|
"$2" \
|
|
159
166
|
".gitrepo $1 is correct"
|
|
160
167
|
}
|
|
161
168
|
|
|
162
169
|
test-commit-count() {
|
|
163
|
-
is "
|
|
170
|
+
is "$(cd "$1"; git rev-list --count "$2")" \
|
|
164
171
|
"$3" \
|
|
165
172
|
"commit count is correct"
|
|
166
173
|
}
|
|
167
174
|
|
|
168
175
|
save-original-state() {
|
|
169
|
-
original_head_ref
|
|
170
|
-
original_branch
|
|
171
|
-
original_head_commit
|
|
172
|
-
original_gitrepo
|
|
176
|
+
original_head_ref=$(cd "$1"; cat .git/HEAD)
|
|
177
|
+
original_branch=${original_head_ref#ref: refs/heads/}
|
|
178
|
+
original_head_commit=$(cd "$1"; git rev-parse HEAD)
|
|
179
|
+
original_gitrepo=$(cd "$1"; cat "$2"/.gitrepo)
|
|
173
180
|
}
|
|
174
181
|
|
|
175
182
|
assert-original-state() {
|
|
176
|
-
current_head_ref
|
|
177
|
-
current_branch
|
|
178
|
-
current_head_commit
|
|
179
|
-
current_gitrepo
|
|
183
|
+
current_head_ref=$(cd "$1"; cat .git/HEAD)
|
|
184
|
+
current_branch=${current_head_ref#ref: refs/heads/}
|
|
185
|
+
current_head_commit=$(cd "$1"; git rev-parse HEAD)
|
|
186
|
+
current_gitrepo=$(cd "$1"; cat "$2"/.gitrepo)
|
|
180
187
|
|
|
181
188
|
is "$current_head_ref" \
|
|
182
189
|
"$original_head_ref" \
|
|
@@ -196,10 +203,10 @@ assert-original-state() {
|
|
|
196
203
|
}
|
|
197
204
|
|
|
198
205
|
catch() {
|
|
199
|
-
local error=; error
|
|
206
|
+
local error=; error=$("$@" 2>&1 || true)
|
|
200
207
|
echo "$error"
|
|
201
208
|
}
|
|
202
209
|
|
|
203
210
|
teardown() {
|
|
204
|
-
rm -fr $TMP
|
|
211
|
+
rm -fr "$TMP"
|
|
205
212
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
source test/setup
|
|
4
|
+
|
|
5
|
+
use Test::More
|
|
6
|
+
|
|
7
|
+
if ! command -v shellcheck >/dev/null; then
|
|
8
|
+
plan skip_all "The 'shellcheck' utility is not installed"
|
|
9
|
+
fi
|
|
10
|
+
if [[ ! $(shellcheck --version) =~ 0\.7\.1 ]]; then
|
|
11
|
+
plan skip_all "This test wants shellcheck version 0.7.1"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
IFS=$'\n' read -d '' -r -a shell_files <<< "$(
|
|
15
|
+
echo .rc
|
|
16
|
+
find lib -type f
|
|
17
|
+
echo test/setup
|
|
18
|
+
find test -name '*.t'
|
|
19
|
+
echo share/enable-completion.sh
|
|
20
|
+
)" || true
|
|
21
|
+
|
|
22
|
+
skips=(
|
|
23
|
+
# We want to keep these 2 here always:
|
|
24
|
+
SC1090 # Can't follow non-constant source. Use a directive to specify location.
|
|
25
|
+
SC1091 # Not following: bash+ was not specified as input (see shellcheck -x).
|
|
26
|
+
)
|
|
27
|
+
skip=$(IFS=,; echo "${skips[*]}")
|
|
28
|
+
|
|
29
|
+
for file in "${shell_files[@]}"; do
|
|
30
|
+
[[ $file == *swp ]] && continue
|
|
31
|
+
is "$(shellcheck -e "$skip" "$file")" "" \
|
|
32
|
+
"The shell file '$file' passes shellcheck"
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
done_testing
|
|
36
|
+
|
|
37
|
+
# vim: set ft=sh:
|
|
@@ -6,61 +6,81 @@ source test/setup
|
|
|
6
6
|
|
|
7
7
|
use Test::More
|
|
8
8
|
|
|
9
|
+
clone-foo-and-bar
|
|
10
|
+
|
|
11
|
+
(
|
|
12
|
+
cd "$OWNER"/foo
|
|
13
|
+
git subrepo clone "$UPSTREAM"/bar
|
|
14
|
+
git subrepo clone "$UPSTREAM"/foo bar/foo
|
|
15
|
+
mkdir lib
|
|
16
|
+
git subrepo clone "$UPSTREAM"/bar lib/bar
|
|
17
|
+
git subrepo clone "$UPSTREAM"/foo lib/bar/foo
|
|
18
|
+
) &> /dev/null || die
|
|
19
|
+
|
|
9
20
|
{
|
|
10
|
-
output
|
|
21
|
+
output=$(
|
|
22
|
+
cd "$OWNER"/foo
|
|
23
|
+
git subrepo status --all
|
|
24
|
+
)
|
|
11
25
|
|
|
12
26
|
like "$output" "2 subrepos:" \
|
|
13
27
|
"'status' intro ok"
|
|
14
28
|
|
|
15
|
-
like "$output" "Git subrepo '
|
|
16
|
-
"
|
|
29
|
+
like "$output" "Git subrepo 'bar':" \
|
|
30
|
+
"bar is in 'status'"
|
|
17
31
|
|
|
18
|
-
like "$output" "Git subrepo '
|
|
19
|
-
"
|
|
32
|
+
like "$output" "Git subrepo 'lib/bar':" \
|
|
33
|
+
"lib/bar is in 'status'"
|
|
20
34
|
|
|
21
|
-
unlike "$output" "Git subrepo '
|
|
22
|
-
"
|
|
35
|
+
unlike "$output" "Git subrepo 'bar/foo':" \
|
|
36
|
+
"bar/foo is not in 'status'"
|
|
23
37
|
|
|
24
|
-
unlike "$output" "Git subrepo '
|
|
25
|
-
"
|
|
38
|
+
unlike "$output" "Git subrepo 'lib/bar/foo':" \
|
|
39
|
+
"lib/bar/foo is not in 'status'"
|
|
26
40
|
}
|
|
27
41
|
|
|
28
42
|
{
|
|
29
|
-
output
|
|
43
|
+
output=$(
|
|
44
|
+
cd "$OWNER"/foo
|
|
45
|
+
git subrepo status --ALL
|
|
46
|
+
)
|
|
30
47
|
|
|
31
48
|
like "$output" "4 subrepos:" \
|
|
32
49
|
"'status --ALL' intro ok"
|
|
33
50
|
|
|
34
|
-
like "$output" "Git subrepo '
|
|
35
|
-
"
|
|
51
|
+
like "$output" "Git subrepo 'bar':" \
|
|
52
|
+
"bar is in 'status --ALL'"
|
|
36
53
|
|
|
37
|
-
like "$output" "Git subrepo '
|
|
38
|
-
"
|
|
54
|
+
like "$output" "Git subrepo 'lib/bar':" \
|
|
55
|
+
"lib/bar is in 'status --ALL'"
|
|
39
56
|
|
|
40
|
-
like "$output" "Git subrepo '
|
|
41
|
-
"
|
|
57
|
+
like "$output" "Git subrepo 'bar/foo':" \
|
|
58
|
+
"bar/foo is in 'status --ALL'"
|
|
42
59
|
|
|
43
|
-
like "$output" "Git subrepo '
|
|
44
|
-
"
|
|
60
|
+
like "$output" "Git subrepo 'lib/bar/foo':" \
|
|
61
|
+
"lib/bar/foo is in 'status --ALL'"
|
|
45
62
|
}
|
|
46
63
|
|
|
47
64
|
{
|
|
48
|
-
output
|
|
65
|
+
output=$(
|
|
66
|
+
cd "$OWNER"/foo
|
|
67
|
+
git subrepo status --all
|
|
68
|
+
)
|
|
49
69
|
|
|
50
70
|
like "$output" "2 subrepos:" \
|
|
51
71
|
"'status --all' intro ok"
|
|
52
72
|
|
|
53
|
-
like "$output" "Git subrepo '
|
|
54
|
-
"
|
|
73
|
+
like "$output" "Git subrepo 'bar':" \
|
|
74
|
+
"bar is in 'status --all'"
|
|
55
75
|
|
|
56
|
-
like "$output" "Git subrepo '
|
|
57
|
-
"
|
|
76
|
+
like "$output" "Git subrepo 'lib/bar':" \
|
|
77
|
+
"lib/bar is in 'status --all'"
|
|
58
78
|
|
|
59
|
-
unlike "$output" "Git subrepo '
|
|
60
|
-
"
|
|
79
|
+
unlike "$output" "Git subrepo 'bar/foo':" \
|
|
80
|
+
"bar/foo is not in 'status --all'"
|
|
61
81
|
|
|
62
|
-
unlike "$output" "Git subrepo '
|
|
63
|
-
"
|
|
82
|
+
unlike "$output" "Git subrepo 'lib/bar/foo':" \
|
|
83
|
+
"lib/bar/foo is not in 'status --all'"
|
|
64
84
|
}
|
|
65
85
|
|
|
66
86
|
done_testing 15
|
|
@@ -14,7 +14,7 @@ clone-foo-and-bar
|
|
|
14
14
|
|
|
15
15
|
# Add submodule reference along with a new file to the bar repo:
|
|
16
16
|
(
|
|
17
|
-
cd $OWNER/bar
|
|
17
|
+
cd "$OWNER/bar"
|
|
18
18
|
git clone ../foo submodule
|
|
19
19
|
add-new-files file
|
|
20
20
|
git add submodule file
|
|
@@ -22,18 +22,18 @@ clone-foo-and-bar
|
|
|
22
22
|
) &> /dev/null || die
|
|
23
23
|
|
|
24
24
|
(
|
|
25
|
-
cd $OWNER/foo
|
|
25
|
+
cd "$OWNER/foo"
|
|
26
26
|
git subrepo clone ../bar
|
|
27
27
|
) &> /dev/null || die
|
|
28
28
|
|
|
29
29
|
(
|
|
30
|
-
cd $OWNER/bar
|
|
30
|
+
cd "$OWNER/bar"
|
|
31
31
|
modify-files file
|
|
32
32
|
) &> /dev/null || die
|
|
33
33
|
|
|
34
34
|
{
|
|
35
35
|
is "$(
|
|
36
|
-
cd $OWNER/foo
|
|
36
|
+
cd "$OWNER/foo"
|
|
37
37
|
git subrepo pull bar
|
|
38
38
|
)" \
|
|
39
39
|
"Subrepo 'bar' pulled from '../bar' (master)." \
|
|
@@ -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
|
+
if ! command -v docker >/dev/null; then
|
|
10
|
+
plan skip_all "The 'docker' utility is not installed"
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
for zsh_version in 5.8 5.6 5.0.1 4.3.11; do
|
|
14
|
+
error=$(
|
|
15
|
+
docker run --rm -it \
|
|
16
|
+
--volume="$PWD:/git-subrepo" \
|
|
17
|
+
--entrypoint='' \
|
|
18
|
+
"zshusers/zsh:$zsh_version" \
|
|
19
|
+
zsh -c 'source /git-subrepo/.rc 2>&1'
|
|
20
|
+
) || true
|
|
21
|
+
|
|
22
|
+
is "$error" "" "'source.rc' works for zsh-$zsh_version"
|
|
23
|
+
done
|
|
24
|
+
|
|
25
|
+
done_testing
|
|
26
|
+
|
|
27
|
+
# vim: set ft=sh:
|