Skip to content

Commit 90c3998

Browse files
author
S L
committed
creating a new git-intergration repository to fix the integration tests the right way
1 parent 09085f1 commit 90c3998

39 files changed

+540
-3
lines changed

src/test/java/pl/project13/maven/git/AvailableGitTestRepo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public enum AvailableGitTestRepo {
6060
WITH_LIGHTWEIGHT_TAG_BEFORE_ANNOTATED_TAG("src/test/resources/_git_lightweight_tag_before_annotated_tag"),
6161
WITH_TAG_ON_DIFFERENT_BRANCH("src/test/resources/_git_with_tag_on_different_branch"),
6262
WITH_ONE_COMMIT_WITH_SPECIAL_CHARACTERS("src/test/resources/_git_one_commit_with_umlaut"),
63+
/**
64+
* <pre>
65+
* b0c6d28b3b83bf7b905321bae67d9ca4c75a203f 2015-06-04 00:50:18 +0200 (HEAD, master)
66+
* 0e3495783c56589213ee5f2ae8900e2dc1b776c4 2015-06-03 23:59:10 +0200 (tag: v2.0)
67+
* f830b5f85cad3d33ba50d04c3d1454e1ae469057 2015-06-03 23:57:53 +0200 (tag: v1.0)
68+
* </pre>
69+
*/
70+
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"),
6371
MAVEN_GIT_COMMIT_ID_PLUGIN(".git");
6472

6573
private String dir;

src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,15 +624,16 @@ public void runGitDescribeWithMatchOption(boolean useNativeGit) throws Exception
624624
// given
625625
mavenSandbox.withParentProject("my-plugin-project", "jar")
626626
.withNoChildProject()
627-
.withGitRepoInParent(AvailableGitTestRepo.MAVEN_GIT_COMMIT_ID_PLUGIN)
627+
.withGitRepoInParent(AvailableGitTestRepo.WITH_THREE_COMMITS_AND_TWO_TAGS_CURRENTLY_ON_COMMIT_WITHOUT_TAG)
628628
.create(CleanUp.CLEANUP_FIRST);
629629
MavenProject targetProject = mavenSandbox.getParentProject();
630630

631631
setProjectToExecuteMojoIn(targetProject);
632632

633+
String headCommitId = "b0c6d28b3b83bf7b905321bae67d9ca4c75a203f";
633634
Map<String,String> gitTagMap = new HashMap<String,String>();
634-
gitTagMap.put("v2.1.14", "29dc3016a3aace7149b3b50dc92573b0915ba125");
635-
gitTagMap.put("v2.1.15", "b899499b3cf549238a8a30799faee47b3505b5bf");
635+
gitTagMap.put("v1.0", "f830b5f85cad3d33ba50d04c3d1454e1ae469057");
636+
gitTagMap.put("v2.0", "0e3495783c56589213ee5f2ae8900e2dc1b776c4");
636637

637638
for (Map.Entry<String,String> entry : gitTagMap.entrySet()) {
638639
String gitDescribeMatchNeedle = entry.getKey();
@@ -654,6 +655,7 @@ public void runGitDescribeWithMatchOption(boolean useNativeGit) throws Exception
654655

655656
assertThat(targetProject.getProperties().stringPropertyNames()).contains("git.commit.id");
656657
assertThat(targetProject.getProperties().get("git.commit.id")).isNotEqualTo(commitIdOfMatchNeedle);
658+
assertThat(targetProject.getProperties().get("git.commit.id")).isEqualTo(headCommitId);
657659
}
658660
}
659661

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Third line
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/master
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[core]
2+
repositoryformatversion = 0
3+
filemode = true
4+
bare = false
5+
logallrefupdates = true
6+
[user]
7+
name = S L
8+
email = s.lange@mailbox.tu-berlin.de
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Unnamed repository; edit this file 'description' to name the repository.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to check the commit log message taken by
4+
# applypatch from an e-mail message.
5+
#
6+
# The hook should exit with non-zero status after issuing an
7+
# appropriate message if it wants to stop the commit. The hook is
8+
# allowed to edit the commit message file.
9+
#
10+
# To enable this hook, rename this file to "applypatch-msg".
11+
12+
. git-sh-setup
13+
test -x "$GIT_DIR/hooks/commit-msg" &&
14+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15+
:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to check the commit log message.
4+
# Called by "git commit" with one argument, the name of the file
5+
# that has the commit message. The hook should exit with non-zero
6+
# status after issuing an appropriate message if it wants to stop the
7+
# commit. The hook is allowed to edit the commit message file.
8+
#
9+
# To enable this hook, rename this file to "commit-msg".
10+
11+
# Uncomment the below to add a Signed-off-by line to the message.
12+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13+
# hook is more suited to it.
14+
#
15+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17+
18+
# This example catches duplicate Signed-off-by lines.
19+
20+
test "" = "$(grep '^Signed-off-by: ' "$1" |
21+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22+
echo >&2 Duplicate Signed-off-by lines.
23+
exit 1
24+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to prepare a packed repository for use over
4+
# dumb transports.
5+
#
6+
# To enable this hook, rename this file to "post-update".
7+
8+
exec git update-server-info
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
# An example hook script to verify what is about to be committed
4+
# by applypatch from an e-mail message.
5+
#
6+
# The hook should exit with non-zero status after issuing an
7+
# appropriate message if it wants to stop the commit.
8+
#
9+
# To enable this hook, rename this file to "pre-applypatch".
10+
11+
. git-sh-setup
12+
test -x "$GIT_DIR/hooks/pre-commit" &&
13+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14+
:

0 commit comments

Comments
 (0)