]> git.ipfire.org Git - thirdparty/git.git/blobdiff - unpack-trees.c
The sixth batch
[thirdparty/git.git] / unpack-trees.c
index 1fe3764f2b217263d00332bcca203f0c9ef6ee5f..4be5fc3075410f4004b9d5fc1902eb84880dded5 100644 (file)
@@ -333,10 +333,10 @@ static void load_gitmodules_file(struct index_state *index,
        }
 }
 
-static struct progress *get_progress(struct unpack_trees_options *o)
+static struct progress *get_progress(struct unpack_trees_options *o,
+                                    struct index_state *index)
 {
        unsigned cnt = 0, total = 0;
-       struct index_state *index = &o->result;
 
        if (!o->update || !o->verbose_update)
                return NULL;
@@ -415,7 +415,7 @@ static int check_updates(struct unpack_trees_options *o,
        if (o->clone)
                setup_collided_checkout_detection(&state, index);
 
-       progress = get_progress(o);
+       progress = get_progress(o, index);
 
        git_attr_set_direction(GIT_ATTR_CHECKOUT);
 
@@ -562,11 +562,11 @@ static int warn_conflicted_path(struct index_state *istate,
 
        add_rejected_path(o, WARNING_SPARSE_UNMERGED_FILE, conflicting_path);
 
-       /* Find out how many higher stage entries at same path */
-       while (++count < istate->cache_nr &&
-              !strcmp(conflicting_path,
-                      istate->cache[i+count]->name))
-               /* do nothing */;
+       /* Find out how many higher stage entries are at same path */
+       while ((++count) + i < istate->cache_nr &&
+              !strcmp(conflicting_path, istate->cache[count + i]->name))
+               ; /* do nothing */
+
        return count;
 }