From: Ronnie Sahlberg <sahlberg@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Ronnie Sahlberg <sahlberg@google.com>
Subject: [PATCH] refs.c: add a public is_branch function
Date: Tue, 15 Jul 2014 16:02:38 -0700 [thread overview]
Message-ID: <1405465358-27054-2-git-send-email-sahlberg@google.com> (raw)
In-Reply-To: <1405465358-27054-1-git-send-email-sahlberg@google.com>
Both refs.c and fsck.c have their own private copies of the is_branch function.
Delete the is_branch function from fsck.c and make the version in refs.c
public.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
---
builtin/fsck.c | 5 -----
refs.c | 2 +-
refs.h | 2 ++
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/builtin/fsck.c b/builtin/fsck.c
index fc150c8..a473622 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -482,11 +482,6 @@ static int fsck_handle_reflog(const char *logname, const unsigned char *sha1, in
return 0;
}
-static int is_branch(const char *refname)
-{
- return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
-}
-
static int fsck_handle_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
{
struct object *obj;
diff --git a/refs.c b/refs.c
index dc45774..dc44802 100644
--- a/refs.c
+++ b/refs.c
@@ -2817,7 +2817,7 @@ static int log_ref_write(const char *refname, const unsigned char *old_sha1,
return 0;
}
-static int is_branch(const char *refname)
+int is_branch(const char *refname)
{
return !strcmp(refname, "HEAD") || starts_with(refname, "refs/heads/");
}
diff --git a/refs.h b/refs.h
index 4e3050d..8b4a3f2 100644
--- a/refs.h
+++ b/refs.h
@@ -125,6 +125,8 @@ extern int repack_without_refs(const char **refnames, int n);
extern int ref_exists(const char *);
+extern int is_branch(const char *refname);
+
/*
* If refname is a non-symbolic reference that refers to a tag object,
* and the tag can be (recursively) dereferenced to a non-tag object,
--
2.0.1.442.g7fe6834.dirty
next prev parent reply other threads:[~2014-07-15 23:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 23:02 [PATCH] remove duplicate of is_branch Ronnie Sahlberg
2014-07-15 23:02 ` Ronnie Sahlberg [this message]
2014-07-15 23:20 ` [PATCH] refs.c: add a public is_branch function Jonathan Nieder
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405465358-27054-2-git-send-email-sahlberg@google.com \
--to=sahlberg@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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 NNTP newsgroup(s).