Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 6c25370

Browse files
authored
checks and updates all the condition regex (#186)
**Pull Request Description** Checks all of the regex for: - escaped `.` in expressions. - inclusion of `.*` catch all. - Some coverage of likely cases (but could still be improved). Closes #137 Closes #157 --- **Licensing Certification** GitKit is a [Free Cultural Work](https://freedomdefined.org/Definition) and all accepted contributions are licensed as described in the LICENSE.md file. This requires that the contributor holds the rights to do so. By submitting this pull request **I certify that I satisfy the terms of the [Developer Certificate of Origin](https://developercertificate.org/)** for its contents.
1 parent d936605 commit 6c25370

12 files changed

Lines changed: 95 additions & 65 deletions

source/ch-communities-and-collaboration/sec-cloning-your-origin.ptx

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@
8484
<var width="55" />
8585
</p>
8686
</statement>
87-
<setup> <var> <condition string="^https://github.com/(?!(FarmData2|DickinsonCollege)).+/.+.git$">
87+
<setup> <var> <condition string="^https://github\.com/(?!(FarmData2|DickinsonCollege)).+/.+\.git$">
8888
<feedback>
8989
<p>
9090
Thank you.
9191
</p>
9292
</feedback>
93-
</condition> <condition string="^https://github.com/DickinsonCollege/.+.git">
93+
</condition> <condition string="^https://github\.com/DickinsonCollege/.+\.git">
9494

9595
<feedback>
9696
<p>
9797
It looks like you might be trying to use the upstream repository instead of your origin.
9898
</p>
9999
</feedback>
100-
</condition> <condition string="^https://github.com/FarmData2/.+.git">
100+
</condition> <condition string="^https://github\.com/FarmData2/.+\.git">
101101

102102
<feedback>
103103
<p>
@@ -152,34 +152,31 @@
152152
<var width="65" />
153153
</p>
154154
</statement>
155-
<setup> <var> <condition string="^https://github.com/(?!(FarmData2|DickinsonCollege)).+/.+.git$">
156-
<feedback>
157-
<p>
158-
Thank you.
159-
</p>
160-
</feedback>
161-
</condition> <condition string="^https://github.com/DickinsonCollege/.+.git">
162-
163-
<feedback>
164-
<p>
165-
It looks like you might be trying to use the upstream repository instead of your origin.
166-
</p>
167-
</feedback>
168-
</condition> <condition string="^https://github.com/FarmData2/.+.git">
169-
170-
<feedback>
171-
<p>
172-
It looks like you might be trying to use the upstream repository instead of your origin.
173-
</p>
174-
</feedback>
175-
</condition> <condition string=".*">
176-
177-
<feedback>
178-
<p>
179-
Be sure to replace <c>&lt;URL&gt;</c> with the clone URL you found in <xref ref="ex-clone-url" />. The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>.
180-
</p>
181-
</feedback>
182-
</condition> </var> </setup>
155+
<setup>
156+
<var>
157+
<condition string="^git clone https://github\.com/(?!(FarmData2|DickinsonCollege)).+/.+\.git$">
158+
<feedback>
159+
<p>
160+
Thank you.
161+
</p>
162+
</feedback>
163+
</condition>
164+
<condition string="^git clone https://github\.com/(DickinsonCollege|FarmData2)/.+\.git">
165+
<feedback>
166+
<p>
167+
It looks like you might be trying to clone the upstream repository instead of your origin.
168+
</p>
169+
</feedback>
170+
</condition>
171+
<condition string=".*">
172+
<feedback>
173+
<p>
174+
Be sure to replace the URL with the clone URL you found in <xref ref="ex-clone-url" />. The clone URL should have the format <c>https://github.com/yourGitHubUsername/theRepoName.git</c>.
175+
</p>
176+
</feedback>
177+
</condition>
178+
</var>
179+
</setup>
183180
</exercise>
184181
<exercise xml:id="ex-clone-origin-a" label="ex-clone-origin-a">
185182
<p>

source/ch-communities-and-collaboration/sec-extra-practice.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
</statement>
8888
<setup>
8989
<var>
90-
<condition string="^https://github.com/((?!(openmrs/openmrs-distro-referenceapplication|apache/fineract|sahana/eden|oppia/oppia)).)*$">
90+
<condition string="^https://github\.com/(?!(openmrs/openmrs-distro-referenceapplication|apache/fineract|sahana/eden|oppia/oppia)).*$">
9191
<feedback>
9292
<p>
9393
Thank you.
@@ -105,7 +105,7 @@
105105
</setup>
106106
<hint>
107107
<p>
108-
Make sure you are giving the URL for your fork, not the project's URL. Review <xref ref="topic-forking-the-upstream" /> for information on how to fork a repository on GitHub.
108+
Make sure you are giving the URL for your fork, not the project's upstream URL. Review <xref ref="topic-forking-the-upstream" /> for information on how to fork a repository on GitHub.
109109
</p>
110110
</hint>
111111
</exercise>

source/ch-communities-and-collaboration/sec-forking-the-upstream.ptx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,28 @@
5151

5252
<setup>
5353
<var>
54-
<condition string="^https://github.com/((?!(yourClass|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2))).*$">
54+
<condition string="^https://github\.com/(?!(yourClass|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2)).*$">
5555
<feedback>
5656
<p>
5757
Thank you.
5858
</p>
5959
</feedback>
6060
</condition>
61-
<condition string="^https://github.com/DickinsonCollege/FarmData2">
61+
<condition string="^https://github\.com/DickinsonCollege/FarmData2">
6262
<feedback>
6363
<p>
6464
Looks like you might be trying to use the real FarmData2 upstream. Be sure to use the URL that your instructor has given you.
6565
</p>
6666
</feedback>
6767
</condition>
68-
<condition string="^https://github.com/FarmData2/FarmData2">
68+
<condition string="^https://github\.com/FarmData2/FarmData2">
6969
<feedback>
7070
<p>
7171
Looks like you might be trying to use the real FarmData2 upstream. Be sure to use the URL that your instructor has given you.
7272
</p>
7373
</feedback>
7474
</condition>
75-
<condition string="^https://github.com/yourClass/theRepoName">
75+
<condition string="^https://github\.com/yourClass/theRepoName">
7676
<feedback>
7777
<p>
7878
Looks like you might be trying to use the example above. That was just for illustration. Be sure to use the URL that your instructor has given you.
@@ -156,28 +156,28 @@
156156

157157
<setup>
158158
<var>
159-
<condition string="^https://github.com/((?!(yourGitHub|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2))).*$">
159+
<condition string="^https://github\.com/(?!(yourGitHub|theRepoName|FarmData2/FarmData2|DickinsonCollege/FarmData2)).*$">
160160
<feedback>
161161
<p>
162162
Thank you.
163163
</p>
164164
</feedback>
165165
</condition>
166-
<condition string="^https://github.com/DickinsonCollege/FarmData2">
166+
<condition string="^https://github\.com/DickinsonCollege/FarmData2">
167167
<feedback>
168168
<p>
169169
Looks like you might be giving the URL of the real FarmData2 upstream. Be sure to give the URL of the fork you created in your GitHub space.
170170
</p>
171171
</feedback>
172172
</condition>
173-
<condition string="^https://github.com/FarmData2/FarmData2">
173+
<condition string="^https://github\.com/FarmData2/FarmData2">
174174
<feedback>
175175
<p>
176176
Looks like you might be trying to use the real FarmData2 upstream. Be sure to give the URL of the fork you created in your GitHub space.
177177
</p>
178178
</feedback>
179179
</condition>
180-
<condition string="^https://github.com/yourGitHub/theRepoName$">
180+
<condition string="^https://github\.com/yourGitHub/theRepoName">
181181
<feedback>
182182
<p>
183183
Looks like you might be trying to use the example above. That was just for illustration. Be sure to use the URL that your instructor has given you.

source/ch-communities-and-collaboration/sec-github-set-up.ptx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,21 @@
3838
<var width="45" />
3939
</p>
4040
</statement>
41-
<setup> <var> <condition string="^https://github.com/.+">
41+
<setup> <var> <condition string="^https://github\.com/(?!(yourUsername)).+$">
4242
<feedback>
4343
<p>
4444
Thank you.
4545
</p>
4646
</feedback>
47-
</condition> <condition string=".*">
47+
</condition>
48+
<condition string="https://github\.com/yourUsername">
49+
<feedback>
50+
<p>
51+
Looks like you are using the example given. Be sure to give the URL of your actual GitHub profile.
52+
</p>
53+
</feedback>
54+
</condition>
55+
<condition string=".*">
4856

4957
<feedback>
5058
<p>

source/ch-communities-and-collaboration/sec-the-issue-tracker.ptx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,21 @@
472472
<var width="60" />
473473
</p>
474474
</statement>
475-
<setup> <var> <condition string="^https://github.com/.+/issues/[0-9]+$">
475+
<setup> <var> <condition string="^https://github\.com/(?!(my-class|FarmData2/FarmData2|DickinsonCollege/FarmData2)).+/issues/[0-9]+$">
476476
<feedback>
477477
<p>
478478
Thank you.
479479
</p>
480480
</feedback>
481-
</condition> <condition string=".*">
481+
</condition>
482+
<condition string="https://github\.com/my-class/GitKit-FarmData2/issues/2">
483+
<feedback>
484+
<p>
485+
Looks like you are trying to use the example above. Be sure to use the URL for your actual issue.
486+
</p>
487+
</feedback>
488+
</condition>
489+
<condition string=".*">
482490

483491
<feedback>
484492
<p>

source/ch-merge-conflicts/sec-extra-practice.ptx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
</statement>
356356
<setup>
357357
<var>
358-
<condition string="^https://github\.com/(?!(FarmData2/FarmData2|DickinsonCollege/FarmData2)).*/pull/[0-9]+$">
358+
<condition string="^https://github\.com/(?!(FarmData2|DickinsonCollege/FarmData2)).+/pull/[0-9]+$">
359359
<feedback>
360360
<p>
361361
Thank you.
@@ -365,7 +365,7 @@
365365
<condition string=".*">
366366
<feedback>
367367
<p>
368-
Be sure that your URL is from your pull request to the upstream repository. It should have the format <c>https://github.com/upstreamLocation/upstreamReop/pulls/xx</c>, where <c>xx</c> is a number.
368+
Be sure that your URL is from your pull request to the upstream repository for your course. It should have the format <c>https://github.com/yourCourse/repoName/pulls/xx</c>, where <c>xx</c> is a number.
369369
</p>
370370
</feedback>
371371
</condition>

source/ch-merge-conflicts/sec-merging-the-main-branch-into-a-feature-branch.ptx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,6 @@
235235
</p>
236236
</feedback>
237237
</condition>
238-
<condition string=".*">
239-
<feedback>
240-
<p>
241-
Review the format of the <c>git merge</c> command above.
242-
</p>
243-
</feedback>
244-
</condition>
245238
<condition string=".*">
246239
<feedback>
247240
<p>

source/ch-merge-conflicts/sec-updating-your-pull-request.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</p>
5050
</feedback>
5151
</condition>
52-
<condition string="^git .*">
52+
<condition string=".*">
5353
<feedback>
5454
<p>
5555
Review the <c>git push</c> command in <xref ref="topic-pushing-a-branch-to-your-origin" />.

source/ch-upstreaming-changes/sec-committing-to-your-local-repository.ptx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,33 @@
112112
</p>
113113

114114
<p>
115-
<var width="55" />
115+
<var width="75" />
116116
</p>
117117
</statement>
118118
<setup>
119119
<var>
120-
<condition string='^git commit -m ["].+["]$'>
120+
<condition string='^git commit -m ["].{20,72}["]$'>
121121
<feedback>
122122
<p>
123123
Thank you.
124124
Your command is in the proper format, please make sure the commit message is meaningful.
125125
</p>
126126
</feedback>
127127
</condition>
128+
<condition string='^git commit -m ["].{0,20}["]$'>
129+
<feedback>
130+
<p>
131+
Try using a longer commit message to be more descriptive.
132+
</p>
133+
</feedback>
134+
</condition>
135+
<condition string='^git commit -m ["].{73,}["]$'>
136+
<feedback>
137+
<p>
138+
Try using a more concise commit message.
139+
</p>
140+
</feedback>
141+
</condition>
128142
<condition string=".*">
129143

130144
<feedback>

source/ch-upstreaming-changes/sec-creating-a-pull-request.ptx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,17 @@
235235
<var width="55" />
236236
</p>
237237
</statement>
238-
<setup> <var> <condition string='^https://github.com/(?!(FarmData2/FarmData2|DickinsonCollege/FarmData2))(.+/.+)/pull/[0-9]+$'>
239-
<feedback></feedback>
238+
<setup> <var> <condition string='^https://github\.com/(?!(FarmData2/FarmData2|DickinsonCollege/FarmData2))(.+/.+)/pull/[1-9][0-9]*$'>
239+
<feedback>
240+
<p>
241+
Thank you.
242+
</p>
243+
</feedback>
240244
</condition> <condition string=".*">
241245

242246
<feedback>
243247
<p>
244-
The upstream repository is the repository you forked from.
245-
Double check that you aren't in your origin repository.
248+
Double check the URL of your pull request to ensure that it is in the upstream for your course and is correct.
246249
</p>
247250
</feedback>
248251
</condition> </var> </setup>

0 commit comments

Comments
 (0)