Re: [PATCH 5/5] path.c: don't call the match function without value in trie_find()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 24, 2019, 03:29 UTC
- Message-ID
- <xmqq5zkehld3.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20191023162048.GI4348@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
> I'm not sure what you mean by "consistency check". The resulting trie > looked as expected both before and after b9317d55a3, i.e. each trie > node had the right contents, value, and children, as far as I could > tell. The issue was in the lookup function.
I saw the change to the code as a band-aid, which wouldn't have been necessary if we had the missing refs/ entry. Fully populating the leading levels explicitly may give the application more flexibility by yielding results different from hardcoded -1 like the patched code gives.
But perhaps treating a path that matches a missing intermediate level just like a path that did not match anything in the trie is what we want anyway, so I guess the code change was the right thing (as opposed to a band-aid).
Thanks.