Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Does JGIT allow for running commands in parallel?
Does JGIT allow for running commands in parallel? [message #1848839] Mon, 20 December 2021 16:28 Go to next message
Cody Mikol is currently offline Cody MikolFriend
Messages: 5
Registered: December 2021
Junior Member
When trying to run two jgit commands in parallel, I'm getting lock exceptions. Essentially I'm trying to add everything currently in my working directory into my index. (deleted + modified + added files)

This is how I do this at the moment


launch {
    // setUpdate allows us to remove deleted files, but disallows adding new files. So we have to do this twice...
    this@stageAll
        .add()
        .addFilepattern(".")
        .setUpdate(true)
        .call()
        .also { logger.info("Staging all files") }
        .unit()
}
launch {
    this@stageAll
        .add()
        .addFilepattern(".")
        .call()
        .also { logger.info("Staging all files") }
        .unit()
}


Is there a way to have jgit run these together in a single operation?
Re: Does JGIT allow for running commands in parallel? [message #1849002 is a reply to message #1848839] Wed, 29 December 2021 00:40 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1213
Registered: July 2009
Senior Member
what is
- launch { }
- this@stageAll
?
Re: Does JGIT allow for running commands in parallel? [message #1853125 is a reply to message #1849002] Sun, 19 June 2022 15:29 Go to previous messageGo to next message
Cody Mikol is currently offline Cody MikolFriend
Messages: 5
Registered: December 2021
Junior Member
This is kotlin code

@ is a label

launch will run something in a coroutine context

Sorry, I tried a few times to find my own post, but didn't know how to find my own post.
Re: Does JGIT allow for running commands in parallel? [message #1853157 is a reply to message #1853125] Tue, 21 June 2022 06:03 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1213
Registered: July 2009
Senior Member
Staging requires locking the git index (aka DirCache) that's why you can't run AddCommand concurrently on the same repository.
See https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/refs/heads/master/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java#122
Previous Topic:jgit.sh on wsl
Next Topic:How to get User info from personal access token
Goto Forum:
  


Current Time: Mon Oct 03 20:42:09 GMT 2022

Powered by FUDForum. Page generated in 0.02339 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top