git-machete-intellij-plugin icon indicating copy to clipboard operation
git-machete-intellij-plugin copied to clipboard

Create dialog to inform that current branch is not managed by plugin

Open azdrojowa123 opened this issue 3 years ago • 10 comments

Create some kind of dialog to inform user that current branch is not managed by plugin. Maybe create some checkbox to add this branch to plugin. Add also button to Don't ask again about this issue.

azdrojowa123 avatar May 11 '22 10:05 azdrojowa123

Dialog should be non-modal, we don't want it be intrusive.

create some checkbox to add this branch to plugin

I'd even say, it can be button/link (rather than checkbox per se).

The inferred parent (or lack thereof, if com.virtuslab.gitmachete.backend.api.IGitMacheteRepository#inferParentForLocalBranch returns Option.none()) should be mentioned in the dialog as well.

PawelLipski avatar May 11 '22 10:05 PawelLipski

What's the specific scenario for this one?

  1. Be on a managed branch
  2. Checkout non-managed branch (from command line / git4idea)
  3. Show VcsNotification with an action to add the non-managed branch under the inferred parent.

Is that it?


Notes:

  • We need handling for no-managed root branches - where the parent cannot be inferred (I suppose).
  • What if the inferred parent is different from what a user expects? The VcsNotification could have two actions (despite Dismiss or smth). Accept or Accept and edit Machete file
  • Such a notification should take an expiration into account. I think that another checkout or Machete file edit belongs to actions that would make the notification expired (no longer valid) - probably there is more of them.

mkondratek avatar Aug 31 '22 10:08 mkondratek

Is that it?

:yes:

We need handling for no-managed root branches - where the parent cannot be inferred (I suppose).

+1, suggest to add them as a root

What if the inferred parent is different from what a user expects? The VcsNotification could have two actions (despite Dismiss or smth). Accept or Accept and edit Machete file

+1, should be enough

Such a notification should take an expiration into account. I think that another checkout or Machete file edit belongs to actions that would make the notification expired (no longer valid) - probably there is more of them.

+1, good spot, I didn't think of that

PawelLipski avatar Aug 31 '22 15:08 PawelLipski

Writing it just for a log.

The topic

BranchChangeListener.VCS_BRANCH_CHANGED

is not good enough for us. I took a look into what comes to com.intellij.openapi.vcs.BranchChangeListener#branchHasChanged(String branchName) and I saw HEAD, f47545bb46bdfe280a2f80e37925d5df6918be1f, build-chain^{0} and sometimes correct result - the newly checked out branch

I think we must rely on

GitRepository.GIT_REPO_CHANGE

and most likely have our own implementation of branch change tracking.

mkondratek avatar Sep 22 '22 08:09 mkondratek

and sometimes correct result

Okay... so specifically what were the wrong results? i.e. what's the reason we can't rely on VCS_BRANCH_CHANGED?

PawelLipski avatar Sep 22 '22 11:09 PawelLipski

The "wrong" ones are those I listed: HEAD, f47545bb46bdfe280a2f80e37925d5df6918be1f, build-chain^{0}.

mkondratek avatar Sep 22 '22 11:09 mkondratek

Okay... and what was expected? That none of them shows up? 🤔

PawelLipski avatar Sep 22 '22 11:09 PawelLipski

So, in a nutshell, when VCS_BRANCH_CHANGED is used, do we experience false positives (superfluous notifications) or false negatives (missing notifications)?

PawelLipski avatar Sep 22 '22 11:09 PawelLipski

I would expect the name of a branch that I ve checked out 😆 the above ones even might refer to the same thing (the branch) but we need simply a name (that's why I would not call them "false" or "wrong"). Also iirc they appear when a new branch is being created and checked out (but when I perform checkout only the result is better).

Another thing is that the branchHasChanged does not cover all cases. When you change the branch from command line and then move back to IDE window the topic is not being synced (it is not triggered). On the other hand, GitRepository.GIT_REPO_CHANGE works in that case correctly.

mkondratek avatar Sep 22 '22 11:09 mkondratek

It turned out that we need #1285 before this one.

mkondratek avatar Oct 19 '22 14:10 mkondratek