Skip to content

Commit 84563a6

Browse files
committed
unpack-trees.c: cosmetic fix
Make the parts a bit more readable before touching them. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 853563d commit 84563a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

unpack-trees.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static void add_same_unmerged(struct cache_entry *ce,
390390
static int unpack_index_entry(struct cache_entry *ce,
391391
struct unpack_trees_options *o)
392392
{
393-
struct cache_entry *src[5] = { NULL };
393+
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
394394
int ret;
395395

396396
src[0] = ce;
@@ -436,7 +436,10 @@ static int switch_cache_bottom(struct traverse_info *info)
436436
return ret;
437437
}
438438

439-
static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
439+
static int traverse_trees_recursive(int n, unsigned long dirmask,
440+
unsigned long df_conflicts,
441+
struct name_entry *names,
442+
struct traverse_info *info)
440443
{
441444
int i, ret, bottom;
442445
struct tree_desc t[MAX_UNPACK_TREES];
@@ -908,7 +911,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
908911

909912
if (!o->skip_sparse_checkout) {
910913
int empty_worktree = 1;
911-
for (i = 0;i < o->result.cache_nr;i++) {
914+
for (i = 0; i < o->result.cache_nr; i++) {
912915
struct cache_entry *ce = o->result.cache[i];
913916

914917
if (apply_sparse_checkout(ce, o)) {
@@ -920,6 +923,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
920923

921924
}
922925
if (o->result.cache_nr && empty_worktree) {
926+
/* dubious---why should this fail??? */
923927
ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");
924928
goto done;
925929
}
@@ -931,7 +935,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
931935
*o->dst_index = o->result;
932936

933937
done:
934-
for (i = 0;i < el.nr;i++)
938+
for (i = 0; i < el.nr; i++)
935939
free(el.excludes[i]);
936940
if (el.excludes)
937941
free(el.excludes);

0 commit comments

Comments
 (0)