diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-06-21 06:02:49 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-06-21 06:02:49 -0700 |
commit | 542ed78232ecbb1099eee5e3a4f1add0a2faa8d3 (patch) | |
tree | 043c1024a4a889d674ea80ae089459d1ba18eb05 /builtin/commit.c | |
parent | d5cff17edaf438bbf45a2130e9cadc0c938291d6 (diff) | |
parent | f197ed2fbeb2868c3514ad35bf986a3aa60285f0 (diff) | |
download | git-542ed78232ecbb1099eee5e3a4f1add0a2faa8d3.tar.gz git-542ed78232ecbb1099eee5e3a4f1add0a2faa8d3.tar.xz |
Merge branch 'jk/maint-advice-empty-amend'
* jk/maint-advice-empty-amend:
commit: give advice on empty amend
Diffstat (limited to 'builtin/commit.c')
-rw-r--r-- | builtin/commit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 511d4901d..5e4f0f33b 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -48,6 +48,11 @@ static const char implicit_ident_advice[] = "\n" " git commit --amend --author='Your Name <you@example.com>'\n"; +static const char empty_amend_advice[] = +"You asked to amend the most recent commit, but doing so would make\n" +"it empty. You can repeat your command with --allow-empty, or you can\n" +"remove the commit entirely with \"git reset HEAD^\".\n"; + static unsigned char head_sha1[20]; static char *use_message_buffer; @@ -708,6 +713,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (!commitable && !in_merge && !allow_empty && !(amend && is_a_merge(head_sha1))) { run_status(stdout, index_file, prefix, 0, s); + if (amend) + fputs(empty_amend_advice, stderr); return 0; } |