git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] unpack-trees: also allow get_progress() to work on a different index

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
May 14, 2020, 19:53 UTC
Message-ID
<pull.785.git.git.1589486002453.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>

commit b0a5a12a60 ("unpack-trees: allow check_updates() to work on a different index", 2020-03-27) allowed check_updates() to work on a different index, but it called get_progress() which was hardcoded to work on o->result much like check_updates() had been. Update it to also accept an index parameter and have check_updates() pass that parameter along so that both are working on the same index.

Noticed-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
    unpack-trees: also allow get_progress() to work on a different index
    
    This is a fix to a minor 2.27 regression, from the en/sparse-checkout
    series.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-785%2Fnewren%2Frecent-sparse-checkout-bugfix-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-785/newren/recent-sparse-checkout-bugfix-v1
Pull-Request: https://github.com/git/git/pull/785
 unpack-trees.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 1fe3764f2b2..2e6e9d5eeb8 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -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);
 

base-commit: b994622632154fc3b17fb40a38819ad954a5fb88
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 6 in “unpack-trees: also allow get_progress() to work on a different index”
  1. unpack-trees: also allow get_progress() to work on a different indexElijah Newren via GitGitGadget, May 14, 2020
  2. Junio C HamanoMay 14, 2020
  3. Elijah NewrenMay 14, 2020
  4. Junio C HamanoMay 14, 2020
  5. Elijah NewrenMay 14, 2020
  6. Junio C HamanoMay 15, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.