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

[PATCH 3/4] replace-objects: evaluate replacement refs without using the object store

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Sep 12, 2017, 17:31 UTC
Message-ID
<20170912173140.GD144745@aiede.mtv.corp.google.com>
In-Reply-To
<20170912172330.GA144745@aiede.mtv.corp.google.com>
From: Stefan Beller <sbeller@google.com>

Pass DO_FOR_EACH_INCLUDE_BROKEN when iterating over replacement refs so that the iteration does not require opening the named objects from the object store. This avoids a dependency cycle between object access and replace ref iteration.

Moreover the ref subsystem has not been migrated yet to access the object store via passed in repository objects. As a result, without this patch, iterating over replace refs in a repository other than the_repository it produces errors:

   error: refs/replace/3afabef75c627b894cccc3bcae86837abc7c32fe does not point to a valid object!

Noticed while adapting the object store (and in particular its evaluation of replace refs) to handle arbitrary repositories.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/refs.c b/refs.c
index b0106b8162..cd84ed9710 100644
--- a/refs.c
+++ b/refs.c
@@ -1394,7 +1394,7 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)
 	return do_for_each_ref(get_main_ref_store(),
 			       git_replace_ref_base, fn,
 			       strlen(git_replace_ref_base),
-			       0, cb_data);
+			       DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
 }
 
 int for_each_namespaced_ref(each_ref_fn fn, void *cb_data)
-- 
2.14.1.690.gbb1197296e
Previous: Brandon WilliamsNext: Michael Haggerty
Message 6 of 12 in “Fixes from the per-repository object store series”
  1. 0/4 Fixes from the per-repository object store seriesJonathan Nieder, Sep 12, 2017
  2. 1/4 pack: make packed_git_mru global a value instead of a pointerJonathan Nieder, Sep 12, 2017
  3. 2/4 push, fetch: error out for submodule entries not pointing to commitsJonathan Nieder, Sep 12, 2017
  4. Heiko VoigtSep 14, 2017
  5. Brandon WilliamsSep 18, 2017
  6. 3/4 replace-objects: evaluate replacement refs without using the object storeJonathan Nieder, Sep 12, 2017
  7. Michael HaggertySep 13, 2017
  8. Jeff KingSep 13, 2017
  9. 4/4 packed refs: pass .git dir instead of packed-refs path to init_fnJonathan Nieder, Sep 12, 2017
  10. Michael HaggertySep 13, 2017
  11. Richard MawSep 13, 2017
  12. Junio C HamanoSep 15, 2017

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.