This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 925974e CAMEL-17473: camel-github: startingSha=last doesn't work properly. Thanks to Andrea Pilo for the patch. 925974e is described below commit 925974e46e4805f3d7e5095bd3ac2c9dbc6cea2b Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jan 11 16:44:49 2022 +0100 CAMEL-17473: camel-github: startingSha=last doesn't work properly. Thanks to Andrea Pilo for the patch. --- .../org/apache/camel/component/github/consumer/CommitConsumer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java index f4abe1f..d8afce2 100644 --- a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java +++ b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/CommitConsumer.java @@ -76,8 +76,11 @@ public class CommitConsumer extends AbstractGitHubConsumer { LOG.info("GitHub CommitConsumer: Indexing current commits..."); List<RepositoryCommit> commits = commitService.getCommits(getRepository(), branchName, null); for (RepositoryCommit commit : commits) { - commitHashes.add(commit.getSha()); - lastSha = commit.getSha(); + String sha = commit.getSha(); + commitHashes.add(sha); + if (lastSha == null) { + lastSha = sha; + } } LOG.info("GitHub CommitConsumer: Starting from last sha: {}", lastSha); } else if (!startingSha.equals("beginning")) {