X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-diff.c;h=f557d21929fe3df018f30e68c7943ead7f8eb4a1;hb=f18b1c55e5b7478524c15685cd643555fc919f3f;hp=f77352b40decdc4cf8d2db29102703cb1193b49c;hpb=aecbf914c43ab76e055fa8a25b12456ae74d91bc;p=git.git diff --git a/builtin-diff.c b/builtin-diff.c index f77352b40..f557d2192 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -200,15 +200,11 @@ static void refresh_index_quietly(void) discard_cache(); read_cache(); refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED); - if (active_cache_changed) { - if (write_cache(fd, active_cache, active_nr) || - close(fd) || - commit_locked_index(lock_file)) - ; /* - * silently ignore it -- we haven't mucked - * with the real index. - */ - } + + if (active_cache_changed && + !write_cache(fd, active_cache, active_nr) && !close(fd)) + commit_locked_index(lock_file); + rollback_lock_file(lock_file); }