* [PATCH] remove duplicate of is_branch @ 2014-07-15 23:02 Ronnie Sahlberg 2014-07-15 23:02 ` [PATCH] refs.c: add a public is_branch function Ronnie Sahlberg 0 siblings, 1 reply; 3+ messages in thread From: Ronnie Sahlberg @ 2014-07-15 23:02 UTC (permalink / raw) To: git; +Cc: gitster, Ronnie Sahlberg Jun, List Please find a trivial patch that makes refs.c:is_branch public. This allows us to delete the identical copy of is_branch in fsck.c Ronnie Sahlberg (1): refs.c: add a public is_branch function builtin/fsck.c | 5 ----- refs.c | 2 +- refs.h | 2 ++ 3 files changed, 3 insertions(+), 6 deletions(-) -- 2.0.1.442.g7fe6834.dirty ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] refs.c: add a public is_branch function 2014-07-15 23:02 [PATCH] remove duplicate of is_branch Ronnie Sahlberg @ 2014-07-15 23:02 ` Ronnie Sahlberg 2014-07-15 23:20 ` Jonathan Nieder 0 siblings, 1 reply; 3+ messages in thread From: Ronnie Sahlberg @ 2014-07-15 23:02 UTC (permalink / raw) To: git; +Cc: gitster, Ronnie Sahlberg 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 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] refs.c: add a public is_branch function 2014-07-15 23:02 ` [PATCH] refs.c: add a public is_branch function Ronnie Sahlberg @ 2014-07-15 23:20 ` Jonathan Nieder 0 siblings, 0 replies; 3+ messages in thread From: Jonathan Nieder @ 2014-07-15 23:20 UTC (permalink / raw) To: Ronnie Sahlberg; +Cc: git, gitster Ronnie Sahlberg wrote: > 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(-) Makes sense -- thanks. (This is an old one: v1.5.4-rc4~27 (2008-01-15), v1.5.4-rc4~30 (2008-01-15). Most of the running time of fsck is per-object, not per-ref, so maintainability here seems worth the performance cost.) Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-15 23:21 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-15 23:02 [PATCH] remove duplicate of is_branch Ronnie Sahlberg 2014-07-15 23:02 ` [PATCH] refs.c: add a public is_branch function Ronnie Sahlberg 2014-07-15 23:20 ` Jonathan Nieder
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).