@matheusbsbs / matheus-bagliano / commits / 84563a624e
Fork 0

unpack-trees.c: cosmetic fix

Make the parts a bit more readable before touching them. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 22, 2010 at 09:09 UTC 84563a624e1e417c452491f3b9fba8879e989af0
1 file changed +8 -4
unpack-trees.c
+8 -4
@@ -390,7 +390,7 @@ static void add_same_unmerged(struct cache_entry *ce,
390 static int unpack_index_entry(struct cache_entry *ce,
391 struct unpack_trees_options *o)
392 {
393 - struct cache_entry *src[5] = { NULL };
393 + struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
394 int ret;
395
396 src[0] = ce;
@@ -436,7 +436,10 @@ static int switch_cache_bottom(struct traverse_info *info)
436 return ret;
437 }
438
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)
443 {
444 int i, ret, bottom;
445 struct tree_desc t[MAX_UNPACK_TREES];
@@ -908,7 +911,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
911
912 if (!o->skip_sparse_checkout) {
913 int empty_worktree = 1;
911 - for (i = 0;i < o->result.cache_nr;i++) {
914 + for (i = 0; i < o->result.cache_nr; i++) {
915 struct cache_entry *ce = o->result.cache[i];
916
917 if (apply_sparse_checkout(ce, o)) {
@@ -920,6 +923,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
923
924 }
925 if (o->result.cache_nr && empty_worktree) {
926 + /* dubious---why should this fail??? */
927 ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");
928 goto done;
929 }
@@ -931,7 +935,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
935 *o->dst_index = o->result;
936
937 done:
934 - for (i = 0;i < el.nr;i++)
938 + for (i = 0; i < el.nr; i++)
939 free(el.excludes[i]);
940 if (el.excludes)
941 free(el.excludes);