Re: [PATCH 08/13] prevent try_delta from using objects not in pack
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:03
"Dana How" [off-list ref] writes:
quoted hunk
Subject: [PATCH 08/13] prevent try_delta from using objects not in pack --- builtin-pack-objects.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 9eb5fd6..37b0150 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c@@ -1251,6 +1251,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, if (trg_entry->type != src_entry->type) return -1; + /* Don't try deltas involving already/non written objects */ + if (trg_entry->no_write || src_entry->no_write) + return -1; + /* We do not compute delta to *create* objects we are not * going to pack. */
I think trg_entry->no_write case should return -1 (meaning: doesn't delta with this source, nor any other sources you would throw at try_delta()), but shouldn't src_entry->no_write case return 0 (meaning: does not delta with this source, but do not give up -- other source candidate you have might be usable)?