Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348744

Summary: Staging view does not respect project-specific commit message template
Product: [Technology] EGit Reporter: Robert Munteanu <robert.munteanu>
Component: MylynAssignee: Project Inbox <egit.mylyn-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: b.muskalla, eclipse-2021.bugzilla, eclipse, leachbj, matthias.sohn, sam.davis, steffen.pingel, stepper, torkildr
Version: 1.0   
Target Milestone: 4.5   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/81047
https://git.eclipse.org/c/egit/egit.git/commit/?id=5652cb7ba8ce14c25a21657c345336f383edc064
Whiteboard:

Description Robert Munteanu CLA 2011-06-08 09:58:54 EDT
If I have a project with a specific commit comment template ( Mylyn preference ) and stage a change using the 'staging view' - drag and drop a file to the 'staged changes' widget the commit message template follows the workspace commit template preference, not the project-specific one.

Using the commit dialog brings up the correct message.
Comment 1 Bernard Leach CLA 2011-07-03 06:33:02 EDT
I've just tested this with the nightly build and it seems to work as I expect it.  Can you test with that?
Comment 2 Bernard Leach CLA 2011-07-03 06:37:35 EDT
Actually, I think I have seen the issue now.  If you switch to a new task the staging view retains the old task's commit message whereas the commit dialog will show the new task's.
Comment 3 Robert Munteanu CLA 2011-07-04 03:37:02 EDT
(In reply to comment #2)
> Actually, I think I have seen the issue now.  If you switch to a new task the
> staging view retains the old task's commit message whereas the commit dialog
> will show the new task's.

This is another problem which I have noticed, but I was too lazy to report it as well. I think that the root cause is the one reported in bug 349763 ; since my staging view is hidden when the task is activated it is unable to find a project and therefore does not read the project-specific bug template. 

Please try activating a task with the staging view minimised . The project-specific template will not get selected. Instead, the global one will be used.
Comment 4 Bernard Leach CLA 2011-07-10 01:43:11 EDT
Pushed a minor change to track changes to the commit message so it can be reset if it hasn't changed (perhaps a 'Update commit message?' dialog could be used in some places).

http://egit.eclipse.org/r/3858

The core issue with mylyn based commit messages is that egit does not track task activation so it won't update automatically to task activation.  With this patch the current commit message would be updated if you stage or unstage a resource (or otherwise refresh the staging view) if the commit messages is unmodified.
Comment 5 Steffen Pingel CLA 2012-11-12 05:10:38 EST
*** Bug 387388 has been marked as a duplicate of this bug. ***
Comment 6 Steffen Pingel CLA 2013-04-17 18:06:45 EDT
*** Bug 394056 has been marked as a duplicate of this bug. ***
Comment 7 Steffen Pingel CLA 2013-07-11 15:35:12 EDT
*** Bug 412714 has been marked as a duplicate of this bug. ***
Comment 8 Sam Davis CLA 2013-07-11 15:50:34 EDT
The issue here is that when using the staging view, the project-specific commit message template is *never* used. Instead, the gloabl commit message template is used. The commit dialog uses the correct template; the staging view should use the same one.
Comment 9 Eike Stepper CLA 2014-07-09 13:15:08 EDT
(In reply to Bernard Leach from comment #4)
> http://egit.eclipse.org/r/3858

This link doesn't seem to work anymore. Is somebody considering to fix this problem?
Comment 10 Sam Davis CLA 2014-07-09 18:30:18 EDT
What template should be used if multiple projects are involved in the commit?
Comment 11 Matthias Sohn CLA 2014-07-09 18:33:51 EDT
(In reply to Eike Stepper from comment #9)
> (In reply to Bernard Leach from comment #4)
> > http://egit.eclipse.org/r/3858
> 
> This link doesn't seem to work anymore. Is somebody considering to fix this
> problem?

this link points to the old gerrit server egit was using before webmaster did setup the shared server. This link translates to
https://git.eclipse.org/r/#/c/3858
on the shared server.

I'll have a look into this patch which obviously slipped through.
Comment 12 Sam Davis CLA 2014-07-09 19:14:38 EDT
Looking at that patch, it might be a needed step towards addressing an important issue for the Mylyn integration, but it has nothing to do with the description/summary of this bug.
Comment 13 Eike Stepper CLA 2014-07-10 01:45:08 EDT
(In reply to Sam Davis from comment #10)
> What template should be used if multiple projects are involved in the commit?

There seem to be some options. I'd probably just add them all (ordered by relevance?). In the end this case is not so frequent.

(In reply to Sam Davis from comment #12)
> [...] but it has nothing to do with the description/summary of this bug.

Do you want me to submit a new bugzilla? Against what component?
Comment 14 Sam Hasler CLA 2014-07-10 08:26:03 EDT
(In reply to Eike Stepper from comment #13)
> (In reply to Sam Davis from comment #10)
> > What template should be used if multiple projects are involved in the commit?
> 
> There seem to be some options. I'd probably just add them all (ordered by
> relevance?). In the end this case is not so frequent.

We have a repo that has multiple projects in the same repo[1] and it's standard practice here to commit to multiple projects at once, so I have to deal with this often.

What would make this nicer is if there was an option to ignore any lines that already exist in the message. i.e.:

If each project had a template of the form:
> ${task.key} ${task.description} 
> Project X:
> - 

It would not repeat the "${task.key} ${task.description}" line but if you included content from projects X, Y and Z it would give you a template like:

> ${task.key} ${task.description} 
> Project X:
> - 
> Project Y:
> Project Z:

Alternately. A way to specify a command line to to pipe the template through would allow more flexibility.

[1] It's actually an svn repo that I access via git svn.
Comment 15 Eike Stepper CLA 2014-07-10 11:15:41 EDT
Oh yes, I think I was a bit unclear. I suspect that most people (like myself) would use the same, per-repo comment template for all the projects that come from that repo. And of course they'd commit changes to multiple such projects at once. So I meant (but didn't say) that the templates for these projects, if they're really identical, should result in only one commit message. In the end this commit is task-specific and not project-related. Would that be right?
Comment 16 Sam Davis CLA 2014-07-10 20:44:20 EDT
(In reply to comment #13)
> 
> Do you want me to submit a new bugzilla? Against what component?

I think it's worth opening a bug against EGit/Mylyn (if there isn't already one) that the commit message is not refreshed when the active task changes. That's a major annoyance for me.

(In reply to comment #15)
> once. So I meant (but didn't say) that the templates for these projects, if
> they're really identical, should result in only one commit message. In the end
> this commit is task-specific and not project-related. Would that be right?

I think that's right. In fact it might be fine to just use the commit template of the first project. Perhaps that's what the commit dialog does already. This is sounding like an easy fix.
Comment 17 Eike Stepper CLA 2014-07-11 01:02:07 EDT
*** Bug 439389 has been marked as a duplicate of this bug. ***
Comment 18 Eike Stepper CLA 2014-07-11 01:02:49 EDT
(In reply to Sam Davis from comment #16)
> I think it's worth opening a bug against EGit/Mylyn (if there isn't already
> one) that the commit message is not refreshed when the active task changes.
> That's a major annoyance for me.

Same for me. That's why I contributed a patch two years ago:
  http://bugs.eclipse.org/393118
Comment 19 Sam Davis CLA 2014-07-11 13:53:59 EDT
Thanks for the bug. I would love to see it fixed.
Comment 20 Torkild Resheim CLA 2016-05-20 04:31:22 EDT
Maybe it is a good idea to revive this issue as Eclipse Neon has disabled the Git commit dialog by default.
Comment 21 Eclipse Genie CLA 2016-09-13 19:23:16 EDT
New Gerrit change created: https://git.eclipse.org/r/81047
Comment 22 Eclipse Genie CLA 2016-09-14 18:39:06 EDT
Gerrit change https://git.eclipse.org/r/81047 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=5652cb7ba8ce14c25a21657c345336f383edc064
Comment 23 Matthias Sohn CLA 2016-09-14 18:39:42 EDT
merged