git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jake Goulding <goulding@vivisimo.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3] Make has_commit non-static
Date: Thu, 22 Jan 2009 17:13:55 -0800	[thread overview]
Message-ID: <7v7i4m6cz0.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <497913E4.6050806@vivisimo.com> (Jake Goulding's message of "Thu, 22 Jan 2009 19:48:36 -0500")

Jake Goulding <goulding@vivisimo.com> writes:

> Moving has_commit from branch to a common location in preparation for
> using it in tag.

has_commit() may have been a good enough name when it was a static in
builtin-branch.c but with much wider visibility, it is not specific
enough.

Perhaps you would want to rename it to something more descriptive.

Also it seems that your patch is garbled and won't apply.  A blank
context line lost the leading (and only) SP, and long lines are wrapped.

> Signed-off-by: Jake Goulding <goulding@vivisimo.com>
> ---
>  builtin-branch.c |   15 ---------------
>  commit.c         |   15 +++++++++++++++
>  commit.h         |    1 +
>  3 files changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/builtin-branch.c b/builtin-branch.c
> index 82d6fb2..bb42911 100644
> --- a/builtin-branch.c
> +++ b/builtin-branch.c
> @@ -193,21 +193,6 @@ struct ref_list {
>  	int kinds;
>  };
>
> -static int has_commit(struct commit *commit, struct commit_list
> *with_commit)
> -{
> -	if (!with_commit)
> -		return 1;
> -	while (with_commit) {
> -		struct commit *other;
> -
> -		other = with_commit->item;
> -		with_commit = with_commit->next;
> -		if (in_merge_bases(other, &commit, 1))
> -			return 1;
> -	}
> -	return 0;
> -}
> -
>  static int append_ref(const char *refname, const unsigned char *sha1,
> int flags, void *cb_data)
>  {
>  	struct ref_list *ref_list = (struct ref_list*)(cb_data);
> diff --git a/commit.c b/commit.c
> index c99db16..5ccb338 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -705,6 +705,21 @@ struct commit_list *get_merge_bases(struct commit
> *one, struct commit *two,
>  	return get_merge_bases_many(one, 1, &two, cleanup);
>  }
>
> +int has_commit(struct commit *commit, struct commit_list *with_commit)
> +{
> +	if (!with_commit)
> +		return 1;
> +	while (with_commit) {
> +		struct commit *other;
> +
> +		other = with_commit->item;
> +		with_commit = with_commit->next;
> +		if (in_merge_bases(other, &commit, 1))
> +			return 1;
> +	}
> +	return 0;
> +}
> +
>  int in_merge_bases(struct commit *commit, struct commit **reference,
> int num)
>  {
>  	struct commit_list *bases, *b;
> diff --git a/commit.h b/commit.h
> index 3a7b06a..1b8444f 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -133,6 +133,7 @@ extern int is_repository_shallow(void);
>  extern struct commit_list *get_shallow_commits(struct object_array *heads,
>  		int depth, int shallow_flag, int not_shallow_flag);
>
> +int has_commit(struct commit *, struct commit_list *);
>  int in_merge_bases(struct commit *, struct commit **, int);
>
>  extern int interactive_add(int argc, const char **argv, const char
> *prefix);
> -- 
> 1.6.0.4

  reply	other threads:[~2009-01-23  1:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1232671630-19683-1-git-send-email-goulding@vivisimo.com>
2009-01-23  0:48 ` [PATCH 2/3] Make has_commit non-static Jake Goulding
2009-01-23  1:13   ` Junio C Hamano [this message]
2009-01-23 22:41     ` Jake Goulding
     [not found] ` <1232671630-19683-2-git-send-email-goulding@vivisimo.com>
2009-01-23  0:48   ` [PATCH 3/3] Add --contains flag to git tag Jake Goulding
2009-01-23  1:18     ` Junio C Hamano
2009-01-26 14:13 [PATCH 1/3] Make opt_parse_with_commit non-static Jake Goulding
2009-01-26 14:13 ` [PATCH 2/3] Make has_commit non-static Jake Goulding
2009-01-26 15:38   ` Johannes Schindelin
2009-01-26 19:20     ` Jake Goulding
2009-01-26 20:06     ` Junio C Hamano
2009-01-26 20:38       ` Johannes Schindelin
2009-01-28 20:36     ` Junio C Hamano
2009-02-03 15:08       ` Jake Goulding

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=7v7i4m6cz0.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=goulding@vivisimo.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).