git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: "David Turner" <dturner@twopensource.com>,
	"Ramsay Jones" <ramsay@ramsayjones.plus.com>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 23/38] refs: make peel_ref() virtual
Date: Tue, 07 Jun 2016 10:36:42 -0700	[thread overview]
Message-ID: <xmqqtwh4rjdh.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <316f0fed796fd2ed17ea5df4c264a98028d6b98a.1464983301.git.mhagger@alum.mit.edu> (Michael Haggerty's message of "Fri, 3 Jun 2016 23:03:58 +0200")

Michael Haggerty <mhagger@alum.mit.edu> writes:

> For now it only supports the main reference store.

Isn't this comment applicable to a handful of recent changes that
made other things virtual, too?  Just wondering if I am missing
something very special with the peel_ref() thing to single it out.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
>  refs.c               | 7 +++++++
>  refs/files-backend.c | 6 ++++--
>  refs/refs-internal.h | 3 +++
>  3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 22837f4..2d84c5c 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1425,6 +1425,13 @@ int pack_refs(unsigned int flags)
>  	return refs->be->pack_refs(refs, flags);
>  }
>  
> +int peel_ref(const char *refname, unsigned char *sha1)
> +{
> +	struct ref_store *refs = get_ref_store(NULL);
> +
> +	return refs->be->peel_ref(refs, refname, sha1);
> +}
> +
>  int create_symref(const char *ref_target, const char *refs_heads_master,
>  		  const char *logmsg)
>  {
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index f82a1be..91dcfcb 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -1763,9 +1763,10 @@ static enum peel_status peel_entry(struct ref_entry *entry, int repeel)
>  	return status;
>  }
>  
> -int peel_ref(const char *refname, unsigned char *sha1)
> +static int files_peel_ref(struct ref_store *ref_store,
> +			  const char *refname, unsigned char *sha1)
>  {
> -	struct files_ref_store *refs = get_files_ref_store(NULL, "peel_ref");
> +	struct files_ref_store *refs = files_downcast(ref_store, 0, "peel_ref");
>  	int flag;
>  	unsigned char base[20];
>  
> @@ -4031,6 +4032,7 @@ struct ref_storage_be refs_be_files = {
>  	files_transaction_commit,
>  
>  	files_pack_refs,
> +	files_peel_ref,
>  	files_create_symref,
>  
>  	files_read_raw_ref,
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index c342e57..ae67b49 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -496,6 +496,8 @@ typedef int ref_transaction_commit_fn(struct ref_store *refs,
>  				      struct strbuf *err);
>  
>  typedef int pack_refs_fn(struct ref_store *ref_store, unsigned int flags);
> +typedef int peel_ref_fn(struct ref_store *ref_store,
> +			const char *refname, unsigned char *sha1);
>  typedef int create_symref_fn(struct ref_store *ref_store,
>  			     const char *ref_target,
>  			     const char *refs_heads_master,
> @@ -556,6 +558,7 @@ struct ref_storage_be {
>  	ref_transaction_commit_fn *transaction_commit;
>  
>  	pack_refs_fn *pack_refs;
> +	peel_ref_fn *peel_ref;
>  	create_symref_fn *create_symref;
>  
>  	read_raw_ref_fn *read_raw_ref;

  reply	other threads:[~2016-06-07 17:36 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 21:03 [PATCH 00/38] Virtualization of the refs API Michael Haggerty
2016-06-03 21:03 ` [PATCH 01/38] resolve_gitlink_ref(): eliminate temporary variable Michael Haggerty
2016-06-03 21:03 ` [PATCH 02/38] rename_ref_available(): add docstring Michael Haggerty
2016-06-07 18:10   ` Junio C Hamano
2016-06-09 13:09     ` Michael Haggerty
2016-06-09 15:08       ` Junio C Hamano
2016-06-03 21:03 ` [PATCH 03/38] refs: rename struct ref_cache to files_ref_store Michael Haggerty
2016-06-03 21:03 ` [PATCH 04/38] refs: add a backend method structure Michael Haggerty
2016-06-03 21:03 ` [PATCH 05/38] refs: create a base class "ref_store" for files_ref_store Michael Haggerty
2016-06-07 16:31   ` Junio C Hamano
2016-06-09 21:54     ` René Scharfe
2016-06-07 17:03   ` Junio C Hamano
2016-06-09 14:10     ` Michael Haggerty
2016-06-09 16:14       ` Junio C Hamano
2016-06-10  6:18         ` Michael Haggerty
2016-06-10 15:53           ` Junio C Hamano
2016-06-10  8:08   ` Eric Sunshine
2016-06-10 12:02     ` Michael Haggerty
2016-06-03 21:03 ` [PATCH 06/38] add_packed_ref(): add a files_ref_store argument Michael Haggerty
2016-06-03 21:03 ` [PATCH 07/38] get_packed_ref(): " Michael Haggerty
2016-06-03 21:03 ` [PATCH 08/38] resolve_missing_loose_ref(): " Michael Haggerty
2016-06-03 21:03 ` [PATCH 09/38] {lock,commit,rollback}_packed_refs(): add files_ref_store arguments Michael Haggerty
2016-06-03 21:03 ` [PATCH 10/38] refs: add a transaction_commit() method Michael Haggerty
2016-06-03 21:03 ` [PATCH 11/38] refs: reorder definitions Michael Haggerty
2016-06-03 21:03 ` [PATCH 12/38] resolve_packed_ref(): rename function from resolve_missing_loose_ref() Michael Haggerty
2016-06-03 21:03 ` [PATCH 13/38] resolve_gitlink_packed_ref(): remove function Michael Haggerty
2016-06-03 21:03 ` [PATCH 14/38] read_raw_ref(): take a (struct ref_store *) argument Michael Haggerty
2016-06-03 21:03 ` [PATCH 15/38] resolve_ref_recursively(): new function Michael Haggerty
2016-06-03 21:03 ` [PATCH 16/38] resolve_gitlink_ref(): implement using resolve_ref_recursively() Michael Haggerty
2016-06-07 17:19   ` Junio C Hamano
2016-06-14  5:03   ` Eric Sunshine
2016-06-16  4:03     ` Michael Haggerty
2016-06-03 21:03 ` [PATCH 17/38] resolve_gitlink_ref(): avoid memory allocation in many cases Michael Haggerty
2016-06-07 17:29   ` Junio C Hamano
2016-06-09 14:37     ` Michael Haggerty
2016-06-03 21:03 ` [PATCH 18/38] resolve_gitlink_ref(): rename path parameter to submodule Michael Haggerty
2016-06-03 21:03 ` [PATCH 19/38] refs: make read_raw_ref() virtual Michael Haggerty
2016-06-03 21:03 ` [PATCH 20/38] refs: make verify_refname_available() virtual Michael Haggerty
2016-06-03 21:03 ` [PATCH 21/38] refs: make pack_refs() virtual Michael Haggerty
2016-06-07 17:35   ` Junio C Hamano
2016-06-09 14:46     ` Michael Haggerty
2016-06-03 21:03 ` [PATCH 22/38] refs: make create_symref() virtual Michael Haggerty
2016-06-03 21:03 ` [PATCH 23/38] refs: make peel_ref() virtual Michael Haggerty
2016-06-07 17:36   ` Junio C Hamano [this message]
2016-06-09 15:05     ` Michael Haggerty
2016-06-03 21:03 ` [PATCH 24/38] repack_without_refs(): add a files_ref_store argument Michael Haggerty
2016-06-03 21:04 ` [PATCH 25/38] lock_raw_ref(): " Michael Haggerty
2016-06-03 21:04 ` [PATCH 26/38] commit_ref_update(): " Michael Haggerty
2016-06-03 21:04 ` [PATCH 27/38] lock_ref_for_update(): " Michael Haggerty
2016-06-03 21:04 ` [PATCH 28/38] lock_ref_sha1_basic(): " Michael Haggerty
2016-06-03 21:04 ` [PATCH 29/38] split_symref_update(): " Michael Haggerty
2016-06-03 21:04 ` [PATCH 30/38] files_ref_iterator_begin(): take a ref_store argument Michael Haggerty
2016-06-03 21:04 ` [PATCH 31/38] refs: add method iterator_begin Michael Haggerty
2016-06-03 21:04 ` [PATCH 32/38] refs: add methods for reflog Michael Haggerty
2016-06-03 21:04 ` [PATCH 33/38] refs: add method for initial ref transaction commit Michael Haggerty
2016-06-03 21:04 ` [PATCH 34/38] refs: add method for delete_refs Michael Haggerty
2016-06-07 17:43   ` Junio C Hamano
2016-06-09 15:14     ` Michael Haggerty
2016-06-03 21:04 ` [PATCH 35/38] refs: add methods to init refs db Michael Haggerty
2016-06-03 21:04 ` [PATCH 36/38] refs: add method to rename refs Michael Haggerty
2016-06-03 21:04 ` [PATCH 37/38] refs: make lock generic Michael Haggerty
2016-06-07 17:50   ` Junio C Hamano
2016-06-09 15:21     ` Michael Haggerty
2016-06-09 15:53     ` Michael Haggerty
2016-06-03 21:04 ` [PATCH 38/38] refs: implement iteration over only per-worktree refs Michael Haggerty
2016-07-10 15:09 ` [PATCH 00/38] Virtualization of the refs API Duy Nguyen
2016-07-13 15:26   ` Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqtwh4rjdh.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).