Skip to content

Commit b0bf006

Browse files
committed
Merge pull request #147 from TheSnoozer/master
Fix for #146
2 parents 389edc6 + 8e99f0d commit b0bf006

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/main/java/pl/project13/maven/git/NativeGitProvider.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@ protected String getBranchName() throws IOException {
7373
}
7474

7575
private String getBranch(File canonical) {
76-
String branch = tryToRunGitCommand(canonical, "symbolic-ref HEAD");
77-
if (branch != null) {
78-
branch = branch.replace("refs/heads/", "");
76+
String branch = null;
77+
try{
78+
branch = tryToRunGitCommand(canonical, "symbolic-ref HEAD");
79+
if (branch != null) {
80+
branch = branch.replace("refs/heads/", "");
81+
}
82+
}catch(RuntimeException e){
83+
// it seems that git repro is in 'DETACHED HEAD'-State, using Commid-Id as Branch
84+
branch = getCommitId();
7985
}
8086
return branch;
8187
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,6 @@ public void shouldExtractTagsOnGivenCommit(boolean useNativeGit) throws Exceptio
621621
@Test
622622
@Parameters(method = "useNativeGit")
623623
public void runGitDescribeWithMatchOption(boolean useNativeGit) throws Exception {
624-
if (System.getenv().get("TRAVIS").equals("true") && System.getenv().get("CI").equals("true")) {
625-
// FIXME: this test has trouble on travis, I think it's because of not pulling everything?
626-
return;
627-
}
628-
629624
// given
630625
mavenSandbox.withParentProject("my-pom-project", "pom")
631626
.withChildProject("my-jar-module", "jar")

0 commit comments

Comments
 (0)