[PATCH] commit --interactive: properly update the index before commiting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When adding files through git commit --interactive, and 'quit'
afterwards, the message in the editor of the commit message indicates
that many (maybe all) files are deleted from the tree.  Dismissing that
and running git commit afterwards does the right thing.  This commit
fixes git commit --interactive to properly update the index before
commiting.

Reported by Jiří Paleček through
 http://bugs.debian.org/480429

Signed-off-by: Gerrit Pape <pape@xxxxxxxxxxx>
---
 builtin-commit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 07872c8..b294c1f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -223,6 +223,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
 
 	if (interactive) {
 		interactive_add(argc, argv, prefix);
+		if (read_cache() < 0)
+			die("index file corrupt");
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux