From e278600f599f60a2b98aeae6bfbb6ba92cf92d6f Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 10 Feb 2009 12:06:35 +0100 Subject: [PATCH] Status view: report failures to update a file Also, wait showing update progress until 5% has been reached. --- NEWS | 1 + tig.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index f9b2e7f..7927c21 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Improvements: Bug fixes: - Status view: show error when failing to open a file. + - Status view: report failures to update a file. - Blame view: fix problem with uninitialized variable. - Blame view: use line number information when loading blame for specific commit. diff --git a/tig.c b/tig.c index d2a9fe8..8b8d593 100644 --- a/tig.c +++ b/tig.c @@ -5102,13 +5102,13 @@ status_update_file(struct status *status, enum line_type type) return FALSE; result = status_update_write(&io, status, type); - done_io(&io); - return result; + return done_io(&io) && result; } static bool status_update_files(struct view *view, struct line *line) { + char buf[sizeof(view->ref)]; struct io io = {}; bool result = TRUE; struct line *pos = view->line + view->lines; @@ -5121,7 +5121,8 @@ status_update_files(struct view *view, struct line *line) for (pos = line; pos < view->line + view->lines && pos->data; pos++) files++; - for (file = 0, done = 0; result && file < files; line++, file++) { + string_copy(buf, view->ref); + for (file = 0, done = 5; result && file < files; line++, file++) { int almost_done = file * 100 / files; if (almost_done > done) { @@ -5129,12 +5130,13 @@ status_update_files(struct view *view, struct line *line) string_format(view->ref, "updating file %u of %u (%d%% done)", file, files, done); update_view_title(view); + doupdate(); } result = status_update_write(&io, line->data, line->type); } + string_copy(view->ref, buf); - done_io(&io); - return result; + return done_io(&io) && result; } static bool -- 2.30.2