Commit Graph

2 Commits

Author SHA1 Message Date
Jonathan Nieder
fb7749e4e4 commit --amend: cope with missing display name
Though I have not seen this in the wild, it has been said that there
are likely to be git repositories converted from other version control
systems with an invalid ident line like this one:

  author <user@example.com> 18746342 +0000

Because there is no space between the (empty) user name and the email
address, commit --amend chokes.  When searching for a
space-left-bracket sequence on the ident line, it finds it in the
committer line, ending up utterly confused.

Better for commit --amend to treat this like a valid ident line with
empty username and complain.

The tests remove the questionable commit objects after use so there is
no chance for them to confuse later tests.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:28:08 -07:00
Erick Mattos
c51f6ceed6 commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author
When we use -c, -C, or --amend, we are trying one of two things: using the
source as a template or modifying a commit with corrections.

When these options are used, the authorship and timestamp recorded in the
newly created commit are always taken from the original commit.  This is
inconvenient when we just want to borrow the commit log message or when
our change to the code is so significant that we should take over the
authorship (with the blame for bugs we introduce, of course).

The new --reset-author option is meant to solve this need by regenerating
the timestamp and setting the committer as the new author.

Signed-off-by: Erick Mattos <erick.mattos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 16:59:15 -08:00