Reviews for the first patches of pclouds/narrow-checkout
flat view
From: Stefan Beller <hidden>
Date: 2016-06-16 02:19:33
Hi,
so I started looking into your narrow checkout branch and started reviewing
the patches. Thanks for working on the narrow checkout!
Reviewed-by: Stefan Beller <redacted> (just asking for signoff)
tree.c: break long lines
read-cache: realign some statements
read-cache: add sort_index()
read-cache: description for base_name_compare()
unpack-trees: break down long lines
Regarding:
base_name_compare: do not assume name[len] == '\0'
Could you clarify if this is an existing bug or a preparation for a future
different use?
read-cache: new sort compare function that pays attention to ce_mode
Would a new mode (0100 (directory)) require bumping the index version?
Or the other way round: What If I use these patches and then try to use
another version of Git without this feature?
read-cache: refactor check_ce_order()
Would it make sense to avoid the yoda condition?
(i.e. "cmp > 0" instead of "0 < cmp" -> die("unordered stage entries"))
Or rather: I found it confusing that cmp is on both sides of the < in two
different conditions, i.e. it looks like you prefer to keep the "<" sign
constant, whereas I would have written
if (cmp < 0)
continue;
if (cmp > 0)
die(...);
It's a style thing, so I guess either is fine.
I would however put the case for (cmp < 0) first as that is the expected case?
read-cache: check ce_mode in check_ce_order()
Can we replace
cmp = (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
by:
cmp = c1 - c2;
as it is only used in comparisons lesser/greater than 0 afterwards.
Again, I would put the "continue" case first (cmp >0)
read-cache: index_name_stage_pos() => index_name_mode_stage_pos()
"After this read-cache.c code is pretty much ready for accepting dir
entries in the index."
What is missing?
So that's a review for the first third of the patches. :)
I wonder how much is left for actually finishing the narrow checkout,
as I could not find documentation or code the user interacts with.
(i.e. I would like to use a narrow checkout. How do I start? Where do I put
the pathspec of things I would like to use? Or are you envisioning a git wrapper
for that? "git narrow [make-go-away, revive] <pathspec>" ?)
Thanks,
Stefan