git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Turner <dturner@twopensource.com>
To: git@vger.kernel.org, mhagger@alum.mit.edu
Cc: Ronnie Sahlberg <sahlberg@google.com>,
	David Turner <dturner@twopensource.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v4 11/26] refs.c: move read_ref, read_ref_full and ref_exists to the common code
Date: Thu, 15 Oct 2015 15:46:35 -0400	[thread overview]
Message-ID: <1444938410-2345-12-git-send-email-dturner@twopensource.com> (raw)
In-Reply-To: <1444938410-2345-1-git-send-email-dturner@twopensource.com>

From: Ronnie Sahlberg <sahlberg@google.com>

These functions do not depend on the backend implementation so we
move them to the common code.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 refs-be-files.c | 18 ------------------
 refs.c          | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/refs-be-files.c b/refs-be-files.c
index 9c53f54..728751a 100644
--- a/refs-be-files.c
+++ b/refs-be-files.c
@@ -1791,24 +1791,6 @@ struct ref_filter {
 	void *cb_data;
 };
 
-int read_ref_full(const char *refname, int resolve_flags, unsigned char *sha1, int *flags)
-{
-	if (resolve_ref_unsafe(refname, resolve_flags, sha1, flags))
-		return 0;
-	return -1;
-}
-
-int read_ref(const char *refname, unsigned char *sha1)
-{
-	return read_ref_full(refname, RESOLVE_REF_READING, sha1, NULL);
-}
-
-int ref_exists(const char *refname)
-{
-	unsigned char sha1[20];
-	return !!resolve_ref_unsafe(refname, RESOLVE_REF_READING, sha1, NULL);
-}
-
 static int filter_refs(const char *refname, const struct object_id *oid,
 			   int flags, void *data)
 {
diff --git a/refs.c b/refs.c
index fab7603..8a619a6 100644
--- a/refs.c
+++ b/refs.c
@@ -598,3 +598,21 @@ void warn_dangling_symrefs(FILE *fp, const char *msg_fmt, const struct string_li
 	data.msg_fmt = msg_fmt;
 	for_each_rawref(warn_if_dangling_symref, &data);
 }
+
+int read_ref_full(const char *refname, int resolve_flags, unsigned char *sha1, int *flags)
+{
+	if (resolve_ref_unsafe(refname, resolve_flags, sha1, flags))
+		return 0;
+	return -1;
+}
+
+int read_ref(const char *refname, unsigned char *sha1)
+{
+	return read_ref_full(refname, RESOLVE_REF_READING, sha1, NULL);
+}
+
+int ref_exists(const char *refname)
+{
+	unsigned char sha1[20];
+	return !!resolve_ref_unsafe(refname, RESOLVE_REF_READING, sha1, NULL);
+}
-- 
2.4.2.644.g97b850b-twtrsrc

  parent reply	other threads:[~2015-10-15 19:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 19:46 [PATCH v4 00/26] refs backend pre-vtable patches David Turner
2015-10-15 19:46 ` [PATCH v4 01/26] refs.c: create a public version of verify_refname_available David Turner
2015-10-15 19:46 ` [PATCH v4 02/26] refs: make repack_without_refs and is_branch public David Turner
2015-10-16  6:34   ` Michael Haggerty
2015-10-19 23:16     ` David Turner
2015-10-15 19:46 ` [PATCH v4 03/26] refs-be-files.c: rename refs to refs-be-files David Turner
2015-10-16  6:36   ` Michael Haggerty
2015-10-15 19:46 ` [PATCH v4 04/26] refs.c: add a new refs.c file to hold all common refs code David Turner
2015-10-15 19:46 ` [PATCH v4 05/26] refs.c: move update_ref to refs.c David Turner
2015-10-21 19:03   ` David Turner
2015-10-15 19:46 ` [PATCH v4 06/26] refs.c: move delete_pseudoref and delete_ref to the common code David Turner
2015-10-21 19:04   ` David Turner
2015-10-15 19:46 ` [PATCH v4 07/26] refs.c: move read_ref_at to the common refs file David Turner
2015-10-15 19:46 ` [PATCH v4 08/26] refs.c: move the hidden refs functions to the common code David Turner
2015-10-15 19:46 ` [PATCH v4 09/26] refs.c: move dwim and friend functions to the common refs code David Turner
2015-10-15 19:46 ` [PATCH v4 10/26] refs.c: move warn_if_dangling_symref* to the common code David Turner
2015-10-15 19:46 ` David Turner [this message]
2015-10-15 19:46 ` [PATCH v4 12/26] refs.c: move resolve_refdup to common David Turner
2015-10-15 19:46 ` [PATCH v4 13/26] refs.c: move check_refname_format to the common code David Turner
2015-10-15 19:46 ` [PATCH v4 14/26] refs.c: move is_branch " David Turner
2015-10-15 19:46 ` [PATCH v4 15/26] refs.c: move prettify_refname " David Turner
2015-10-15 19:46 ` [PATCH v4 16/26] refs.c: move ref iterators " David Turner
2015-10-15 19:46 ` [PATCH v4 17/26] refs.c: move head_ref_namespaced " David Turner
2015-10-15 19:46 ` [PATCH v4 18/26] refs: move transaction functions into " David Turner
2015-10-15 19:46 ` [PATCH v4 19/26] refs.c: move refname_is_safe to the " David Turner
2015-10-15 19:46 ` [PATCH v4 20/26] refs.c: move copy_msg " David Turner
2015-10-15 19:46 ` [PATCH v4 21/26] refs.c: move peel_object " David Turner
2015-10-15 19:46 ` [PATCH v4 22/26] refs.c: move should_autocreate_reflog to " David Turner
2015-10-15 19:46 ` [PATCH v4 23/26] initdb: move safe_create_dir into " David Turner
2015-10-21 19:38   ` Junio C Hamano
2015-10-21 19:47     ` David Turner
2015-10-15 19:46 ` [PATCH v4 24/26] refs: make files_log_ref_write functions public David Turner
2015-10-15 19:46 ` [PATCH v4 25/26] refs: break out ref conflict checks David Turner
2015-10-15 19:46 ` [PATCH v4 26/26] introduce "extensions" form of core.repositoryformatversion David Turner
2015-10-21 19:40   ` Junio C Hamano

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=1444938410-2345-12-git-send-email-dturner@twopensource.com \
    --to=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=sahlberg@google.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).