Skip to content

Commit

Permalink
Adding script to generate changelog
Browse files Browse the repository at this point in the history
 * Finding git repo in parent folders correctly #bugfix
  • Loading branch information
tomasbjerre committed Nov 15, 2015
1 parent ba9d565 commit 82be7c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions generate_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#/bin/bash
cd build/distributions
unzip *T.zip
cd *T
./bin/git-changelog-lib -std
6 changes: 4 additions & 2 deletions src/main/java/se/bjurr/gitchangelog/internal/git/GitRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.google.common.base.Joiner.on;
import static com.google.common.base.Optional.absent;
import static com.google.common.base.Optional.of;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Lists.newArrayList;
Expand Down Expand Up @@ -53,6 +54,7 @@ public GitRepo() {
public GitRepo(File repo) {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Optional<File> gitDir = findClosestGitRepo(repo);
checkArgument(gitDir.isPresent(), "Could not find any Git repo in " + repo.getAbsolutePath());

try {
this.repository = builder//
Expand Down Expand Up @@ -137,9 +139,9 @@ private static Optional<File> findClosestGitRepo(File file) {
if (candidate.exists()) {
return of(candidate);
}
if (file.getParent() == null) {
if (file.getAbsoluteFile().getParent() == null) {
return absent();
}
return findClosestGitRepo(file.getParentFile());
return findClosestGitRepo(file.getAbsoluteFile().getParentFile());
}
}

0 comments on commit 82be7c3

Please # to comment.