-
Notifications
You must be signed in to change notification settings - Fork 301
Expand file tree
/
Copy pathAvailableGitTestRepo.java
More file actions
175 lines (167 loc) · 6.07 KB
/
AvailableGitTestRepo.java
File metadata and controls
175 lines (167 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* This file is part of git-commit-id-maven-plugin
* Originally invented by Konrad 'ktoso' Malawski <konrad.malawski@java.pl>
*
* git-commit-id-maven-plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* git-commit-id-maven-plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with git-commit-id-maven-plugin. If not, see <http://www.gnu.org/licenses/>.
*/
package pl.project13.maven.git;
import java.io.File;
import javax.annotation.Nonnull;
/**
* List of available git repositories that we can use to perform tests with.
*/
public enum AvailableGitTestRepo {
WITH_ONE_COMMIT("src/test/resources/_git_one_commit"),
WITH_ONE_COMMIT_DIRTY("src/test/resources/_git_one_commit_dirty"),
GIT_COMMIT_ID("src/test/resources/_git_of_git_commit_id"),
GIT_WITH_NO_CHANGES("src/test/resources/_git_with_no_changes"),
ON_A_TAG("src/test/resources/_git_on_a_tag"),
/**
*
*
* <pre>
* $ lg
* * b6a73ed - (HEAD, master) third addition (32 hours ago) <p>Konrad Malawski</p>
* * d37a598 - (newest-tag, lightweight-tag) second line (32 hours ago) <p>Konrad Malawski</p>
* * 9597545 - (annotated-tag) initial commit (32 hours ago) <p>Konrad Malawski</p>
* </pre>
*
* Where the <b>newest-tag</b> was created latest:
*
* <pre>
* $ tag -v newest-tag
* object d37a598a7a98531ad1375966642c6b1263129436
* tagger Konrad Malawski <p>konrad.malawski@project13.pl</p> 1346017608 +0200
*
* $ tag -v annotated-tag
* object 95975455ef2b1af048f2926b9ba7fb804e22171b
* tagger Konrad Malawski <p>konrad.malawski@project13.pl</p> 1345901561 +0200
* </pre>
*/
WITH_COMMIT_THAT_HAS_TWO_TAGS("src/test/resources/_git_with_commit_that_has_two_tags"),
ON_A_TAG_DIRTY("src/test/resources/_git_on_a_tag_dirty"),
/**
* <pre>
* * 01ed93c - (11 years ago) any commit, just a readme - Konrad Malawski (HEAD -> master)
* * 4ce26eb - (11 years ago) my submodules, yay - Konrad Malawski
* </pre>
* <pre>
* $ git submodule status
* -9fd4b69a5ca09b60884d4f8f49ce16ea071077be module1
* -9fd4b69a5ca09b60884d4f8f49ce16ea071077be module2
* -9fd4b69a5ca09b60884d4f8f49ce16ea071077be module3
* -9fd4b69a5ca09b60884d4f8f49ce16ea071077be module4
*
* $ git config --file .gitmodules --get-regexp '\.url$'
* submodule.module1.url /tmp/module1
* submodule.module2.url /tmp/module1
* submodule.module3.url /tmp/module1
* submodule.module4.url /tmp/module1
* </pre>
*/
WITH_SUBMODULES("src/test/resources/_git_with_submodules"),
/**
* <pre>
* 6455ccd - (3 minutes ago) init (HEAD -> master)
* </pre>
* <pre>
* $ git submodule status
* 945bfe60e8a3eff168e915c7ba5bac37c9d0165b remote-module (heads/empty-branch)
*
* $ git submodule foreach --recursive git remote get-url origin
* Entering 'remote-module'
* git@github.com:git-commit-id/git-test-resources.git
* </pre>
*/
WITH_REMOTE_SUBMODULES("src/test/resources/_git_with_remote_submodules"),
/**
*
*
* <pre>
* b6a73ed - (HEAD, master) third addition (4 minutes ago) <p>Konrad Malawski</p>
* d37a598 - (lightweight-tag) second line (6 minutes ago) <p>Konrad Malawski</p>
* 9597545 - (annotated-tag) initial commit (6 minutes ago) <p>Konrad Malawski</p>
* </pre>
*/
WITH_LIGHTWEIGHT_TAG_BEFORE_ANNOTATED_TAG(
"src/test/resources/_git_lightweight_tag_before_annotated_tag"),
/**
*
*
* <pre>
* * 9cb810e - Change in tag - Fri, 29 Nov 2013 10:39:31 +0100 (tag: test_tag, branch: test)
* | * 2343428 - Moved master - Fri, 29 Nov 2013 10:38:34 +0100 (HEAD, branch: master)
* |/
* * e3d159d - Added readme - Fri, 29 Nov 2013 10:38:02 +0100
* </pre>
*/
WITH_TAG_ON_DIFFERENT_BRANCH("src/test/resources/_git_with_tag_on_different_branch"),
WITH_ONE_COMMIT_WITH_SPECIAL_CHARACTERS("src/test/resources/_git_one_commit_with_umlaut"),
/**
*
*
* <pre>
* b0c6d28b3b83bf7b905321bae67d9ca4c75a203f 2015-06-04 00:50:18 +0200 (HEAD, master)
* 0e3495783c56589213ee5f2ae8900e2dc1b776c4 2015-06-03 23:59:10 +0200 (tag: v2.0)
* f830b5f85cad3d33ba50d04c3d1454e1ae469057 2015-06-03 23:57:53 +0200 (tag: v1.0)
* </pre>
*/
WITH_THREE_COMMITS_AND_TWO_TAGS_CURRENTLY_ON_COMMIT_WITHOUT_TAG(
"src/test/resources/_git_three_commits_and_two_tags_currently_on_commit_without_tag"),
/**
* <pre>
* $ git log --name-only --pretty=format:"%H '%an' '%aD' '%s' %d" --date=short
* 2ed2ea209fb99c360cd8434eb2d82b929da6b908
* 'TheSnoozer'
* 'Fri, 27 Mar 2026 17:40:36 +0100'
* 'a change in the root pom' (HEAD -> master)
* pom.xml
*
* 70a13b95591dac76ce92dd9087d557fca539f98a
* 'submodule-two Author'
* 'Fri, 27 Mar 2026 17:39:59 +0100'
* 'a change in submodule-two' (tag: tag-submodule-two)
* submodule-two/pom.xml
*
* 91e49245092c089624d3e770d902cfc8bc53a852
* 'submodule-one Author'
* 'Fri, 27 Mar 2026 17:39:23 +0100'
* 'a change in submodule-one' (tag: tag-submodule-one)
* submodule-one/pom.xml
*
* 9c5d2e13d042b0acb71c48232a9c408e42da87f7
* 'TheSnoozer'
* 'Fri, 27 Mar 2026 17:38:16 +0100'
* 'new repo for testing (based on git-commit-id-maven-debugging)'
* [snip]
* </pre>
* and dirty:
* <pre>
* $ git status -s
* M submodule-two/pom.xml
* </pre>
*/
WITH_SUBMODULES_AND_MULTIPLE_COMMITS(
"src/test/resources/_git_with_submodules_and_multiple_commits"),
// TODO: Why do the tests get stuck when we use .git??
MAVEN_GIT_COMMIT_ID_PLUGIN("src/test/resources/_git_one_commit_with_umlaut");
private String dir;
AvailableGitTestRepo(String dir) {
this.dir = dir;
}
@Nonnull
public File getDir() {
return new File(dir);
}
}