From: Johannes Schindelin Date: Thu, 25 Aug 2016 15:06:59 GMT Subject: [PATCH 4/6] require_clean_work_tree: ensure that the index was read Message-ID: <4122fc996a0076c2426d5e1325f2ce2810ef4f9b.1472137582.git.johannes.schindelin@gmx.de> In-Reply-To: The function would otherwise pretend to work fine, but totally ignore the working directory. Signed-off-by: Johannes Schindelin --- wt-status.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wt-status.c b/wt-status.c index 792dda9..33dd76f 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1804,6 +1804,13 @@ int require_clean_work_tree(const char *action, const char *hint, int gently) struct lock_file *lock_file = xcalloc(1, sizeof(*lock_file)); int err = 0; + if (read_cache() < 0) { + error(_("Could not read index")); + if (gently) + return -1; + exit(1); + } + hold_locked_index(lock_file, 0); refresh_cache(REFRESH_QUIET); update_index_if_able(&the_index, lock_file); -- 2.10.0.rc1.99.gcd66998