@@ -19,6 +19,7 @@ git-context-graph() {
19
19
setup_file () {
20
20
cd " ${BATS_TEST_DIRNAME} " || exit
21
21
22
+ [[ -d data ]] && rm -rf data
22
23
mkdir data && cd data || exit
23
24
24
25
git init --bare -b main remote1
@@ -120,6 +121,39 @@ teardown() {
120
121
) "
121
122
}
122
123
124
+ @test " Patially matching branches are properly excluded" {
125
+ git clone ./remote1 repo && cd repo
126
+
127
+ # Other branch with name containing 'feature-A'
128
+ git switch -c backup/feature-A origin/feature-A --no-track
129
+ git push -u origin backup/feature-A
130
+
131
+ # Other branch with name containing 'main'
132
+ git switch -c old/main origin/main --no-track
133
+
134
+ git switch -c feature-A origin/feature-A
135
+
136
+ run git-context-graph --list
137
+ refute_line " refs/heads/backup/feature-A"
138
+ refute_line " refs/remotes/origin/backup/feature-A"
139
+ refute_line " refs/heads/old/main"
140
+
141
+ run git-context-graph --list --short
142
+ refute_line " backup/feature-A"
143
+ refute_line " origin/backup/feature-A"
144
+ refute_line " old/main"
145
+
146
+ run git-context-graph --list --local
147
+ refute_line " refs/heads/backup/feature-A"
148
+ refute_line " refs/heads/old/main"
149
+
150
+ run git-context-graph --list --no-default
151
+ refute_line " refs/heads/backup/feature-A"
152
+ refute_line " refs/remotes/origin/backup/feature-A"
153
+
154
+ git push origin --delete backup/feature-A
155
+ }
156
+
123
157
@test " Branches to list can be passed as arguments" {
124
158
git clone ./remote1 repo && cd repo
125
159
0 commit comments