Skip to content

Commit

Permalink
checkout bot: use full path for marks files
Browse files Browse the repository at this point in the history
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Aug 27, 2020
1 parent 0d9698b commit 8a2d11c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<Bot> create(BotConfiguration configuration) {
var fromBranch = new Branch(from.substring(lastColon + 1));
var to = Path.of(repo.get("to").asString());

var repoName = Path.of(fromURI.getPath()).getFileName().toString();
var repoName = fromURI.getPath();
var markStorage = MarkStorage.create(marksRepo, marksUser, repoName);

bots.add(new CheckoutBot(fromURI, fromBranch, to, storage, markStorage));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static Set<Mark> deserialize(String current) {
}

static StorageBuilder<Mark> create(HostedRepository repo, Author user, String name) {
return new StorageBuilder<Mark>(name + ".marks.txt")
return new StorageBuilder<Mark>(name + "/marks.txt")
.remoteRepository(repo, "master", user.name(), user.email(), "Updated marks for " + name)
.serializer(MarkStorage::serialize)
.deserializer(MarkStorage::deserialize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ private static Repository tryMaterialize(HostedRepository repository, Path local
} catch (IOException ignored) {
// The remote ref may not yet exist
Repository localRepository = Repository.init(localStorage, repository.repositoryType());
var file = localStorage.resolve(fileName);
Files.createDirectories(file.getParent());
var storage = Files.writeString(localStorage.resolve(fileName), "");
localRepository.add(storage);
var firstCommit = localRepository.commit(message, authorName, authorEmail);
Expand Down

1 comment on commit 8a2d11c

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 8a2d11c Aug 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.