Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Updating a submodule

Mathieu Yargeau May 22, 2015

For a given repository, I would like to update a specific submodule to a specific SHA.

 

In command line, I am able to do this using the command 

 

git submodule update --remote MySubModule

 

And then push it. It updates it to the latest SHA.

 

I would like to do the same (update and push) through the Stash API (with a hook of some kind, using a service), but with a specific SHA, not necessarily the latest.

 

I tried searching in the Stash API, but did not find what I wanted. Is this even possible?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2015

I wanted to do a very similar thing in a plugin once but ended up abandoning it. There is no way to do this with the Stash API. More precisely, you need to invoke Git from the Stash API, (shallow) clone the repo somewhere and push a commit containing the submodule change.

Mathieu Yargeau May 25, 2015

Do you know how to create that shallow clone and run raw Git commands from the Stash API?

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2015

I think you need to create a Command object with https://developer.atlassian.com/static/javadoc/stash/latest/api/reference/com/atlassian/stash/scm/ScmCommandBuilder.html and then call it. (This applies to all raw Git commands.)

TAGS
AUG Leaders

Atlassian Community Events