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

[PATCH 4/4] packed refs: pass .git dir instead of packed-refs path to init_fn

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

The first argument of a ref_store_init_fn is documented to represent the $GIT_DIR, not the path to the packed-refs file. This brings the packed-refs store more in line with the usual ref store interface.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
That's the end of the series.  Thanks for reading.
 refs/files-backend.c  | 4 ++--
 refs/packed-backend.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index fccbc24ac4..3b8e13a8b7 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -57,8 +57,8 @@ static struct ref_store *files_ref_store_create(const char *gitdir,
 	refs->gitdir = xstrdup(gitdir);
 	get_common_dir_noenv(&sb, gitdir);
 	refs->gitcommondir = strbuf_detach(&sb, NULL);
-	strbuf_addf(&sb, "%s/packed-refs", refs->gitcommondir);
-	refs->packed_ref_store = packed_ref_store_create(sb.buf, flags);
+	refs->packed_ref_store =
+			packed_ref_store_create(refs->gitcommondir, flags);
 	strbuf_release(&sb);
 
 	return ref_store;
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 412c85034f..2c5db15279 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -78,7 +78,7 @@ struct packed_ref_store {
 	struct tempfile tempfile;
 };
 
-struct ref_store *packed_ref_store_create(const char *path,
+struct ref_store *packed_ref_store_create(const char *common_dir,
 					  unsigned int store_flags)
 {
 	struct packed_ref_store *refs = xcalloc(1, sizeof(*refs));
@@ -87,7 +87,7 @@ struct ref_store *packed_ref_store_create(const char *path,
 	base_ref_store_init(ref_store, &refs_be_packed);
 	refs->store_flags = store_flags;
 
-	refs->path = xstrdup(path);
+	refs->path = xstrfmt("%s/packed-refs", common_dir);
 	return ref_store;
 }
 
-- 
2.14.1.690.gbb1197296e
Previous: Jeff KingNext: Michael Haggerty
Message 9 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.