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

[PATCH v8 04/10] pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Nov 10, 2015, 11:42 UTC
Message-ID
<e9063e3bf2383cc9cb9b0d8270cd9255e58450b4.1447154711.git.mhagger@alum.mit.edu>
In-Reply-To
<cover.1447154711.git.mhagger@alum.mit.edu>

is_per_worktree_ref() will soon be made private, so use the public interface, ref_type(), in its place. And now that we're using ref_type(), we can make it clear that we won't pack pseudorefs. This was the case before, but due to the not-so-obvious reason that this function is applied to references via the loose reference cache, which only includes references that live inside "refs/".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 refs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/refs.c b/refs.c
index 480de9a..82129f0 100644
--- a/refs.c
+++ b/refs.c
@@ -2671,8 +2671,6 @@ struct pack_refs_cb_data {
 	struct ref_to_prune *ref_to_prune;
 };
 
-static int is_per_worktree_ref(const char *refname);
-
 /*
  * An each_ref_entry_fn that is run over loose references only.  If
  * the loose reference can be packed, add an entry in the packed ref
@@ -2687,7 +2685,7 @@ static int pack_if_possible_fn(struct ref_entry *entry, void *cb_data)
 	int is_tag_ref = starts_with(entry->name, "refs/tags/");
 
 	/* Do not pack per-worktree refs: */
-	if (is_per_worktree_ref(entry->name))
+	if (ref_type(entry->name) != REF_TYPE_NORMAL)
 		return 0;
 
 	/* ALWAYS pack tags */
-- 
2.6.2
Previous: Michael HaggertyNext: Michael Haggerty
Message 5 of 13 in “refs backend pre-vtable”
  1. 00/10 refs backend pre-vtableMichael Haggerty, Nov 10, 2015
  2. 01/10 verify_refname_available(): rename functionMichael Haggerty, Nov 10, 2015
  3. 02/10 verify_refname_available(): new functionMichael Haggerty, Nov 10, 2015
  4. 03/10 copy_msg(): rename to copy_reflog_msg()Michael Haggerty, Nov 10, 2015
  5. 04/10 pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()Michael Haggerty, Nov 10, 2015
  6. 05/10 refname_is_safe(): improve docstringMichael Haggerty, Nov 10, 2015
  7. 06/10 refs/refs-internal.h: new header fileMichael Haggerty, Nov 10, 2015
  8. 08/10 initdb: make safe_create_dir publicMichael Haggerty, Nov 10, 2015
  9. 09/10 files_log_ref_write: new functionMichael Haggerty, Nov 10, 2015
  10. 10/10 refs: break out ref conflict checksMichael Haggerty, Nov 10, 2015
  11. David TurnerNov 16, 2015
  12. Jeff KingNov 19, 2015
  13. Michael HaggertyNov 20, 2015

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.