Re: [PATCH 1/4] commit: reload cache properly
- From
Thomas Rast <trast@inf.ethz.ch>
- Date
- May 30, 2013, 12:17 UTC
- Message-ID
- <87ehcok6gl.fsf@linux-k42r.v.cablecom.net>
- In-Reply-To
- <1369915136-4248-2-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> We are supposedly adding files, to to which cache if 'the_index' is > discarded?
[...]
Show 6 quoted lines
> if (!current_head) {
> discard_cache();
> + if (read_cache() < 0)
> + die(_("cannot read the index"));
> return;
> }It is not obvious to me that this is a correct change. discard_cache() without subsequent reloading could also legitimately be used to empty the index. So if you are fixing a bug, please justify the change and provide a testcase to guard against it in the future.
--
Thomas Rast
trast@{inf,student}.ethz.ch