Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Do not push branch before adding commits #39

Closed
ddgenome opened this issue Jul 12, 2017 · 3 comments
Closed

Do not push branch before adding commits #39

ddgenome opened this issue Jul 12, 2017 · 3 comments

Comments

@ddgenome
Copy link
Contributor

Currently when creating commits on a branch, it appears the branch is created and pushed before the commits are added:

https://github.com/atomist/artifact-source/blob/81034cb4c59ff36e816a4a2139bd9e324b75c94c/src/main/scala/com/atomist/source/git/GitHubServices.scala#L84

and then the changes are added to the branch via a commit and then the branch is pushed again.

This causes unnecessary churn in CI and causes issues in downstream handlers for branch builds, e.g., CascadeBuilds in spring-team-handlers.

Can artifact-source be changed to do all the work it needs to do locally and then just make one push at the end?

@alankstewart
Copy link
Contributor

alankstewart commented Jul 13, 2017

@ddgenome Yes, artifact-source can be changed to do all work locally and make one push at the end. However, we will need to switch to JGit as the GitHub V3 api requires the sha of the branch to commit files to it, and if the branch doesn't exist, it needs to be created first.

Using JGit means we no longer have to use the github-java library as well as the extra Rest api calls currently we need to make.

@cdupuis After confirming this with you, I will make a start on converting to JGit.

@alankstewart
Copy link
Contributor

A new JGitServices provides a method, createBranchFromChanges to create a branch and push changes in one commit

@alankstewart
Copy link
Contributor

Callers can use JGitServices#createBranchFromChanges if required.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants