Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362391 - Amend changes author date
Summary: Amend changes author date
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 1.2   Edit
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: 2.2-M1   Edit
Assignee: Robin Stocker CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-29 05:44 EDT by Robin Rosenberg CLA
Modified: 2012-10-17 11:55 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Rosenberg CLA 2011-10-29 05:44:58 EDT
Amending a change should only update the committer info, not the author info.
Comment 1 Tobias Oberlies CLA 2012-06-19 11:03:43 EDT
Some more information:
- Happens when amending a commit from the Git Staging view
- Still present in 2.0
Comment 2 Matthias Sohn CLA 2012-09-19 12:27:03 EDT
I failed to reproduce this problem on Mac using current master version
(2.2.0-SNAPSHOT). I tried amending in Staging View and using Commit Dialog started from Repositories View and Team menu. None touched the author of the amended commit.

Can you provide steps to reproduce ?
Comment 3 Matthias Sohn CLA 2012-09-21 02:08:19 EDT
Now I got it: amend is updating the author date which is wrong.
This happens both when amending from commit dialog or from staging view.
Comment 4 Robin Stocker CLA 2012-10-07 11:32:16 EDT
JGit change required for this:

https://git.eclipse.org/r/8077

EGit change then only needs to *not* set author in CommitOperation in case of amend.

Maybe we also need to detect if the user changed the author, which we would interpret as meaning "reset author". But I'm not sure about this. What do you think, Matthias?
Comment 5 Matthias Sohn CLA 2012-10-07 17:45:21 EDT
> Maybe we also need to detect if the user changed the author, which we would
> interpret as meaning "reset author". But I'm not sure about this. What do
> you think, Matthias?

native git has a couple of options controlling this [1]:
--reset-author resets the author to the committer and renews the author timestamp
--author=<author> allows to explicitly override the author
--date=<date> allows to explicitly override the author date

At the moment EGit only supports overriding the author but not the date, this would require enhancement of the UI. --reset-author would then probably become a new button, --author could provide value help using authors already known from the repository's history and --date would require displaying the author date and a way to edit this (a time picker control would be handy).

[1] http://www.kernel.org/pub/software/scm/git/docs/git-commit.html
Comment 6 Robin Rosenberg CLA 2012-10-08 00:12:33 EDT
I've mostly used the ability to change author name when the email address is wrong. In those cases I'd expect the datetime part to remain unchanged. The author/committer fields should probably be read-only and perhaps less prominent until you press a button that either expands the dialog or open a new dialog.
Comment 7 Robin Stocker CLA 2012-10-10 16:22:39 EDT
Let's try an example mockup, to have a more concrete discussion:

  Author: [Au Thor <mail@example.org>           ]    ☐ Reset date

It would only be like that on amend. Changing the author text field would change the author, but not the date.

Ticking the "Reset date" checkbox besides the text field would cause the author date to become the same as the committer date on commit.

Do we really want to support the user to supply an arbitrary datetime? I don't know if that's really needed (I've never done it myself using C Git, except for migrations where I've used GIT_AUTHOR_DATE).
Comment 8 Robin Rosenberg CLA 2012-10-10 18:22:38 EDT
(In reply to comment #7)

> Do we really want to support the user to supply an arbitrary datetime? 

No. It's a behavior that should not be encouraged. It's easy enough to
fake for the very very rare cases a user actually needs it. (copy text, reset --soft, commit).

> I don't know if that's really needed (I've never done it myself using C Git,
> except for migrations where I've used GIT_AUTHOR_DATE).
Comment 9 Robin Stocker CLA 2012-10-13 15:21:33 EDT
Ok, pushed a change that keeps the original date and combines it with the author the user entered (which is the original one if the user didn't change it):

https://git.eclipse.org/r/8192
Comment 10 Matthias Sohn CLA 2012-10-16 05:32:27 EDT
merged https://git.eclipse.org/r/8192 as
http://git.eclipse.org/c/jgit/jgit.git/commit/?id=08d81bf1673f4aeb816ce6f9278ffa028d4b5ac0

This fixes the problem reported here.
Comment 11 Robin Stocker CLA 2012-10-16 16:27:01 EDT
Thanks for merging. So, can we resolve this bug?
Comment 12 Matthias Sohn CLA 2012-10-17 11:14:45 EDT
yes, we can, I just wasn't sure if you want to also support the checkbox you proposed in comment 7
Comment 13 Robin Stocker CLA 2012-10-17 11:55:37 EDT
Ah, ok. No, Robin's argument that it can also be done using a soft reset in case anyone wants to do this convinced me that it's not worth it.