OpherV / gitflow4idea

Git Flow Integration plugin for IntelliJ
Apache License 2.0
504 stars 139 forks source link

Working tree contains unstaged changes #226

Open denisbondar opened 5 years ago

denisbondar commented 5 years ago

After this I just finish feature manually.

  1. Open task in PHPStorm: Tools - Tasks & Contexts - Open Task...
  2. In Open Task windows select in VCS Operations - only create changelist, and in GitFlow operations - Create Feature (or Create Hotfix, etc.). Press OK.
  3. Do some changes
  4. Close task in PHPStorm: Tools - Tasks & Contexts - Close Active Task...
  5. In Close Task window select: Commit Changes and Finish Feature. Press OK.
  6. I see error in PHPStorm: Error: Please have a look at the Version Control console for more details
  7. In Version Control Console I see:
    16:11:20.140: [project] git /usr/bin/git -c core.quotepath=false -c log.showSignature=false flow feature finish task-3876
    Fatal: Working tree contains unstaged changes. Aborting.
    16:11:20.316: [project] git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -f -- <list of changed files>
    16:11:20.329: [project] git -c core.quotepath=false -c log.showSignature=false rm --ignore-unmatch --cached -- <list of deleted files>
    16:11:20.346: [project] git -c core.quotepath=false -c log.showSignature=false commit -F /tmp/git-commit-msg-.txt --

The feature/hotfix branch is commit and merged to master/development and deleted.

OpherV commented 5 years ago

@denisbondar Thanks for the detailed report.

I tracked down the bug to this line in IntellIj's CloseTaskDialog: https://github.com/JetBrains/intellij-community/blob/0e91550e746c94ab6afe5c0d36450b93b587dd2d/plugins/tasks/tasks-core/src/com/intellij/tasks/actions/CloseTaskDialog.java#L103

Seems like the commit function of all the TaskDialog integrations is executed sequentially, so what happens is that the git commit and the gitflow finish actions are executed almost instantaneously, which means that the actual commit doesn't finish by the time the gitflow finish action starts.

I'm not entirely sure how to solve this, since the dialog integration doesn't provide a way to synchronously rely on other integrations. I've pinged the Jetbrains people to see if they have direction.