* [PATCH 2/3] Make has_commit non-static
[not found] <1232671630-19683-1-git-send-email-goulding@vivisimo.com>
@ 2009-01-23 0:48 ` Jake Goulding
2009-01-23 1:13 ` Junio C Hamano
0 siblings, 1 reply; 12+ messages in thread
From: Jake Goulding @ 2009-01-23 0:48 UTC (permalink / raw)
To: git
Moving has_commit from branch to a common location in preparation for
using it in tag.
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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-23 0:48 ` Jake Goulding
@ 2009-01-23 1:13 ` Junio C Hamano
2009-01-23 22:41 ` Jake Goulding
0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2009-01-23 1:13 UTC (permalink / raw)
To: Jake Goulding; +Cc: git
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-23 1:13 ` Junio C Hamano
@ 2009-01-23 22:41 ` Jake Goulding
0 siblings, 0 replies; 12+ messages in thread
From: Jake Goulding @ 2009-01-23 22:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
> 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.
Sure - any suggestions?
The best I could come up with was "commit_has_any_in_commit_list"
> 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.
Yes - adventures in sending patches. Hopefully I'll have it fixed by the
next round of patches. :-)
>
>> 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] Make opt_parse_with_commit non-static
@ 2009-01-26 14:13 Jake Goulding
2009-01-26 14:13 ` [PATCH 2/3] Make has_commit non-static Jake Goulding
0 siblings, 1 reply; 12+ messages in thread
From: Jake Goulding @ 2009-01-26 14:13 UTC (permalink / raw)
To: git; +Cc: gitster, Jake Goulding
Moving opt_parse_with_commit from branch to a common location in
preparation for using it in tag. Renamed it to correspond to naming
convention of other option parsing functions.
Signed-off-by: Jake Goulding <goulding@vivisimo.com>
---
builtin-branch.c | 20 ++------------------
parse-options.c | 17 +++++++++++++++++
parse-options.h | 1 +
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 02fa38f..82d6fb2 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -466,22 +466,6 @@ static void rename_branch(const char *oldname, const char *newname, int force)
strbuf_release(&newsection);
}
-static int opt_parse_with_commit(const struct option *opt, const char *arg, int unset)
-{
- unsigned char sha1[20];
- struct commit *commit;
-
- if (!arg)
- return -1;
- if (get_sha1(arg, sha1))
- die("malformed object name %s", arg);
- commit = lookup_commit_reference(sha1);
- if (!commit)
- die("no such commit %s", arg);
- commit_list_insert(commit, opt->value);
- return 0;
-}
-
static int opt_parse_merge_filter(const struct option *opt, const char *arg, int unset)
{
merge_filter = ((opt->long_name[0] == 'n')
@@ -517,13 +501,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPTION_CALLBACK, 0, "contains", &with_commit, "commit",
"print only branches that contain the commit",
PARSE_OPT_LASTARG_DEFAULT,
- opt_parse_with_commit, (intptr_t)"HEAD",
+ parse_opt_with_commit, (intptr_t)"HEAD",
},
{
OPTION_CALLBACK, 0, "with", &with_commit, "commit",
"print only branches that contain the commit",
PARSE_OPT_HIDDEN | PARSE_OPT_LASTARG_DEFAULT,
- opt_parse_with_commit, (intptr_t) "HEAD",
+ parse_opt_with_commit, (intptr_t) "HEAD",
},
OPT__ABBREV(&abbrev),
diff --git a/parse-options.c b/parse-options.c
index 9eb55cc..4c5d09d 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -1,6 +1,7 @@
#include "git-compat-util.h"
#include "parse-options.h"
#include "cache.h"
+#include "commit.h"
#define OPT_SHORT 1
#define OPT_UNSET 2
@@ -506,6 +507,22 @@ int parse_opt_verbosity_cb(const struct option *opt, const char *arg,
return 0;
}
+int parse_opt_with_commit(const struct option *opt, const char *arg, int unset)
+{
+ unsigned char sha1[20];
+ struct commit *commit;
+
+ if (!arg)
+ return -1;
+ if (get_sha1(arg, sha1))
+ return error("malformed object name %s", arg);
+ commit = lookup_commit_reference(sha1);
+ if (!commit)
+ return error("no such commit %s", arg);
+ commit_list_insert(commit, opt->value);
+ return 0;
+}
+
/*
* This should really be OPTION_FILENAME type as a part of
* parse_options that take prefix to do this while parsing.
diff --git a/parse-options.h b/parse-options.h
index 034162e..9122905 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -151,6 +151,7 @@ extern int parse_options_end(struct parse_opt_ctx_t *ctx);
extern int parse_opt_abbrev_cb(const struct option *, const char *, int);
extern int parse_opt_approxidate_cb(const struct option *, const char *, int);
extern int parse_opt_verbosity_cb(const struct option *, const char *, int);
+extern int parse_opt_with_commit(const struct option *, const char *, int);
#define OPT__VERBOSE(var) OPT_BOOLEAN('v', "verbose", (var), "be verbose")
#define OPT__QUIET(var) OPT_BOOLEAN('q', "quiet", (var), "be quiet")
--
1.6.0.6
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] Make has_commit non-static
2009-01-26 14:13 [PATCH 1/3] Make opt_parse_with_commit non-static Jake Goulding
@ 2009-01-26 14:13 ` Jake Goulding
2009-01-26 14:13 ` [PATCH 3/3] Add --contains flag to git tag Jake Goulding
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static Johannes Schindelin
0 siblings, 2 replies; 12+ messages in thread
From: Jake Goulding @ 2009-01-26 14:13 UTC (permalink / raw)
To: git; +Cc: gitster, Jake Goulding
Moving has_commit from branch to a common location in preparation for
using it in tag. Renaming it to commit_has_any_in_commit_list to be
more unique.
Signed-off-by: Jake Goulding <goulding@vivisimo.com>
---
Function renamed to less-generic name as suggested by Junio.
builtin-branch.c | 20 +++-----------------
commit.c | 16 ++++++++++++++++
commit.h | 1 +
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 82d6fb2..a30ef76 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);
@@ -231,7 +216,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
return error("branch '%s' does not point at a commit", refname);
/* Filter with with_commit if specified */
- if (!has_commit(commit, ref_list->with_commit))
+ if (!commit_has_any_in_commit_list(commit, ref_list->with_commit))
return 0;
/* Don't add types the caller doesn't want */
@@ -401,7 +386,8 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str
qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
detached = (detached && (kinds & REF_LOCAL_BRANCH));
- if (detached && head_commit && has_commit(head_commit, with_commit)) {
+ if (detached && head_commit &&
+ commit_has_any_in_commit_list(head_commit, with_commit)) {
struct ref_item item;
item.name = xstrdup("(no branch)");
item.kind = REF_LOCAL_BRANCH;
diff --git a/commit.c b/commit.c
index c99db16..97c8a8a 100644
--- a/commit.c
+++ b/commit.c
@@ -705,6 +705,22 @@ struct commit_list *get_merge_bases(struct commit *one, struct commit *two,
return get_merge_bases_many(one, 1, &two, cleanup);
}
+int commit_has_any_in_commit_list(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..4084102 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 commit_has_any_in_commit_list(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.6
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] Add --contains flag to git tag
2009-01-26 14:13 ` [PATCH 2/3] Make has_commit non-static Jake Goulding
@ 2009-01-26 14:13 ` Jake Goulding
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static Johannes Schindelin
1 sibling, 0 replies; 12+ messages in thread
From: Jake Goulding @ 2009-01-26 14:13 UTC (permalink / raw)
To: git; +Cc: gitster, Jake Goulding
This functions similar to git branch --contains - it will show all
tags that contain the specified commit. Indeed, it uses the same
lookup mechanisms as git branch.
Also adding documentation and tests for new option.
Signed-off-by: Jake Goulding <goulding@vivisimo.com>
---
Updated error semantics as suggested by Junio.
Documentation/git-tag.txt | 5 ++-
builtin-tag.c | 30 +++++++++++-
t/t7004-tag.sh | 115 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 147 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index e44f543..533d18b 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -12,7 +12,7 @@ SYNOPSIS
'git tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]
<name> [<commit> | <object>]
'git tag' -d <name>...
-'git tag' [-n[<num>]] -l [<pattern>]
+'git tag' [-n[<num>]] -l [--contains <commit>] [<pattern>]
'git tag' -v <name>...
DESCRIPTION
@@ -68,6 +68,9 @@ OPTIONS
List tags with names that match the given pattern (or all if no pattern is given).
Typing "git tag" without arguments, also lists all tags.
+--contains <commit>::
+ Only list tags which contain the specified commit.
+
-m <msg>::
Use the given tag message (instead of prompting).
If multiple `-m` options are given, their values are
diff --git a/builtin-tag.c b/builtin-tag.c
index a398499..17082de 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -26,6 +26,7 @@ static char signingkey[1000];
struct tag_filter {
const char *pattern;
int lines;
+ struct commit_list *with_commit;
};
#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
@@ -42,6 +43,17 @@ static int show_reference(const char *refname, const unsigned char *sha1,
char *buf, *sp, *eol;
size_t len;
+ if (filter->with_commit) {
+ struct commit *commit;
+
+ commit = lookup_commit_reference_gently(sha1, 1);
+ if (!commit)
+ return 0;
+ if (!commit_has_any_in_commit_list(commit,
+ filter->with_commit))
+ return 0;
+ }
+
if (!filter->lines) {
printf("%s\n", refname);
return 0;
@@ -79,7 +91,8 @@ static int show_reference(const char *refname, const unsigned char *sha1,
return 0;
}
-static int list_tags(const char *pattern, int lines)
+static int list_tags(const char *pattern, int lines,
+ struct commit_list *with_commit)
{
struct tag_filter filter;
@@ -88,6 +101,7 @@ static int list_tags(const char *pattern, int lines)
filter.pattern = pattern;
filter.lines = lines;
+ filter.with_commit = with_commit;
for_each_tag_ref(show_reference, (void *) &filter);
@@ -360,6 +374,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
list = 0, delete = 0, verify = 0;
const char *msgfile = NULL, *keyid = NULL;
struct msg_arg msg = { 0, STRBUF_INIT };
+ struct commit_list *with_commit = NULL;
struct option options[] = {
OPT_BOOLEAN('l', NULL, &list, "list tag names"),
{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
@@ -378,6 +393,14 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
OPT_STRING('u', NULL, &keyid, "key-id",
"use another key to sign the tag"),
OPT_BOOLEAN('f', NULL, &force, "replace the tag if exists"),
+
+ OPT_GROUP("Tag listing options"),
+ {
+ OPTION_CALLBACK, 0, "contains", &with_commit, "commit",
+ "print only tags that contain the commit",
+ PARSE_OPT_LASTARG_DEFAULT,
+ parse_opt_with_commit, (intptr_t)"HEAD",
+ },
OPT_END()
};
@@ -402,9 +425,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
if (list + delete + verify > 1)
usage_with_options(git_tag_usage, options);
if (list)
- return list_tags(argv[0], lines == -1 ? 0 : lines);
+ return list_tags(argv[0], lines == -1 ? 0 : lines,
+ with_commit);
if (lines != -1)
die("-n option is only allowed with -l.");
+ if (with_commit)
+ die("--contains option is only allowed with -l.");
if (delete)
return for_each_tag_name(argv, delete_tag);
if (verify)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index f377fea..69501e2 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1090,6 +1090,121 @@ test_expect_success 'filename for the message is relative to cwd' '
git cat-file tag tag-from-subdir-2 | grep "in sub directory"
'
+# create a few more commits to test --contains
+
+hash1=$(git rev-parse HEAD)
+
+test_expect_success 'creating second commit and tag' '
+ echo foo-2.0 >foo &&
+ git add foo &&
+ git commit -m second
+ git tag v2.0
+'
+
+hash2=$(git rev-parse HEAD)
+
+test_expect_success 'creating third commit without tag' '
+ echo foo-dev >foo &&
+ git add foo &&
+ git commit -m third
+'
+
+hash3=$(git rev-parse HEAD)
+
+# simple linear checks of --continue
+
+cat > expected <<EOF
+v0.2.1
+v1.0
+v1.0.1
+v1.1.3
+v2.0
+EOF
+
+test_expect_success 'checking that first commit is in all tags (hash)' "
+ git tag -l --contains $hash1 v* >actual
+ test_cmp expected actual
+"
+
+# other ways of specifying the commit
+test_expect_success 'checking that first commit is in all tags (tag)' "
+ git tag -l --contains v1.0 v* >actual
+ test_cmp expected actual
+"
+
+test_expect_success 'checking that first commit is in all tags (relative)' "
+ git tag -l --contains HEAD~2 v* >actual
+ test_cmp expected actual
+"
+
+cat > expected <<EOF
+v2.0
+EOF
+
+test_expect_success 'checking that second commit only has one tag' "
+ git tag -l --contains $hash2 v* >actual
+ test_cmp expected actual
+"
+
+
+cat > expected <<EOF
+EOF
+
+test_expect_success 'checking that third commit has no tags' "
+ git tag -l --contains $hash3 v* >actual
+ test_cmp expected actual
+"
+
+# how about a simple merge?
+
+test_expect_success 'creating simple branch' '
+ git branch stable v2.0 &&
+ git checkout stable &&
+ echo foo-3.0 > foo &&
+ git commit foo -m fourth
+ git tag v3.0
+'
+
+hash4=$(git rev-parse HEAD)
+
+cat > expected <<EOF
+v3.0
+EOF
+
+test_expect_success 'checking that branch head only has one tag' "
+ git tag -l --contains $hash4 v* >actual
+ test_cmp expected actual
+"
+
+test_expect_success 'merging original branch into this branch' '
+ git merge --strategy=ours master &&
+ git tag v4.0
+'
+
+cat > expected <<EOF
+v4.0
+EOF
+
+test_expect_success 'checking that original branch head has one tag now' "
+ git tag -l --contains $hash3 v* >actual
+ test_cmp expected actual
+"
+
+cat > expected <<EOF
+v0.2.1
+v1.0
+v1.0.1
+v1.1.3
+v2.0
+v3.0
+v4.0
+EOF
+
+test_expect_success 'checking that initial commit is in all tags' "
+ git tag -l --contains $hash1 v* >actual
+ test_cmp expected actual
+"
+
# mixing modes and options:
test_expect_success 'mixing incompatibles modes and options is forbidden' '
--
1.6.0.6
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-26 14:13 ` [PATCH 2/3] Make has_commit non-static Jake Goulding
2009-01-26 14:13 ` [PATCH 3/3] Add --contains flag to git tag Jake Goulding
@ 2009-01-26 15:38 ` Johannes Schindelin
2009-01-26 19:20 ` Jake Goulding
` (2 more replies)
1 sibling, 3 replies; 12+ messages in thread
From: Johannes Schindelin @ 2009-01-26 15:38 UTC (permalink / raw)
To: Jake Goulding; +Cc: git, gitster
Hi,
On Mon, 26 Jan 2009, Jake Goulding wrote:
> Moving has_commit from branch to a common location in preparation for
> using it in tag. Renaming it to commit_has_any_in_commit_list to be more
> unique.
I feel like bike-shedding for a change, and I'd also like to prove that
not all Germans like long names:
is_ancestor_of_any()
Hmm?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static Johannes Schindelin
@ 2009-01-26 19:20 ` Jake Goulding
2009-01-26 20:06 ` Junio C Hamano
2009-01-28 20:36 ` Junio C Hamano
2 siblings, 0 replies; 12+ messages in thread
From: Jake Goulding @ 2009-01-26 19:20 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, gitster
Johannes Schindelin wrote:
> Hi,
>
> On Mon, 26 Jan 2009, Jake Goulding wrote:
>
>> Moving has_commit from branch to a common location in preparation for
>> using it in tag. Renaming it to commit_has_any_in_commit_list to be more
>> unique.
>
> I feel like bike-shedding for a change, and I'd also like to prove that
> not all Germans like long names:
>
> is_ancestor_of_any()
>
> Hmm?
I assume that this means that the rest of the code/logic is fine? :-D
I'll change this (I don't have any attachment to one name or the other),
then it should be good to go!
-Jake
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static 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
2 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2009-01-26 20:06 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jake Goulding, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Mon, 26 Jan 2009, Jake Goulding wrote:
>
>> Moving has_commit from branch to a common location in preparation for
>> using it in tag. Renaming it to commit_has_any_in_commit_list to be more
>> unique.
>
> I feel like bike-shedding for a change, and I'd also like to prove that
> not all Germans like long names:
>
> is_ancestor_of_any()
>
> Hmm?
Is it ancestor or descendant? The latter makes the name longer, though
;-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-26 20:06 ` Junio C Hamano
@ 2009-01-26 20:38 ` Johannes Schindelin
0 siblings, 0 replies; 12+ messages in thread
From: Johannes Schindelin @ 2009-01-26 20:38 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jake Goulding, git
Hi,
On Mon, 26 Jan 2009, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Mon, 26 Jan 2009, Jake Goulding wrote:
> >
> >> Moving has_commit from branch to a common location in preparation for
> >> using it in tag. Renaming it to commit_has_any_in_commit_list to be
> >> more unique.
> >
> > I feel like bike-shedding for a change, and I'd also like to prove
> > that not all Germans like long names:
> >
> > is_ancestor_of_any()
> >
> > Hmm?
>
> Is it ancestor or descendant? The latter makes the name longer, though
> ;-)
I did not read the patch and missed that it means the opposite, sorry...
Ciao,
Dscho
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static Johannes Schindelin
2009-01-26 19:20 ` Jake Goulding
2009-01-26 20:06 ` Junio C Hamano
@ 2009-01-28 20:36 ` Junio C Hamano
2009-02-03 15:08 ` Jake Goulding
2 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2009-01-28 20:36 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jake Goulding, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Mon, 26 Jan 2009, Jake Goulding wrote:
>
>> Moving has_commit from branch to a common location in preparation for
>> using it in tag. Renaming it to commit_has_any_in_commit_list to be more
>> unique.
>
> I feel like bike-shedding for a change, and I'd also like to prove that
> not all Germans like long names:
>
> is_ancestor_of_any()
I'll queue this after munging it to "is_descendant_of()".
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] Make has_commit non-static
2009-01-28 20:36 ` Junio C Hamano
@ 2009-02-03 15:08 ` Jake Goulding
0 siblings, 0 replies; 12+ messages in thread
From: Jake Goulding @ 2009-02-03 15:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
Thanks for changing that for me - I lost track of this in other work!
-Jake
Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Mon, 26 Jan 2009, Jake Goulding wrote:
>>
>>> Moving has_commit from branch to a common location in preparation for
>>> using it in tag. Renaming it to commit_has_any_in_commit_list to be more
>>> unique.
>> I feel like bike-shedding for a change, and I'd also like to prove that
>> not all Germans like long names:
>>
>> is_ancestor_of_any()
>
> I'll queue this after munging it to "is_descendant_of()".
>
> Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-02-03 15:12 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 14:13 ` [PATCH 3/3] Add --contains flag to git tag Jake Goulding
2009-01-26 15:38 ` [PATCH 2/3] Make has_commit non-static 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
[not found] <1232671630-19683-1-git-send-email-goulding@vivisimo.com>
2009-01-23 0:48 ` Jake Goulding
2009-01-23 1:13 ` Junio C Hamano
2009-01-23 22:41 ` Jake Goulding
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).