Skip to content

Commit dc2eb31

Browse files
committed
Better handling of git conflicts when publishing to github pages.
1 parent 684a1f8 commit dc2eb31

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/src/main/java/ca/weblite/jdeploy/services/CheerpjService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ private void publishToGithubPages() throws IOException, InterruptedException {
198198
throw new IOException("Github pages publish path is null.");
199199
}
200200
File publishPath = new File(packageJSONFile.getParentFile(), githubPagesPublishPath);
201+
boolean stashed = false;
201202
if (!currentBranch.equals(githubPagesBranch)) {
203+
executeGitCommand("git", "stash");
204+
stashed = true;
202205
checkoutBranch(githubPagesBranch, true, true);
203206
}
204207
try {
@@ -208,6 +211,9 @@ private void publishToGithubPages() throws IOException, InterruptedException {
208211
publishPath.getParentFile().mkdirs();
209212
publishToCurrentBranch(publishPath);
210213
} finally {
214+
if (stashed) {
215+
executeGitCommand("git", "stash", "pop");
216+
}
211217
if (!currentBranch.equals(githubPagesBranch)) {
212218
checkoutBranch(currentBranch, false, false);
213219
}

0 commit comments

Comments
 (0)