Configure default commit/branch

Issue #39 new
Mikhail Dobrinin created an issue

I am proposing a configuration to default to a certain commit/branch when a link is requested for a commit that does not exit. The reason is that Git in IntelliJ is kind of clunky, and it is tedious to go through and select a commit/branch when Linky asks you to select a new commit. Most of the time, a certain branch e.g., master, will be good enough when the current branch has not been pushed. I think this would help the user experience for users who link references daily.

Scenario:

User requests link while the local repository has not pushed local changes.

Proposal:

  • Default set - plugin links directly to configured default branch instead of user's local repository commit; e.g., ?at=master
  • Default not set - current behavior, plugin asks user to select a new commit

Comments (4)

  1. Daniil Penkin staff

    Hey @mdobrinin,

    Huge thanks for your proposal! I know your pain, this happens to me too :)

    I agree, current behaviour in case of unpushed commit is way too far from ideal. The warning is just to make it somewhat acceptable (otherwise the link is just wrong). I was thinking about simply replacing it with something like you say, however it i still not perfect. The problem is that the file might've been renamed between the "default" branch and your current commit, as well as the line numbers, if you had any of them included in the link, might be off, so you'll get a wrong selection.

    My idea to solve this issue was to go up along the commit tree, starting from the current (unpushed) one and find the first ancestor commit that has been pushed, then adjust the difference: file name (full path, actually: imagine the file has been moved) and line numbers. Finding the correct file name should be not too hard (when you create a link for a commit from the gutter annotations or VCS log, Linky does something similar), but with lines it is not that simple, from memory. But surely doable.

    Anyway, this was my plan but so far I wasn't focusing too much on implementing or even spiking this.

    I'll leave this ticket in the backlog for now. I really lean towards making it right rather than adding another configuration parameter: I really want to keep the number of configurable things as small as possible and make Linky smart enough instead :)

    I'm always open for discussion, so if you have a better idea or any comments, please let me know.

    Cheers, Daniil

  2. Log in to comment