summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-22 20:03:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-07-22 20:03:29 (GMT)
commitf5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3 (patch)
treede02b5b5b4739f1537c47400ad6d7129efe3bfb7 /builtin
parent1cd2913960f752508c3f529dbccd359ed79a1a9f (diff)
parentea2d4ed35902ce15959965ab86d80527731a177c (diff)
downloadgit-f5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3.zip
git-f5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3.tar.gz
git-f5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3.tar.bz2
Merge branch 'jk/maint-commit-amend-only-no-paths' into maint
"git commit --amend --only --" was meant to allow "Clever" people to rewrite the commit message without making any change even when they have already changes for the next commit added to their index, but it never worked as advertised since it was introduced in 1.3.0 era. * jk/maint-commit-amend-only-no-paths: commit: fix "--amend --only" with no pathspec
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index f43eaaf..3c3385c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -184,6 +184,9 @@ static int list_paths(struct string_list *list, const char *with_tree,
int i;
char *m;
+ if (!pattern)
+ return 0;
+
for (i = 0; pattern[i]; i++)
;
m = xcalloc(1, i);
@@ -345,7 +348,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
* and create commit from the_index.
* We still need to refresh the index here.
*/
- if (!pathspec || !*pathspec) {
+ if (!only && (!pathspec || !*pathspec)) {
fd = hold_locked_index(&index_lock, 1);
refresh_cache_or_die(refresh_flags);
if (active_cache_changed) {