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

[PATCH 4/4] write_remote_refs(): create packed (rather than extra) refs

From
mhagger@alum.mit.edu <mhagger@alum.mit.edu>
Date
Jan 17, 2012, 05:50 UTC
Message-ID
<1326779434-20106-5-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1326779434-20106-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>

write_remote_refs() creates new packed refs from references obtained from the remote repository, which is "out of thin air" as far as the local repository is concerned. Previously it did this by creating "extra" refs, then calling pack_refs() to bake them into the packed-refs file. Instead, create packed refs (in the packed reference cache) directly, then call pack_refs().

Aside from being more logical, this is another step towards removing extra refs entirely.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 builtin/clone.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 86db954..9413537 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -441,11 +441,10 @@ static void write_remote_refs(const struct ref *local_refs)
 	for (r = local_refs; r; r = r->next) {
 		if (!r->peer_ref)
 			continue;
-		add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
+		add_packed_ref(r->peer_ref->name, r->old_sha1);
 	}
 
 	pack_refs(PACK_REFS_ALL);
-	clear_extra_refs();
 }
 
 static int write_one_config(const char *key, const char *value, void *data)
-- 
1.7.8.3
Previous: mhagger@alum.mit.eduNext: Jeff King
Message 5 of 7 in “Remove a user of extra_refs in clone”
  1. 0/4 Remove a user of extra_refs in clonemhagger@alum.mit.edu, Jan 17, 2012
  2. 1/4 pack_refs(): remove redundant checkmhagger@alum.mit.edu, Jan 17, 2012
  3. 2/4 ref_array: keep track of whether references are sortedmhagger@alum.mit.edu, Jan 17, 2012
  4. 3/4 add_packed_ref(): new function in the refs API.mhagger@alum.mit.edu, Jan 17, 2012
  5. 4/4 write_remote_refs(): create packed (rather than extra) refsmhagger@alum.mit.edu, Jan 17, 2012
  6. Jeff KingJan 17, 2012
  7. Junio C HamanoJan 17, 2012

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.