From: Junio C Hamano <hidden> Date: 2016-06-15 22:53:02
Tom Grennan [off-list ref] writes:
quoted
If we pursue this, it may be best to first add match_patterns() to ./refs.[ch]
then incrementally modify these builtin commands to use it.
The following series implements !<pattern> with: git-tag, git-branch, and
git-for-each-ref.
This still requires Documentation and unit test updates but I think these are
close to functionally complete.
After looking at this some more, I don't understand the value of replacing
libc:fnmatch(). Or are you just referring to '--exclude' instead of
[!]<pattern> argument parsing?
I have not formed a firm opinion on Nguyen's idea to reuse pathspec
matching infrastructure for this purpose, so I wouldn't comment on that
part. It certainly looks attractive, as it allows users to learn one and
only one extended matching syntax, but at the same time, it has a risk to
mislead people to think that the namespace for refs is similar to that of
the filesystem paths, which I see as a mild downside.
In any case, I do not like the structure of this series. If it followed
our usual pattern, it would consist of patches in this order:
- Patch 1 would extract match_pattern() from builtin/tag.c and introduce
the new helper function refname_match_patterns() to refs.c. It updates
the call sites of match_pattern() in builtin/tag.c, match_patterns() in
builtin/branch.c, and the implementation of grab_single_ref() in
builtin/for-each-ref.c with a call to the new helper function.
This step can and probably should be done as three sub-steps. 1a would
move builtin/tag.c::match_pattern() to refs.::refname_match_patterns(),
1b would use the new helper in builtin/branch.c and 1c would do the
same for builtin/for-each-ref.c.
It is important that this patch does so without introducing any new
functionality to the new function over the old one. When done this way,
there is no risk of introducing new bugs at 1a because it is purely a
code movement and renaming; 1b could introduce a bug that changes
semantics for bulitin/branch.c if its match_patterns() does things
differently from match_pattern() lifted from builtin/tag.c, and if it
is found out to be buggy, we can discard 1b without discarding 1a. Same
for 1c, which I highly suspect will introduce regression without
looking at the code (for-each-ref is prefix-match only), that can
safely be discarded.
This is to make it easier to ensure that the update does not introduce
new bugs.
- Patch 2 would then add the new functionality to the new helper. It
would also adjust the documentation of the three end user facing
commands to describe the fallout coming from this change, and adds new
tests to make sure future changes will not break this new
functionality.
That is, first refactor and clean-up without adding anything new, and then
build new stuff on solidified ground.
Do we allow a refname whose pathname component begins with '!', by the
way? If we do, how does a user look for a tag whose name is "!xyzzy"?
"Naming your tag !xyzzy used to be allowed but it is now forbidden after
this patch" is not an acceptable answer---it is called a regression. If
the negation operator were "^" or something that we explicitly forbid from
a refname, we wouldn't have such a problem.
From: Michael Haggerty <hidden> Date: 2016-06-15 22:53:03
On 02/11/2012 04:06 AM, Junio C Hamano wrote:
Tom Grennan [off-list ref] writes:
quoted
The following series implements !<pattern> with: git-tag, git-branch, and
git-for-each-ref.
This still requires Documentation and unit test updates but I think these are
close to functionally complete.
Do we allow a refname whose pathname component begins with '!', by the
way? If we do, how does a user look for a tag whose name is "!xyzzy"?
"Naming your tag !xyzzy used to be allowed but it is now forbidden after
this patch" is not an acceptable answer---it is called a regression. If
the negation operator were "^" or something that we explicitly forbid from
a refname, we wouldn't have such a problem.
According to git-check-ref-format(1), '!' are allowed in reference
names. (Whether that was a good idea is another question, but now we
have to support it.)
So using "^" would be an option. A problem is that the new meaning is
not consistent with the use of "^" in rev-list, and therefore would (1)
be confusing and (2) prevent the addition of a similar syntax in rev-list.
Currently,
git rev-list A B ^C
means "revisions reachable from A or B but not from C". (For simplicity
assume that A, B, and C are literal reference names without wildcards.)
The proposal, amended to use "^" instead of "!", is that
git for-each-ref A B ^C
should mean "the reference names A and B but not C". Therefore, the command
git rev-list $(git for-each-ref A B ^C)
, which consistency suggests should do the same thing as the first
command, would in fact be equivalent to
git rev-list A B
Moreover, it *would* be nice to have this kind of exclude-branch-name
syntax in rev-parse. Many times I have wanted to type the equivalent of
gitk --all --not-branch=remotes/korg/*
That is, "show the commits starting at *all branches except for the
specified branches*". This is different than "show *the commits
starting at all branches* except for *the commits reachable from the
specified branches*", because I want to see the *complete* history of
the non-excluded branches. (Is there an easy way to do this now?) The
proposed functionality is a step forward; I could type
gitk $(git for-each-ref !remotes/korg/*)
But it would be even nicer if this could be expressed directly in rev-parse.
In summary, I suggest we consider using a more verbose syntax for this
new functionality (probably via one or more new options, for example
--not-branch=PATTERN, --not-tag=PATTERN, and/or --not-ref=PATTERN) that
cannot be confused with the existing syntax for excluding commits.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:03
On Fri, Feb 10, 2012 at 07:06:57PM -0800, Junio C Hamano wrote:
Tom Grennan [off-list ref] writes:
quoted
quoted
If we pursue this, it may be best to first add match_patterns() to ./refs.[ch]
then incrementally modify these builtin commands to use it.
The following series implements !<pattern> with: git-tag, git-branch, and
git-for-each-ref.
This still requires Documentation and unit test updates but I think these are
close to functionally complete.
After looking at this some more, I don't understand the value of replacing
libc:fnmatch(). Or are you just referring to '--exclude' instead of
[!]<pattern> argument parsing?
I have not formed a firm opinion on Nguyen's idea to reuse pathspec
matching infrastructure for this purpose, so I wouldn't comment on that
part. It certainly looks attractive, as it allows users to learn one and
only one extended matching syntax, but at the same time, it has a risk to
mislead people to think that the namespace for refs is similar to that of
the filesystem paths, which I see as a mild downside.
In any case, I do not like the structure of this series. If it followed
our usual pattern, it would consist of patches in this order:
- Patch 1 would extract match_pattern() from builtin/tag.c and introduce
the new helper function refname_match_patterns() to refs.c. It updates
the call sites of match_pattern() in builtin/tag.c, match_patterns() in
builtin/branch.c, and the implementation of grab_single_ref() in
builtin/for-each-ref.c with a call to the new helper function.
This step can and probably should be done as three sub-steps. 1a would
move builtin/tag.c::match_pattern() to refs.::refname_match_patterns(),
1b would use the new helper in builtin/branch.c and 1c would do the
same for builtin/for-each-ref.c.
It is important that this patch does so without introducing any new
functionality to the new function over the old one. When done this way,
there is no risk of introducing new bugs at 1a because it is purely a
code movement and renaming; 1b could introduce a bug that changes
semantics for bulitin/branch.c if its match_patterns() does things
differently from match_pattern() lifted from builtin/tag.c, and if it
is found out to be buggy, we can discard 1b without discarding 1a. Same
for 1c, which I highly suspect will introduce regression without
looking at the code (for-each-ref is prefix-match only), that can
safely be discarded.
This is to make it easier to ensure that the update does not introduce
new bugs.
- Patch 2 would then add the new functionality to the new helper. It
would also adjust the documentation of the three end user facing
commands to describe the fallout coming from this change, and adds new
tests to make sure future changes will not break this new
functionality.
That is, first refactor and clean-up without adding anything new, and then
build new stuff on solidified ground.
Nuts! I have the cart before the horse. I'll try to rearrange the series as
suggested by tomorrow. Thanks.
Do we allow a refname whose pathname component begins with '!', by the
way? If we do, how does a user look for a tag whose name is "!xyzzy"?
"Naming your tag !xyzzy used to be allowed but it is now forbidden after
this patch" is not an acceptable answer---it is called a regression. If
the negation operator were "^" or something that we explicitly forbid from
a refname, we wouldn't have such a problem.
Cool, as I recall, v7 or earlier /bin/sh also used "^" to preface
exclusion patterns. Another option is the bash extglob syntax of
!(pattern) although I'd prefer "^" b/c one wouldn't have to quote it
with bash:
$ git branch --list ^pu
--
TomG
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:07
It has taken me a while to get back to this; the following series rebase
and rework my proposed "!<pattern>" feature. The first patch extracts
match_pattern() from builtin/tag.c and updates this to replace similar
functions in builtin/{branch,for-each-ref,ls-remote}.c
The second patch uses the OPT_CALLBACK wrapper on the recently added
"--points-at" option of git-tag. I should have implemented it this way
to begin with but I missed Jeff King's suggestion within that thread.
The remaining patches add "--exclude <pattern>" options (vs.
"!<pattern>") to: git-tag, git-branch, and git-for-each-ref.
For example,
$ git tag -l --exclude "*-rc?" "v1.7.8*"
$ git branch -r --exclude \*HEAD
$ git for-each-ref --format="%(refname)" --exclude "*HEAD"
refs/remotes/origin
Instead of,
$ git tag -l "!*-rc?" "v1.7.8*"
$ git branch -r "!*HEAD"
$ git for-each-ref --format="%(refname)" "!*HEAD" refs/remotes/origin
Note that I haven't yet added an "--exclude" feature to git-ls-remote
because I think that I should first update its option parsing.
Thanks,
Tom Grennan (5):
refs: add match_pattern()
tag --points-at option wrapper
tag --exclude option
branch --exclude option
for-each-ref --exclude option
Documentation/git-branch.txt | 7 ++++-
Documentation/git-for-each-ref.txt | 7 ++++-
Documentation/git-tag.txt | 6 +++-
builtin/branch.c | 30 ++++++++-----------
builtin/for-each-ref.c | 27 +++++------------
builtin/ls-remote.c | 12 ++------
builtin/tag.c | 35 ++++++++++------------
refs.c | 36 +++++++++++++++++++++++
refs.h | 12 ++++++++
t/t3200-branch.sh | 23 +++++++++++++++
t/t6300-for-each-ref.sh | 11 +++++++
t/t7004-tag.sh | 56 ++++++++++++++++++++++++++++++++++++
12 files changed, 195 insertions(+), 67 deletions(-)
--
1.7.8
@@ -90,6 +90,10 @@ OPTIONS --points-at <object>:: Only list tags of the given object.+--exclude <pattern>::+ Don't list tags matching the given pattern. This has precedence+ over any other match pattern arguments.+ -m <msg>:: --message=<msg>:: Use the given tag message (instead of prompting).
@@ -428,6 +431,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)constchar*msgfile=NULL,*keyid=NULL;structmsg_argmsg={0,STRBUF_INIT};structcommit_list*with_commit=NULL;+structstring_listexclude=STRING_LIST_INIT_NODUP;structoptionoptions[]={OPT_BOOLEAN('l',"list",&list,"list tag names"),{OPTION_INTEGER,'n',NULL,&lines,"n",
@@ -459,6 +463,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)OPT_CALLBACK(0,"points-at",NULL,"object","print only tags of the object",parse_opt_points_at),+OPT_CALLBACK(0,"exclude",&exclude,"pattern",+"ignore pattern matching tags",+parse_opt_string_list),OPT_END()};
@@ -485,13 +492,15 @@ int cmd_tag(int argc, const char **argv, const char *prefix)usage_with_options(git_tag_usage,options);if(list)returnlist_tags(argv,lines==-1?0:lines,-with_commit);+with_commit,&exclude);if(lines!=-1)die(_("-n option is only allowed with -l."));if(with_commit)die(_("--contains option is only allowed with -l."));if(points_at.nr)die(_("--points-at option is only allowed with -l."));+if(exclude.nr)+die(_("--exclude option is only allowed with -l."));if(delete)returnfor_each_tag_name(argv,delete_tag);if(verify)
@@ -82,6 +82,10 @@ test_expect_success \'listing tags using a non-matching pattern should output nothing'\'test `git tag -l xxx | wc -l` -eq 0'+test_expect_success\+'listing tags excluding "mytag" should output nothing'\+'test `git tag -l --exclude mytag | wc -l` -eq 0'+# special cases for creating tags: test_expect_success\
@@ -202,6 +206,15 @@ test_expect_success \' cat>expect<<EOF+v0.2.1+EOF+test_expect_success\+'listing tags with a suffix as pattern and prefix exclusion''+gittag-l--exclude"v1.*""*.1">actual&&+test_cmpexpectactual+'++cat>expect<<EOF t210 t211 EOF
@@ -212,6 +225,15 @@ test_expect_success \' cat>expect<<EOF+t210+EOF+test_expect_success\+'listing tags with a prefix as pattern and suffix exclusion''+gittag-l--exclude"*1""t21*">actual&&+test_cmpexpectactual+'++cat>expect<<EOF a1 EOF test_expect_success\
@@ -239,6 +261,15 @@ test_expect_success \test_cmpexpectactual'+cat>expect<<EOF+v1.0.1+EOF+test_expect_success\+'listing tags with ? in the pattern and exclusion''+gittag-l--exclude"v1.?.3""v1.?.?">actual&&+test_cmpexpectactual+'+ >expect test_expect_success\'listing tags using v.* should print nothing because none have v.''
@@ -263,6 +294,31 @@ test_expect_success 'tag -l can accept multiple patterns' 'test_cmpexpectactual'+test_expect_success'tag -l can cancel exclusions''+gittag-l--exclude"v*.3"--no-exclude"v1*""v0*">actual&&+test_cmpexpectactual+'++cat>expect<<EOF+v0.2.1+v1.0.1+EOF+test_expect_success'tag -l can accept multiple patterns and exclusions''+gittag-l--exclude"v*.3"--exclude"v1.0""v1*""v0*">actual&&+test_cmpexpectactual+'++cat>expect<<EOF+v0.2.1+v1.0.1+v1.1.3+EOF+test_expect_success\+'tag -l can cancel then reapply exclusions''+gittag-l--exclude"v*.3"--no-exclude--exclude"v1.0"\+"v1*""v0*">actual&&+test_cmpexpectactual+'# creating and verifying lightweight tags: test_expect_success\
@@ -312,7 +300,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,if((kind&ref_list->kinds)==0)return0;-if(!match_patterns(cb->pattern,refname))+if(!match_pattern(refname,cb->pattern,NULL,0))return0;commit=NULL;
@@ -542,7 +530,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, struqsort(ref_list.list,ref_list.index,sizeof(structref_item),ref_cmp);detached=(detached&&(kinds&REF_LOCAL_BRANCH));-if(detached&&match_patterns(pattern,"HEAD"))+if(detached&&match_pattern("HEAD",pattern,NULL,0))show_detached(&ref_list);for(i=0;i<ref_list.index;i++){
@@ -34,17 +34,6 @@ struct tag_filter {staticstructsha1_arraypoints_at;-staticintmatch_pattern(constchar**patterns,constchar*ref)-{-/* no pattern means match everything */-if(!*patterns)-return1;-for(;*patterns;patterns++)-if(!fnmatch(*patterns,ref,0))-return1;-return0;-}-staticconstunsignedchar*match_points_at(constchar*refname,constunsignedchar*sha1){
@@ -3,6 +3,7 @@#include"object.h"#include"tag.h"#include"dir.h"+#include"string-list.h"/* ISSYMREF=0x01, ISPACKED=0x02 and ISBROKEN=0x04 are public interfaces */#define REF_KNOWS_PEELED 0x10
@@ -2127,3 +2128,38 @@ char *shorten_unambiguous_ref(const char *refname, int strict)free(short_name);returnxstrdup(refname);}++staticintmatch_path(constchar*name,constchar*pattern,intnlen)+{+intplen=strlen(pattern);++return((plen<=nlen)&&+!strncmp(name,pattern,plen)&&+(name[plen]=='\0'||+name[plen]=='/'||+pattern[plen-1]=='/'));+}++intmatch_pattern(constchar*name,constchar**match,+structstring_list*exclude,intflags)+{+intnlen=strlen(name);++if(exclude){+structstring_list_item*x;+for_each_string_list_item(x,exclude){+if(!fnmatch(x->string,name,0))+return0;+}+}+if(!match||!*match)+return1;+for(;*match;match++){+if(flags==FNM_PATHNAME)+if(match_path(name,*match,nlen))+return1;+if(!fnmatch(*match,name,flags))+return1;+}+return0;+}
@@ -47,6 +48,10 @@ OPTIONS `xx`; for example `%00` interpolates to `\0` (NUL), `%09` to `\t` (TAB) and `%0a` to `\n` (LF).+--exclude <pattern>::+ Ignore refs matching the given pattern. This has precedence+ over any other pattern match arguments.+ <pattern>...:: If one or more patterns are given, only refs are shown that match against at least one pattern, either using fnmatch(3) or
@@ -91,6 +91,9 @@ static const char **used_atom;staticcmp_type*used_atom_type;staticintused_atom_cnt,sort_atom_limit,need_tagged,need_symref;+/* list of ref patterns and ref groups (i.e. foo/) to ignore */+staticstructstring_listexclude=STRING_LIST_INIT_NODUP;+/**Usedtoparseformatstringandsortspecifiers*/
@@ -781,7 +784,7 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int fstructrefinfo*ref;intcnt;-if(!match_pattern(refname,cb->grab_pattern,NULL,FNM_PATHNAME))+if(!match_pattern(refname,cb->grab_pattern,&exclude,FNM_PATHNAME))return0;/*
@@ -985,6 +988,9 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)OPT_STRING(0,"format",&format,"format","format to use for the output"),OPT_CALLBACK(0,"sort",sort_tail,"key","field name to sort on",&opt_parse_sort),+OPT_CALLBACK(0,"exclude",&exclude,"pattern",+"ignore pattern matching refs",+parse_opt_string_list),OPT_END(),};
@@ -166,6 +167,10 @@ start-point is either a local or remote-tracking branch. --contains <commit>:: Only list branches which contain the specified commit.+--exclude <pattern>::+ Don't list branches matching the given pattern. This has+ precedence over other match pattern arguments.+ --merged [<commit>]:: Only list branches whose tips are reachable from the specified commit (HEAD if not specified).
@@ -509,6 +513,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, struref_list.verbose=verbose;ref_list.abbrev=abbrev;ref_list.with_commit=with_commit;+ref_list.exclude=exclude;if(merge_filter!=NO_FILTER)init_revisions(&ref_list.revs,NULL);cb.ref_list=&ref_list;
@@ -530,7 +535,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, struqsort(ref_list.list,ref_list.index,sizeof(structref_item),ref_cmp);detached=(detached&&(kinds&REF_LOCAL_BRANCH));-if(detached&&match_pattern("HEAD",pattern,NULL,0))+if(detached&&match_pattern("HEAD",pattern,exclude,0))show_detached(&ref_list);for(i=0;i<ref_list.index;i++){
@@ -160,6 +160,29 @@ test_expect_success 'git branch --list -d t should fail' 'test_path_is_missing.git/refs/heads/t'+>expect+test_expect_success\+'git branch --list --exclude "t*" "t*" should be empty''+gitbranchta&&+gitbranchtb&&+gitbranch--list--exclude"t*""t*">actual&&+cmpexpectactual+'++cat>expect<<EOF+ta+EOF+test_expect_success\+'git branch --list --exclude "tb" "t*" should be "ta"''+gitbranch--list--exclude"tb""t*">actual&&+cmpexpectactual+'++test_expect_success\+'git branch -d ta tb should succeed''+gitbranch-dtatb+'+ mv.git/config.git/config-saved test_expect_success'git branch -m q q2 without config should succeed''
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:07
Use the OPT_CALLBACK wrapper with "--points-at" instead of an
OPTION_CALLBACK block.
Signed-off-by: Tom Grennan <redacted>
---
builtin/tag.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
@@ -456,10 +456,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)PARSE_OPT_LASTARG_DEFAULT,parse_opt_with_commit,(intptr_t)"HEAD",},-{-OPTION_CALLBACK,0,"points-at",NULL,"object",-"print only tags of the object",0,parse_opt_points_at-},+OPT_CALLBACK(0,"points-at",NULL,"object",+"print only tags of the object",+parse_opt_points_at),OPT_END()};
From: Junio C Hamano <hidden> Date: 2016-06-15 22:53:07
Tom Grennan [off-list ref] writes:
Example,
$ git tag -l --exclude "*-rc?" "v1.7.8*"
v1.7.8
v1.7.8.1
v1.7.8.2
v1.7.8.3
v1.7.8.4
Which is equivalent to,
$ git tag -l "v1.7.8*" | grep -v \\-rc.
v1.7.8
v1.7.8.1
v1.7.8.2
v1.7.8.3
v1.7.8.4
Signed-off-by: Tom Grennan <redacted>
Having an example is a good way to illustrate your explanation, but it is
not a substitution. Could we have at least one real sentence to describe
what the added option *does*?
This comment applies to all the patches in this series except for the
second patch.
@@ -90,6 +90,10 @@ OPTIONS --points-at <object>:: Only list tags of the given object.+--exclude <pattern>::+ Don't list tags matching the given pattern. This has precedence+ over any other match pattern arguments.
As you do not specify what kind of pattern matching is done to this
exclude pattern, it is important to use the same logic between positive
and negative ones to give users a consistent UI. Unfortunately we use
fnmatch without FNM_PATHNAME for positive ones, so this exclude pattern
needs to follow the same semantics to reduce confusion.
This comment applies to all the patches in this series to add this option
to existing commands that take the positive pattern.
quoted hunk
@@ -202,6 +206,15 @@ test_expect_success \ ' cat >expect <<EOF+v0.2.1+EOF+test_expect_success \+ 'listing tags with a suffix as pattern and prefix exclusion' '+ git tag -l --exclude "v1.*" "*.1" > actual &&+ test_cmp expect actual+'
I know you are imitating the style of surrounding tests that is an older
parts of this script, but it is an eyesore. More modern tests are written
like this:
test_expect_success 'label for the test' '
cat >expect <<-EOF &&
v0.2.1
EOF
git tag -l ... >actual &&
test_cmp expect actual
'
to avoid unnecessary backslash on the first line, and have the preparation
of test vectore _inside_ test_expect_success. We would eventually want to
update the older part to the newer style for consistency.
Two possible ways to go about this are (1) have a "pure style" patch at
the beginning to update older tests to a new style and then add new code
and new test as a follow-up patch written in modern, or (2) add new code
and new test in modern, and make a mental note to update the older ones
after the dust settles. Adding new tests written in older style to a file
that already has mixed styles is the worst thing you can do.
This comment applies to all the patches in this series with tests.
Thanks.
This is a counterpart to the tail match found in ls-remote, so we would
want to call it with a name that makes it clear this is a leading path
match not just "path" match. Perhaps match_leading_path() or something.
+int match_pattern(const char *name, const char **match,
+ struct string_list *exclude, int flags)
+{
+ int nlen = strlen(name);
+
+ if (exclude) {
+ struct string_list_item *x;
+ for_each_string_list_item(x, exclude) {
+ if (!fnmatch(x->string, name, 0))
+ return 0;
+ }
+ }
+ if (!match || !*match)
+ return 1;
+ for (; *match; match++) {
+ if (flags == FNM_PATHNAME)
+ if (match_path(name, *match, nlen))
+ return 1;
+ if (!fnmatch(*match, name, flags))
+ return 1;
+ }
+ return 0;
+}
As an API for a consolidated and generic function, the design needs a bit
more improving, I would think.
- The name match_pattern() was OK for a static function inside a single
file, but it is way too vague for a global function. This is to match
refnames, so I suspect there should at least be a string "ref_"
somewhere in its name.
- You pass "flags" argument, so that later we _could_ enhance the
implementation to cover needs for new callers, but alas, it uses its
full bits to express only one "do we do FNM_PATHNAME or not?" bit of
information, so essentially "flags" does not give us any expandability.
- Is it a sane assumption that a caller that asks FNM_PATHNAME will
always want match_path() semantics, too? Aren't these two logically
independent?
- Is it a sane assumption that a caller that gives an exclude list will
want neither FNM_PATHNAME semantics nor match_path() semantics?
- Positive patterns are passed in "const char **match", and negative ones
are in "struct string_list *". Doesn't the inconsistency strike you as
strange?
Perhaps like...
#define REF_MATCH_LEADING 01
#define REF_MATCH_TRAILING 02
#define REF_MATCH_FNM_PATH 04
static int match_one(const char *name, size_t namelen, const char *pattern,
unsigned flags)
{
if ((flags & REF_MATCH_LEADING) &&
match_leading_path(name, pattern, namelen))
return 1;
if ((flags & REF_MATCH_TRAILING) &&
match_trailing_path(name, pattern, namelen))
return 1;
if (!fnmatch(pattern, name,
(flags & REF_MATCH_FNM_PATH) ? FNM_PATHNAME : 0))
return 1;
return 0;
}
int ref_match_pattern(const char *name,
const char **pattern, const char **exclude, unsigned flags)
{
size_t namelen = strlen(name);
if (exclude) {
while (*exclude) {
if (match_one(name, namelen, *exclude, flags))
return 0;
exclude++;
}
}
if (!pattern || !*pattern)
return 1;
while (*pattern) {
if (match_one(name, namelen, *pattern, flags))
return 1;
pattern++;
}
return 0;
}
and then the caller could do something like
ref_match_pattern("refs/heads/master",
["maste?", NULL],
["refs/heads/", NULL],
(REF_MATCH_FNM_PATH|REF_MATCH_LEADING));
Note that the above "ref_match_pattern()" gives the same "flags" for the
call to match_one() for elements in both positive and negative array and
it is very deliberate. See review comment to [3/5] for the reasoning.
Thanks.
This is a counterpart to the tail match found in ls-remote, so we would
want to call it with a name that makes it clear this is a leading path
match not just "path" match. Perhaps match_leading_path() or something.
OK
quoted
+int match_pattern(const char *name, const char **match,
+ struct string_list *exclude, int flags)
+{
+ int nlen = strlen(name);
+
+ if (exclude) {
+ struct string_list_item *x;
+ for_each_string_list_item(x, exclude) {
+ if (!fnmatch(x->string, name, 0))
+ return 0;
+ }
+ }
+ if (!match || !*match)
+ return 1;
+ for (; *match; match++) {
+ if (flags == FNM_PATHNAME)
+ if (match_path(name, *match, nlen))
+ return 1;
+ if (!fnmatch(*match, name, flags))
+ return 1;
+ }
+ return 0;
+}
As an API for a consolidated and generic function, the design needs a bit
more improving, I would think.
- The name match_pattern() was OK for a static function inside a single
file, but it is way too vague for a global function. This is to match
refnames, so I suspect there should at least be a string "ref_"
somewhere in its name.
OK
- You pass "flags" argument, so that later we _could_ enhance the
implementation to cover needs for new callers, but alas, it uses its
full bits to express only one "do we do FNM_PATHNAME or not?" bit of
information, so essentially "flags" does not give us any expandability.
I agree.
- Is it a sane assumption that a caller that asks FNM_PATHNAME will
always want match_path() semantics, too? Aren't these two logically
independent?
Yes, these should be ligically independent although the current use has
combined them.
- Is it a sane assumption that a caller that gives an exclude list will
want neither FNM_PATHNAME semantics nor match_path() semantics?
I'm not sure. I tried using FNM_PATHNAME with both exclusion and match
patterns of git-for-each-ref but I couldn't get it to do something like
this:
git for-each-ref ... --exclude '*HEAD' refs/remotes/
I don't remember if this worked,
git for-each-ref ... --exclude HEAD refs/remotes/
Now I see how an implicit TRAILING match would be useful,
git for-each-ref ... --exclude /HEAD refs/remotes/
Where git-for-each-ref uses this flag:
REF_MATCH_LEADING | REF_MATCH_TRAILING | REF_MATCH_FNM_PATH
I'll experiment with this more.
- Positive patterns are passed in "const char **match", and negative ones
are in "struct string_list *". Doesn't the inconsistency strike you as
strange?
Yes, I tried to minimize change but the conversion of argv's to
string_list's won't add that much.
Perhaps like...
#define REF_MATCH_LEADING 01
#define REF_MATCH_TRAILING 02
#define REF_MATCH_FNM_PATH 04
static int match_one(const char *name, size_t namelen, const char *pattern,
unsigned flags)
{
if ((flags & REF_MATCH_LEADING) &&
match_leading_path(name, pattern, namelen))
return 1;
if ((flags & REF_MATCH_TRAILING) &&
match_trailing_path(name, pattern, namelen))
return 1;
if (!fnmatch(pattern, name,
(flags & REF_MATCH_FNM_PATH) ? FNM_PATHNAME : 0))
return 1;
return 0;
}
int ref_match_pattern(const char *name,
const char **pattern, const char **exclude, unsigned flags)
{
size_t namelen = strlen(name);
if (exclude) {
while (*exclude) {
if (match_one(name, namelen, *exclude, flags))
return 0;
exclude++;
}
}
if (!pattern || !*pattern)
return 1;
while (*pattern) {
if (match_one(name, namelen, *pattern, flags))
return 1;
pattern++;
}
return 0;
}
and then the caller could do something like
ref_match_pattern("refs/heads/master",
["maste?", NULL],
["refs/heads/", NULL],
(REF_MATCH_FNM_PATH|REF_MATCH_LEADING));
Note that the above "ref_match_pattern()" gives the same "flags" for the
call to match_one() for elements in both positive and negative array and
it is very deliberate. See review comment to [3/5] for the reasoning.
OK, I think that I understand, but please confirm, you'd expect no output in
the above example, right?
--
TomG
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:07
On Tue, Feb 21, 2012 at 10:33:29PM -0800, Junio C Hamano wrote:
Tom Grennan [off-list ref] writes:
quoted
Example,
$ git tag -l --exclude "*-rc?" "v1.7.8*"
v1.7.8
v1.7.8.1
v1.7.8.2
v1.7.8.3
v1.7.8.4
Which is equivalent to,
$ git tag -l "v1.7.8*" | grep -v \\-rc.
v1.7.8
v1.7.8.1
v1.7.8.2
v1.7.8.3
v1.7.8.4
Signed-off-by: Tom Grennan <redacted>
Having an example is a good way to illustrate your explanation, but it is
not a substitution. Could we have at least one real sentence to describe
what the added option *does*?
This comment applies to all the patches in this series except for the
second patch.
OK, I'll add the "exclude" option description from the respective man pages.
@@ -90,6 +90,10 @@ OPTIONS --points-at <object>:: Only list tags of the given object.+--exclude <pattern>::+ Don't list tags matching the given pattern. This has precedence+ over any other match pattern arguments.
As you do not specify what kind of pattern matching is done to this
exclude pattern, it is important to use the same logic between positive
and negative ones to give users a consistent UI. Unfortunately we use
fnmatch without FNM_PATHNAME for positive ones, so this exclude pattern
needs to follow the same semantics to reduce confusion.
This comment applies to all the patches in this series to add this option
to existing commands that take the positive pattern.
OK, should I also describe the --no-exclude option?
quoted
@@ -202,6 +206,15 @@ test_expect_success \ ' cat >expect <<EOF+v0.2.1+EOF+test_expect_success \+ 'listing tags with a suffix as pattern and prefix exclusion' '+ git tag -l --exclude "v1.*" "*.1" > actual &&+ test_cmp expect actual+'
I know you are imitating the style of surrounding tests that is an older
parts of this script, but it is an eyesore. More modern tests are written
like this:
test_expect_success 'label for the test' '
cat >expect <<-EOF &&
v0.2.1
EOF
git tag -l ... >actual &&
test_cmp expect actual
'
to avoid unnecessary backslash on the first line, and have the preparation
of test vectore _inside_ test_expect_success. We would eventually want to
update the older part to the newer style for consistency.
Two possible ways to go about this are (1) have a "pure style" patch at
the beginning to update older tests to a new style and then add new code
and new test as a follow-up patch written in modern, or (2) add new code
and new test in modern, and make a mental note to update the older ones
after the dust settles. Adding new tests written in older style to a file
that already has mixed styles is the worst thing you can do.
This comment applies to all the patches in this series with tests.
I'd prefer, (1) precede each "--exclude" patch with a "pure style" patch
to update the respective tests. However, since this will result in a
lot of conflict with concurrent development; I'll separate the test
patches from the code and documentation. I'll then cycle on rebasing
the style and new test patches until the development of each is
quiescent.
Thanks,
TomG
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:11
Tom Grennan [off-list ref] writes:
On Tue, Feb 21, 2012 at 10:33:29PM -0800, Junio C Hamano wrote:
quoted
I know you are imitating the style of surrounding tests that is an older
parts of this script, but it is an eyesore. More modern tests are written
like this:
test_expect_success 'label for the test' '
cat >expect <<-EOF &&
v0.2.1
EOF
git tag -l ... >actual &&
test_cmp expect actual
'
to avoid unnecessary backslash on the first line, and have the preparation
of test vectore _inside_ test_expect_success. We would eventually want to
update the older part to the newer style for consistency.
Two possible ways to go about this are (1) have a "pure style" patch at
the beginning to update older tests to a new style and then add new code
and new test as a follow-up patch written in modern, or (2) add new code
and new test in modern, and make a mental note to update the older ones
after the dust settles. Adding new tests written in older style to a file
that already has mixed styles is the worst thing you can do.
This comment applies to all the patches in this series with tests.
I'd prefer, (1) precede each "--exclude" patch with a "pure style" patch
to update the respective tests. However, since this will result in a
lot of conflict with concurrent development; I'll separate the test
patches from the code and documentation. I'll then cycle on rebasing
the style and new test patches until the development of each is
quiescent.
Per request, the following series modernize the style of the respective
test scripts. The common themes are:
- Guard setup with test_expect_success
- Single-quoted, tab prefaced test blocks of < 80 cols
- Redirect unwanted output
- Use a "here" filter for some expect generation
I also used pipelines to validate expected results rather than temporary
files, i.e.
TEST | test_cmp expect -
vs. TEST >actual && test_cmp expect actual
Since the later three patches have a lot of whitespace change, I've included an
alternate, PATCH-w series that filters these for more substantive review.
However, even the filtered series is very large causing me to second guess
whether such style modernization should be pursued; so, I look forward to your
input.
Thanks,
Tom Grennan (5):
t6300 (for-each-ref): modernize style
t5512 (ls-remote): modernize style
t3200 (branch): modernize style
t0040 (parse-options): modernize style
t7004 (tag): modernize style
t/t7004-tag.sh | 1680 ++++++++++++++++++++++++++------------------------------
1 files changed, 783 insertions(+), 897 deletions(-)
--
1.7.8
@@ -22,9 +30,9 @@ test_expect_success 'Create sample commit with known timestamp' 'setdate_and_increment&&echo"Using $datestamp">one&&gitaddone&&-gitcommit-m"Initial"&&+gitcommit-q-m"Initial"&&setdate_and_increment&&-gittag-a-m"Tagging at $datestamp"testtag+quietgittag-a-m"Tagging at $datestamp"testtag' test_expect_success'Create upstream config''
@@ -115,261 +123,270 @@ test_atom tag contents 'Tagging at 1151939927' test_expect_success'Check invalid atoms names are errors''-test_must_failgitfor-each-ref--format="%(INVALID)"refs/heads+silenttest_must_failgitfor-each-ref--format="%(INVALID)"refs/heads' test_expect_success'Check format specifiers are ignored in naming date atoms''-gitfor-each-ref--format="%(authordate)"refs/heads&&-gitfor-each-ref--format="%(authordate:default) %(authordate)"refs/heads&&-gitfor-each-ref--format="%(authordate) %(authordate:default)"refs/heads&&-gitfor-each-ref--format="%(authordate:default) %(authordate:default)"refs/heads+f1="%(authordate)"&&+f2="%(authordate:default) %(authordate)"&&+f3="%(authordate) %(authordate:default)"&&+f4="%(authordate:default) %(authordate:default)"+quietgitfor-each-ref--format="$f1"refs/heads&&+quietgitfor-each-ref--format="$f2"refs/heads&&+quietgitfor-each-ref--format="$f3"refs/heads&&+quietgitfor-each-ref--format="$f4"refs/heads' test_expect_success'Check valid format specifiers for date fields''-gitfor-each-ref--format="%(authordate:default)"refs/heads&&-gitfor-each-ref--format="%(authordate:relative)"refs/heads&&-gitfor-each-ref--format="%(authordate:short)"refs/heads&&-gitfor-each-ref--format="%(authordate:local)"refs/heads&&-gitfor-each-ref--format="%(authordate:iso8601)"refs/heads&&-gitfor-each-ref--format="%(authordate:rfc2822)"refs/heads+quietgitfor-each-ref--format="%(authordate:default)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:relative)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:short)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:local)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:iso8601)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:rfc2822)"refs/heads' test_expect_success'Check invalid format specifiers are errors''-test_must_failgitfor-each-ref--format="%(authordate:INVALID)"refs/heads+h="%(authordate:INVALID)"&&+silenttest_must_failgitfor-each-ref--format="$h"refs/heads'-cat>expected<<\EOF-'refs/heads/master''Mon Jul 3 17:18:43 2006 +0200''Mon Jul 3 17:18:44 2006 +0200'-'refs/tags/testtag''Mon Jul 3 17:18:45 2006 +0200'-EOF- test_expect_success'Check unformatted date fields output''-(gitfor-each-ref--shell--format="%(refname) %(committerdate) %(authordate)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate)"refs/tags)>actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF&&+'refs/heads/master''Mon Jul 3 17:18:43 2006 +0200''Mon Jul 3 17:18:44 2006 +0200'+'refs/tags/testtag''Mon Jul 3 17:18:45 2006 +0200'+EOF+"'+h="%(refname) %(committerdate) %(authordate)"&&+t="%(refname) %(taggerdate)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-' test_expect_success'Check format "default" formatted date fields output''-f=default&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+h="%(refname) %(committerdate:default) %(authordate:default)"&&+t="%(refname) %(taggerdate:default)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-# Don't know how to do relative check because I can't know when this script-# is going to be run and can't fake the current time to git, and hence can't-# provide expected output. Instead, I'll just make sure that "relative"-# doesn't exit in error-#-#cat >expected <<\EOF-#-#EOF-# test_expect_success'Check format "relative" date fields output''-f=relative&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual+'"+# Don't know how to do relative check because I can't know when this+# script is going to be run and can't fake the current time to git,+# and hence can't provide expected output. Instead, I'll just make+# sure that 'relative' doesn't exit in error+"'+h="%(refname) %(committerdate:relative) %(authordate:relative)"&&+t="%(refname) %(taggerdate:relative)"&&+quietgitfor-each-ref--shell--format="$h"refs/heads&&+quietgitfor-each-ref--shell--format="$t"refs/tags'-cat>expected<<\EOF-'refs/heads/master''2006-07-03''2006-07-03'-'refs/tags/testtag''2006-07-03'-EOF- test_expect_success'Check format "short" date fields output''-f=short&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF+'refs/heads/master''2006-07-03''2006-07-03'+'refs/tags/testtag''2006-07-03'+EOF+"'+h="%(refname) %(committerdate:short) %(authordate:short)"&&+t="%(refname) %(taggerdate:short)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF-'refs/heads/master''Mon Jul 3 15:18:43 2006''Mon Jul 3 15:18:44 2006'-'refs/tags/testtag''Mon Jul 3 15:18:45 2006'-EOF- test_expect_success'Check format "local" date fields output''-f=local&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF+'refs/heads/master''Mon Jul 3 15:18:43 2006''Mon Jul 3 15:18:44 2006'+'refs/tags/testtag''Mon Jul 3 15:18:45 2006'+EOF+"'+h="%(refname) %(committerdate:local) %(authordate:local)"&&+t="%(refname) %(taggerdate:local)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF-'refs/heads/master''2006-07-03 17:18:43 +0200''2006-07-03 17:18:44 +0200'-'refs/tags/testtag''2006-07-03 17:18:45 +0200'-EOF- test_expect_success'Check format "iso8601" date fields output''-f=iso8601&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF+'refs/heads/master''2006-07-03 17:18:43 +0200''2006-07-03 17:18:44 +0200'+'refs/tags/testtag''2006-07-03 17:18:45 +0200'+EOF+"'+h="%(refname) %(committerdate:iso8601) %(authordate:iso8601)"&&+t="%(refname) %(taggerdate:iso8601)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF-'refs/heads/master''Mon, 3 Jul 2006 17:18:43 +0200''Mon, 3 Jul 2006 17:18:44 +0200'-'refs/tags/testtag''Mon, 3 Jul 2006 17:18:45 +0200'-EOF- test_expect_success'Check format "rfc2822" date fields output''-f=rfc2822&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF+'refs/heads/master''Mon, 3 Jul 2006 17:18:43 +0200''Mon, 3 Jul 2006 17:18:44 +0200'+'refs/tags/testtag''Mon, 3 Jul 2006 17:18:45 +0200'+EOF+"'+h="%(refname) %(committerdate:rfc2822) %(authordate:rfc2822)"&&+t="%(refname) %(taggerdate:rfc2822)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF-refs/heads/master-refs/remotes/origin/master-refs/tags/testtag-EOF- test_expect_success'Verify ascending sort''-gitfor-each-ref--format="%(refname)"--sort=refname>actual&&-test_cmpexpectedactual+cat>expect<<-EOF+refs/heads/master+refs/remotes/origin/master+refs/tags/testtag+EOF+gitfor-each-ref--format="%(refname)"--sort=refname|+test_cmpexpect-'--cat>expected<<\EOF-refs/tags/testtag-refs/remotes/origin/master-refs/heads/master-EOF- test_expect_success'Verify descending sort''-gitfor-each-ref--format="%(refname)"--sort=-refname>actual&&-test_cmpexpectedactual+cat>expect<<-EOF+refs/tags/testtag+refs/remotes/origin/master+refs/heads/master+EOF+gitfor-each-ref--format="%(refname)"--sort=-refname|+test_cmpexpect-'-cat>expected<<\EOF-'refs/heads/master'-'refs/remotes/origin/master'-'refs/tags/testtag'-EOF- test_expect_success'Quoting style: shell''-gitfor-each-ref--shell--format="%(refname)">actual&&-test_cmpexpectedactual+'"+cat>expect<<-EOF+'refs/heads/master'+'refs/remotes/origin/master'+'refs/tags/testtag'+EOF+"'+gitfor-each-ref--shell--format="%(refname)"|+test_cmpexpect-' test_expect_success'Quoting style: perl''-gitfor-each-ref--perl--format="%(refname)">actual&&-test_cmpexpectedactual+gitfor-each-ref--perl--format="%(refname)"|+test_cmpexpect-' test_expect_success'Quoting style: python''-gitfor-each-ref--python--format="%(refname)">actual&&-test_cmpexpectedactual+gitfor-each-ref--python--format="%(refname)"|+test_cmpexpect-'-cat>expected<<\EOF-"refs/heads/master"-"refs/remotes/origin/master"-"refs/tags/testtag"-EOF- test_expect_success'Quoting style: tcl''-gitfor-each-ref--tcl--format="%(refname)">actual&&-test_cmpexpectedactual+cat>expect<<-EOF+"refs/heads/master"+"refs/remotes/origin/master"+"refs/tags/testtag"+EOF+gitfor-each-ref--tcl--format="%(refname)"|+test_cmpexpect-'-foriin"--perl --shell""-s --python""--python --tcl""--tcl --perl";do-test_expect_success"more than one quoting style: $i""-gitfor-each-ref$i2>&1|(readline&&-case\$linein-\"error:morethanonequotingstyle\"*):happy;;-*)false-esac)-"-done--cat>expected<<\EOF-master-testtag-EOF-+test_expect_success'more than one quoting styles''+cat>expect<<-EOF+error:morethanonequotingstyle?+EOF+gitfor-each-ref--perl--shell2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref-s--python2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref--python--tcl2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref--tcl--perl2>&1|head-n1|+test_cmpexpect-+' test_expect_success'Check short refname format''-(gitfor-each-ref--format="%(refname:short)"refs/heads&&-gitfor-each-ref--format="%(refname:short)"refs/tags)>actual&&-test_cmpexpectedactual+cat>expect<<-EOF+master+testtag+EOF+gitfor-each-ref--format="%(refname:short)"refs/headsrefs/tags|+test_cmpexpect-'-cat>expected<<EOF-origin/master-EOF- test_expect_success'Check short upstream format''-gitfor-each-ref--format="%(upstream:short)"refs/heads>actual&&-test_cmpexpectedactual+cat>expect<<-EOF+origin/master+EOF+gitfor-each-ref--format="%(upstream:short)"refs/heads|+test_cmpexpect-'-cat>expected<<EOF-67a36f1-EOF- test_expect_success'Check short objectname format''-gitfor-each-ref--format="%(objectname:short)"refs/heads>actual&&-test_cmpexpectedactual+cat>expect<<-EOF+67a36f1+EOF+gitfor-each-ref--format="%(objectname:short)"refs/heads|+test_cmpexpect-' test_expect_success'Check for invalid refname format''-test_must_failgitfor-each-ref--format="%(refname:INVALID)"+silenttest_must_failgitfor-each-ref--format="%(refname:INVALID)"'-cat>expected<<\EOF-heads/master-tags/master-EOF- test_expect_success'Check ambiguous head and tag refs (strict)''+cat>expect<<-EOF+heads/master+tags/master+EOFgitconfig--boolcore.warnambiguousrefstrue&&-gitcheckout-bnewtag&&+gitcheckout-q-bnewtag&&echo"Using $datestamp">one&&gitaddone&&-gitcommit-m"Branch"&&+gitcommit-q-m"Branch"&&setdate_and_increment&&-gittag-m"Tagging at $datestamp"master&&-gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&-test_cmpexpectedactual+quietgittag-m"Tagging at $datestamp"master&&+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/masterrefs/tags/master|+test_cmpexpect-'-cat>expected<<\EOF-heads/master-master-EOF- test_expect_success'Check ambiguous head and tag refs (loose)''+cat>expect<<-EOF+heads/master+master+EOFgitconfig--boolcore.warnambiguousrefsfalse&&-gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&-test_cmpexpectedactual+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/masterrefs/tags/master|+test_cmpexpect-'-cat>expected<<\EOF-heads/ambiguous-ambiguous-EOF- test_expect_success'Check ambiguous head and tag refs II (loose)''-gitcheckoutmaster&&+cat>expect<<-EOF+heads/ambiguous+ambiguous+EOF+gitcheckout-qmaster&&gittagambiguoustesttag^0&&gitbranchambiguoustesttag^0&&-gitfor-each-ref--format"%(refname:short)"refs/heads/ambiguousrefs/tags/ambiguous>actual&&-test_cmpexpectedactual+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/ambiguousrefs/tags/ambiguous|+test_cmpexpect-' test_expect_success'an unusual tag with an incomplete line''-gittag-m"bogo"bogo&&bogo=$(gitcat-filetagbogo)&&bogo=$(printf"%s""$bogo"|gitmktag)&&gittag-fbogo"$bogo"&&gitfor-each-ref--format"%(body)"refs/tags/bogo-' test_expect_success'create tag with subject and body content''-cat>>msg<<-\EOF&&+cat>msg<<-\EOF&&thesubjectlinefirstbodyline
@@ -395,8 +412,9 @@ test_expect_success 'create tag with multiline subject' 'firstbodylinesecondbodylineEOF-gittag-Fmsgmultiline+quietgittag-Fmsgmultiline'+ test_atomrefs/tags/multilinesubject'first subject line second subject line' test_atomrefs/tags/multilinecontents:subject'first subject line second subject line' test_atomrefs/tags/multilinebody'firstbodyline
@@ -22,9 +30,9 @@ test_expect_success 'Create sample commit with known timestamp' 'setdate_and_increment&&echo"Using $datestamp">one&&gitaddone&&-gitcommit-m"Initial"&&+gitcommit-q-m"Initial"&&setdate_and_increment&&-gittag-a-m"Tagging at $datestamp"testtag+quietgittag-a-m"Tagging at $datestamp"testtag' test_expect_success'Create upstream config''
@@ -115,261 +123,270 @@ test_atom tag contents 'Tagging at 1151939927' test_expect_success'Check invalid atoms names are errors''-test_must_failgitfor-each-ref--format="%(INVALID)"refs/heads+silenttest_must_failgitfor-each-ref--format="%(INVALID)"refs/heads' test_expect_success'Check format specifiers are ignored in naming date atoms''-gitfor-each-ref--format="%(authordate)"refs/heads&&-gitfor-each-ref--format="%(authordate:default) %(authordate)"refs/heads&&-gitfor-each-ref--format="%(authordate) %(authordate:default)"refs/heads&&-gitfor-each-ref--format="%(authordate:default) %(authordate:default)"refs/heads+f1="%(authordate)"&&+f2="%(authordate:default) %(authordate)"&&+f3="%(authordate) %(authordate:default)"&&+f4="%(authordate:default) %(authordate:default)"+quietgitfor-each-ref--format="$f1"refs/heads&&+quietgitfor-each-ref--format="$f2"refs/heads&&+quietgitfor-each-ref--format="$f3"refs/heads&&+quietgitfor-each-ref--format="$f4"refs/heads' test_expect_success'Check valid format specifiers for date fields''-gitfor-each-ref--format="%(authordate:default)"refs/heads&&-gitfor-each-ref--format="%(authordate:relative)"refs/heads&&-gitfor-each-ref--format="%(authordate:short)"refs/heads&&-gitfor-each-ref--format="%(authordate:local)"refs/heads&&-gitfor-each-ref--format="%(authordate:iso8601)"refs/heads&&-gitfor-each-ref--format="%(authordate:rfc2822)"refs/heads+quietgitfor-each-ref--format="%(authordate:default)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:relative)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:short)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:local)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:iso8601)"refs/heads&&+quietgitfor-each-ref--format="%(authordate:rfc2822)"refs/heads' test_expect_success'Check invalid format specifiers are errors''-test_must_failgitfor-each-ref--format="%(authordate:INVALID)"refs/heads+h="%(authordate:INVALID)"&&+silenttest_must_failgitfor-each-ref--format="$h"refs/heads'-cat>expected<<\EOF+test_expect_success'Check unformatted date fields output''+'"+cat>expect<<-EOF&&'refs/heads/master''Mon Jul 3 17:18:43 2006 +0200''Mon Jul 3 17:18:44 2006 +0200''refs/tags/testtag''Mon Jul 3 17:18:45 2006 +0200' EOF--test_expect_success'Check unformatted date fields output''-(gitfor-each-ref--shell--format="%(refname) %(committerdate) %(authordate)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate)"refs/tags)>actual&&-test_cmpexpectedactual+"'+h="%(refname) %(committerdate) %(authordate)"&&+t="%(refname) %(taggerdate)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-' test_expect_success'Check format "default" formatted date fields output''-f=default&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+h="%(refname) %(committerdate:default) %(authordate:default)"&&+t="%(refname) %(taggerdate:default)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-# Don't know how to do relative check because I can't know when this script-# is going to be run and can't fake the current time to git, and hence can't-# provide expected output. Instead, I'll just make sure that "relative"-# doesn't exit in error-#-#cat >expected <<\EOF-#-#EOF-# test_expect_success'Check format "relative" date fields output''-f=relative&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual+'"+# Don't know how to do relative check because I can't know when this+# script is going to be run and can't fake the current time to git,+# and hence can't provide expected output. Instead, I'll just make+# sure that 'relative' doesn't exit in error+"'+h="%(refname) %(committerdate:relative) %(authordate:relative)"&&+t="%(refname) %(taggerdate:relative)"&&+quietgitfor-each-ref--shell--format="$h"refs/heads&&+quietgitfor-each-ref--shell--format="$t"refs/tags'-cat>expected<<\EOF+test_expect_success'Check format "short" date fields output''+'"+cat>expect<<-EOF'refs/heads/master''2006-07-03''2006-07-03''refs/tags/testtag''2006-07-03' EOF--test_expect_success'Check format "short" date fields output''-f=short&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+"'+h="%(refname) %(committerdate:short) %(authordate:short)"&&+t="%(refname) %(taggerdate:short)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Check format "local" date fields output''+'"+cat>expect<<-EOF'refs/heads/master''Mon Jul 3 15:18:43 2006''Mon Jul 3 15:18:44 2006''refs/tags/testtag''Mon Jul 3 15:18:45 2006' EOF--test_expect_success'Check format "local" date fields output''-f=local&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+"'+h="%(refname) %(committerdate:local) %(authordate:local)"&&+t="%(refname) %(taggerdate:local)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Check format "iso8601" date fields output''+'"+cat>expect<<-EOF'refs/heads/master''2006-07-03 17:18:43 +0200''2006-07-03 17:18:44 +0200''refs/tags/testtag''2006-07-03 17:18:45 +0200' EOF--test_expect_success'Check format "iso8601" date fields output''-f=iso8601&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+"'+h="%(refname) %(committerdate:iso8601) %(authordate:iso8601)"&&+t="%(refname) %(taggerdate:iso8601)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Check format "rfc2822" date fields output''+'"+cat>expect<<-EOF'refs/heads/master''Mon, 3 Jul 2006 17:18:43 +0200''Mon, 3 Jul 2006 17:18:44 +0200''refs/tags/testtag''Mon, 3 Jul 2006 17:18:45 +0200' EOF--test_expect_success'Check format "rfc2822" date fields output''-f=rfc2822&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&-test_cmpexpectedactual+"'+h="%(refname) %(committerdate:rfc2822) %(authordate:rfc2822)"&&+t="%(refname) %(taggerdate:rfc2822)"&&+(gitfor-each-ref--shell--format="$h"refs/heads&&+gitfor-each-ref--shell--format="$t"refs/tags)|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Verify ascending sort''+cat>expect<<-EOF refs/heads/master refs/remotes/origin/master refs/tags/testtag EOF--test_expect_success'Verify ascending sort''-gitfor-each-ref--format="%(refname)"--sort=refname>actual&&-test_cmpexpectedactual+gitfor-each-ref--format="%(refname)"--sort=refname|+test_cmpexpect-'--cat>expected<<\EOF+test_expect_success'Verify descending sort''+cat>expect<<-EOF refs/tags/testtag refs/remotes/origin/master refs/heads/master EOF--test_expect_success'Verify descending sort''-gitfor-each-ref--format="%(refname)"--sort=-refname>actual&&-test_cmpexpectedactual+gitfor-each-ref--format="%(refname)"--sort=-refname|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Quoting style: shell''+'"+cat>expect<<-EOF'refs/heads/master''refs/remotes/origin/master''refs/tags/testtag' EOF--test_expect_success'Quoting style: shell''-gitfor-each-ref--shell--format="%(refname)">actual&&-test_cmpexpectedactual+"'+gitfor-each-ref--shell--format="%(refname)"|+test_cmpexpect-' test_expect_success'Quoting style: perl''-gitfor-each-ref--perl--format="%(refname)">actual&&-test_cmpexpectedactual+gitfor-each-ref--perl--format="%(refname)"|+test_cmpexpect-' test_expect_success'Quoting style: python''-gitfor-each-ref--python--format="%(refname)">actual&&-test_cmpexpectedactual+gitfor-each-ref--python--format="%(refname)"|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Quoting style: tcl''+cat>expect<<-EOF"refs/heads/master""refs/remotes/origin/master""refs/tags/testtag" EOF--test_expect_success'Quoting style: tcl''-gitfor-each-ref--tcl--format="%(refname)">actual&&-test_cmpexpectedactual+gitfor-each-ref--tcl--format="%(refname)"|+test_cmpexpect-'-foriin"--perl --shell""-s --python""--python --tcl""--tcl --perl";do-test_expect_success"more than one quoting style: $i""-gitfor-each-ref$i2>&1|(readline&&-case\$linein-\"error:morethanonequotingstyle\"*):happy;;-*)false-esac)-"-done--cat>expected<<\EOF+test_expect_success'more than one quoting styles''+cat>expect<<-EOF+error:morethanonequotingstyle?+EOF+gitfor-each-ref--perl--shell2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref-s--python2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref--python--tcl2>&1|head-n1|+test_cmpexpect-&&+gitfor-each-ref--tcl--perl2>&1|head-n1|+test_cmpexpect-+'+test_expect_success'Check short refname format''+cat>expect<<-EOF master testtag EOF--test_expect_success'Check short refname format''-(gitfor-each-ref--format="%(refname:short)"refs/heads&&-gitfor-each-ref--format="%(refname:short)"refs/tags)>actual&&-test_cmpexpectedactual+gitfor-each-ref--format="%(refname:short)"refs/headsrefs/tags|+test_cmpexpect-'-cat>expected<<EOF+test_expect_success'Check short upstream format''+cat>expect<<-EOF origin/master EOF--test_expect_success'Check short upstream format''-gitfor-each-ref--format="%(upstream:short)"refs/heads>actual&&-test_cmpexpectedactual+gitfor-each-ref--format="%(upstream:short)"refs/heads|+test_cmpexpect-'-cat>expected<<EOF+test_expect_success'Check short objectname format''+cat>expect<<-EOF 67a36f1 EOF--test_expect_success'Check short objectname format''-gitfor-each-ref--format="%(objectname:short)"refs/heads>actual&&-test_cmpexpectedactual+gitfor-each-ref--format="%(objectname:short)"refs/heads|+test_cmpexpect-' test_expect_success'Check for invalid refname format''-test_must_failgitfor-each-ref--format="%(refname:INVALID)"+silenttest_must_failgitfor-each-ref--format="%(refname:INVALID)"'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs (strict)''+cat>expect<<-EOF heads/master tags/master EOF--test_expect_success'Check ambiguous head and tag refs (strict)''gitconfig--boolcore.warnambiguousrefstrue&&-gitcheckout-bnewtag&&+gitcheckout-q-bnewtag&&echo"Using $datestamp">one&&gitaddone&&-gitcommit-m"Branch"&&+gitcommit-q-m"Branch"&&setdate_and_increment&&-gittag-m"Tagging at $datestamp"master&&-gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&-test_cmpexpectedactual+quietgittag-m"Tagging at $datestamp"master&&+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/masterrefs/tags/master|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs (loose)''+cat>expect<<-EOF heads/master master EOF--test_expect_success'Check ambiguous head and tag refs (loose)''gitconfig--boolcore.warnambiguousrefsfalse&&-gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&-test_cmpexpectedactual+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/masterrefs/tags/master|+test_cmpexpect-'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs II (loose)''+cat>expect<<-EOF heads/ambiguous ambiguous EOF--test_expect_success'Check ambiguous head and tag refs II (loose)''-gitcheckoutmaster&&+gitcheckout-qmaster&&gittagambiguoustesttag^0&&gitbranchambiguoustesttag^0&&-gitfor-each-ref--format"%(refname:short)"refs/heads/ambiguousrefs/tags/ambiguous>actual&&-test_cmpexpectedactual+f="%(refname:short)"&&+gitfor-each-ref--format"$f"refs/heads/ambiguousrefs/tags/ambiguous|+test_cmpexpect-' test_expect_success'an unusual tag with an incomplete line''-gittag-m"bogo"bogo&&bogo=$(gitcat-filetagbogo)&&bogo=$(printf"%s""$bogo"|gitmktag)&&gittag-fbogo"$bogo"&&gitfor-each-ref--format"%(body)"refs/tags/bogo-' test_expect_success'create tag with subject and body content''-cat>>msg<<-\EOF&&+cat>msg<<-\EOF&&thesubjectlinefirstbodyline
@@ -395,8 +412,9 @@ test_expect_success 'create tag with multiline subject' 'firstbodylinesecondbodylineEOF-gittag-Fmsgmultiline+quietgittag-Fmsgmultiline'+ test_atomrefs/tags/multilinesubject'first subject line second subject line' test_atomrefs/tags/multilinecontents:subject'first subject line second subject line' test_atomrefs/tags/multilinebody'firstbodyline
@@ -51,7 +59,7 @@ test_expect_success 'ls-remote self' ' test_expect_success'dies when no remote specified and no default remotes found''-test_must_failgitls-remote+silenttest_must_failgitls-remote'
@@ -70,8 +78,8 @@ test_expect_success 'use "origin" when no remote specified' ' test_expect_success'suppress "From <url>" with -q''-gitls-remote-q2>actual_err&&-test_must_failtest_cmpexp_erractual_err+quietgitls-remote-q2>actual_err&&+test_must_failcmp-sexp_erractual_err'
@@ -83,7 +91,7 @@ test_expect_success 'use branch.<name>.remote if possible' '## setup a new remote to differentiate from "origin"-gitclone.other.git&&+gitclone-q.other.git&&(cdother.git&&echo"$(gitrev-parseHEAD) HEAD"
@@ -102,11 +110,13 @@ test_expect_success 'use branch.<name>.remote if possible' ''-cat>exp<<EOF+test_expect_success'confuses pattern as remote when no remote specified''+'"+cat>exp<<-EOF fatal:'refs*master'doesnotappeartobeagitrepository fatal:Theremoteendhungupunexpectedly EOF-test_expect_success'confuses pattern as remote when no remote specified''+"'## Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,# confuses <pattern> for <remote>. Although ugly, this behaviour is akin
@@ -124,7 +134,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '' test_expect_success'die with non-2 for wrong repository even with --exit-code''-gitls-remote--exit-code./no-such-repository;# not &&+silentgitls-remote--exit-code./no-such-repository;# not &&status=$?&&test$status!=2&&test$status!=0'
@@ -136,7 +146,8 @@ test_expect_success 'Report success even when nothing matches' '' test_expect_success'Report no-match with --exit-code''-test_expect_code2gitls-remote--exit-codeother.git"refs/nsn/*">actual&&+test_expect_code2gitls-remote--exit-codeother.git"refs/nsn/*"\+>actual&&>expect&&test_cmpexpectactual'
@@ -5,125 +5,132 @@test_description='git branch assorted tests'+if!test-rtest-lib.sh;then+(cd${0%/*}&&./${0##*/}$@)+exit$?+fi+ ../test-lib.sh-test_expect_success\-'prepare a trivial repository'\-'echoHello>A&&-gitupdate-index--addA&&-gitcommit-m"Initial commit."&&-echoWorld>>A&&-gitupdate-index--addA&&-gitcommit-m"Second commit."&&-HEAD=$(gitrev-parse--verifyHEAD)'+quiet(){"$@">/dev/null;}+silent(){"$@">/dev/null2>&1;}+here(){sed's/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'$@;}++test_expect_success'prepare a trivial repository''+echoHello>A&&+gitupdate-index--addA&&+gitcommit-q-m"Initial commit."&&+echoWorld>>A&&+gitupdate-index--addA&&+gitcommit-q-m"Second commit."&&+HEAD=$(gitrev-parse--verifyHEAD)+'-test_expect_success\-'git branch --help should not have created a bogus branch''-test_might_failgitbranch--help</dev/null>/dev/null2>/dev/null&&-test_path_is_missing.git/refs/heads/--help+test_expect_success'git branch --help should not have created a bogus branch''+silenttest_might_failgitbranch--help</dev/null&&+test_path_is_missing.git/refs/heads/--help' test_expect_success'branch -h in broken repository''-mkdirbroken&&-(-cdbroken&&-gitinit&&->.git/refs/heads/master&&-test_expect_code129gitbranch-h>usage2>&1-)&&-grep"[Uu]sage"broken/usage-'--test_expect_success\-'git branch abc should create a branch'\-'git branch abc && test_path_is_file .git/refs/heads/abc'--test_expect_success\-'git branch a/b/c should create a branch'\-'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'--cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster-EOF-test_expect_success\-'git branch -l d/e/f should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitbranch-ld/e/f&&-test_path_is_file.git/refs/heads/d/e/f&&-test_path_is_file.git/logs/refs/heads/d/e/f&&-test_cmpexpect.git/logs/refs/heads/d/e/f'--test_expect_success\-'git branch -d d/e/f should delete a branch and a log'\-'gitbranch-dd/e/f&&-test_path_is_missing.git/refs/heads/d/e/f&&-test_path_is_missing.git/logs/refs/heads/d/e/f'--test_expect_success\-'git branch j/k should work after branch j has been deleted'\-'gitbranchj&&-gitbranch-dj&&-gitbranchj/k'--test_expect_success\-'git branch l should work after branch l/m has been deleted'\-'gitbranchl/m&&-gitbranch-dl/m&&-gitbranchl'--test_expect_success\-'git branch -m dumps usage'\-'test_expect_code129gitbranch-m2>err&&-grep"[Uu]sage: git branch"err'--test_expect_success\-'git branch -m m m/m should work'\-'gitbranch-lm&&-gitbranch-mmm/m&&-test_path_is_file.git/logs/refs/heads/m/m'--test_expect_success\-'git branch -m n/n n should work'\-'gitbranch-ln/n&&+gitinit-qbroken&&+test_when_finishedrm-rfbrokenusage&&+>broken/.git/refs/heads/master&&+>usage2>&1test_expect_code129git--git-dir=broken/.gitbranch-h&&+grep-q"[Uu]sage"usage+'++test_expect_success'git branch abc should create a branch''+gitbranchabc&&test_path_is_file.git/refs/heads/abc+'++test_expect_success'git branch a/b/c should create a branch''+gitbrancha/b/c&&test_path_is_file.git/refs/heads/a/b/c+'++test_expect_success'git branch -l d/e/f should create a branch and a log''+id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"+date="1117150200 +0000"+msg="branch: Created from master"+here>expect<<-EOF+$_z40$HEAD$id$date\t$msg+EOF+GIT_COMMITTER_DATE="2005-05-26 23:30"gitbranch-ld/e/f&&+test_path_is_file.git/refs/heads/d/e/f&&+test_path_is_file.git/logs/refs/heads/d/e/f&&+test_cmpexpect.git/logs/refs/heads/d/e/f+'++test_expect_success'git branch -d d/e/f should delete a branch and a log''+quietgitbranch-dd/e/f&&+test_path_is_missing.git/refs/heads/d/e/f&&+test_path_is_missing.git/logs/refs/heads/d/e/f+'++test_expect_success'git branch j/k should work after branch j has been deleted''+gitbranchj&&+quietgitbranch-dj&&+gitbranchj/k+'++test_expect_success'git branch l should work after branch l/m has been deleted''+gitbranchl/m&&+quietgitbranch-dl/m&&+gitbranchl+'++test_expect_success'git branch -m dumps usage''+test_expect_code129gitbranch-m2>err&&+grep-q"[Uu]sage: git branch"err+'++test_expect_success'git branch -m m m/m should work''+gitbranch-lm&&+gitbranch-mmm/m&&+test_path_is_file.git/logs/refs/heads/m/m+'++test_expect_success'git branch -m n/n n should work''+gitbranch-ln/n&&gitbranch-mn/nn&&-test_path_is_file.git/logs/refs/heads/n'+test_path_is_file.git/logs/refs/heads/n+' test_expect_success'git branch -m o/o o should fail when o/p exists''gitbrancho/o&&-gitbrancho/p&&-test_must_failgitbranch-mo/oo+gitbrancho/p&&+silenttest_must_failgitbranch-mo/oo' test_expect_success'git branch -m q r/q should fail when r exists''gitbranchq&&gitbranchr&&-test_must_failgitbranch-mqr/q+silenttest_must_failgitbranch-mqr/q' test_expect_success'git branch -M foo bar should fail when bar is checked out''gitbranchbar&&-gitcheckout-bfoo&&-test_must_failgitbranch-Mbarfoo+gitcheckout-q-bfoo&&+silenttest_must_failgitbranch-Mbarfoo' test_expect_success'git branch -M baz bam should succeed when baz is checked out''-gitcheckout-bbaz&&+gitcheckout-q-bbaz&&gitbranchbam&&gitbranch-Mbazbam' test_expect_success'git branch -M master should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranch-Mmaster' test_expect_success'git branch -M master master should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranch-Mmastermaster' test_expect_success'git branch -M master2 master2 should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranchmaster2&&gitbranch-Mmaster2master2'
@@ -131,7 +138,7 @@ test_expect_success 'git branch -M master2 master2 should work when master is ch test_expect_success'git branch -v -d t should work''gitbrancht&&test_path_is_file.git/refs/heads/t&&-gitbranch-v-dt&&+quietgitbranch-v-dt&&test_path_is_missing.git/refs/heads/t'
@@ -141,188 +148,198 @@ test_expect_success 'git branch -v -m t s should work' 'gitbranch-v-mts&&test_path_is_missing.git/refs/heads/t&&test_path_is_file.git/refs/heads/s&&-gitbranch-ds+quietgitbranch-ds' test_expect_success'git branch -m -d t s should fail''gitbrancht&&test_path_is_file.git/refs/heads/t&&-test_must_failgitbranch-m-dts&&-gitbranch-dt&&+silenttest_must_failgitbranch-m-dts&&+quietgitbranch-dt&&test_path_is_missing.git/refs/heads/t' test_expect_success'git branch --list -d t should fail''gitbrancht&&test_path_is_file.git/refs/heads/t&&-test_must_failgitbranch--list-dt&&-gitbranch-dt&&+silenttest_must_failgitbranch--list-dt&&+quietgitbranch-dt&&test_path_is_missing.git/refs/heads/t'-mv.git/config.git/config-saved- test_expect_success'git branch -m q q2 without config should succeed''+mv.git/config.git/config-saved&&+test_when_finishedmv.git/config-saved.git/config&&gitbranch-mqq2&&gitbranch-mq2q'-mv.git/config-saved.git/config--gitconfigbranch.s/s.dummyHello--test_expect_success\-'git branch -m s/s s should work when s/t is deleted'\-'gitbranch-ls/s&&+test_expect_success'git branch -m s/s s should work when s/t is deleted''+gitconfigbranch.s/s.dummyHello+gitbranch-ls/s&&test_path_is_file.git/logs/refs/heads/s/s&&-gitbranch-ls/t&&+gitbranch-ls/t&&test_path_is_file.git/logs/refs/heads/s/t&&-gitbranch-ds/t&&-gitbranch-ms/ss&&-test_path_is_file.git/logs/refs/heads/s'--test_expect_success'config information was renamed, too'\-"test $(gitconfigbranch.s.dummy) = Hello &&-test_must_failgitconfigbranch.s/s/dummy"+quietgitbranch-ds/t&&+gitbranch-ms/ss&&+test_path_is_file.git/logs/refs/heads/s+'-test_expect_success'renaming a symref is not allowed'\+test_expect_success'config information was renamed, too''+test$(gitconfigbranch.s.dummy)=Hello&&+silenttest_must_failgitconfigbranch.s/s/dummy'++test_expect_success'renaming a symref is not allowed''gitsymbolic-refrefs/heads/master2refs/heads/master&&-test_must_failgitbranch-mmaster2master3&&-gitsymbolic-refrefs/heads/master2&&+silenttest_must_failgitbranch-mmaster2master3&&+quietgitsymbolic-refrefs/heads/master2&&test_path_is_file.git/refs/heads/master&&test_path_is_missing.git/refs/heads/master3'-test_expect_successSYMLINKS\-'git branch -m u v should fail when the reflog for u is a symlink''-gitbranch-lu&&-mv.git/logs/refs/heads/ureal-u&&-ln-sreal-u.git/logs/refs/heads/u&&-test_must_failgitbranch-muv-'--test_expect_success'test tracking setup via --track'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy1local/master&&-test$(gitconfigbranch.my1.remote)=local&&-test$(gitconfigbranch.my1.merge)=refs/heads/master'--test_expect_success'test tracking setup (non-wildcard, matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/master:refs/remotes/local/master&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy4local/master&&-test$(gitconfigbranch.my4.remote)=local&&-test$(gitconfigbranch.my4.merge)=refs/heads/master'--test_expect_success'test tracking setup (non-wildcard, not matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy5local/master&&-!test"$(gitconfigbranch.my5.remote)"=local&&-!test"$(gitconfigbranch.my5.merge)"=refs/heads/master'--test_expect_success'test tracking setup via config'\-'gitconfigbranch.autosetupmergetrue&&-gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranchmy3local/master&&-test$(gitconfigbranch.my3.remote)=local&&-test$(gitconfigbranch.my3.merge)=refs/heads/master'--test_expect_success'test overriding tracking setup via --no-track'\-'gitconfigbranch.autosetupmergetrue&&-gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmy2local/master&&-gitconfigbranch.autosetupmergefalse&&-!test"$(gitconfigbranch.my2.remote)"=local&&-!test"$(gitconfigbranch.my2.merge)"=refs/heads/master'--test_expect_success'no tracking without .fetch entries'\-'gitconfigbranch.autosetupmergetrue&&-gitbranchmy6s&&-gitconfigbranch.automsetupmergefalse&&-test-z"$(gitconfigbranch.my6.remote)"&&-test-z"$(gitconfigbranch.my6.merge)"'--test_expect_success'test tracking setup via --track but deeper'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&-gitbranch--trackmy7local/o/o&&-test"$(gitconfigbranch.my7.remote)"=local&&-test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o'--test_expect_success'test deleting branch deletes branch config'\-'gitbranch-dmy7&&-test-z"$(gitconfigbranch.my7.remote)"&&-test-z"$(gitconfigbranch.my7.merge)"'--test_expect_success'test deleting branch without config'\-'gitbranchmy7s&&-sha1=$(gitrev-parsemy7|cut-c1-7)&&-echo"Deleted branch my7 (was $sha1).">expect&&-gitbranch-dmy7>actual2>&1&&-test_i18ncmpexpectactual'--test_expect_success'test --track without .fetch entries'\-'gitbranch--trackmy8&&-test"$(gitconfigbranch.my8.remote)"&&-test"$(gitconfigbranch.my8.merge)"'--test_expect_success\-'branch from non-branch HEAD w/autosetupmerge=always'\-'gitconfigbranch.autosetupmergealways&&-gitbranchmy9HEAD^&&-gitconfigbranch.autosetupmergefalse'--test_expect_success\-'branch from non-branch HEAD w/--track causes failure'\-'test_must_fail git branch --track my10 HEAD^'--test_expect_success\-'branch from tag w/--track causes failure'\-'gittagfoobar&&-test_must_failgitbranch--trackmy11foobar'+test_expect_successSYMLINKS'git branch -m u v should fail when the reflog for u is a symlink''+gitbranch-lu&&+mv.git/logs/refs/heads/ureal-u&&+ln-sreal-u.git/logs/refs/heads/u&&+silenttest_must_failgitbranch-muv+'++test_expect_success'test tracking setup via --track''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmy1local/master&&+test$(gitconfigbranch.my1.remote)=local&&+test$(gitconfigbranch.my1.merge)=refs/heads/master+'++test_expect_success'test tracking setup (non-wildcard, matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetch\+refs/heads/master:refs/remotes/local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+quietgitbranch--trackmy4local/master&&+test$(gitconfigbranch.my4.remote)=local&&+test$(gitconfigbranch.my4.merge)=refs/heads/master+'++test_expect_success'test tracking setup (non-wildcard, not matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+quietgitbranch--trackmy5local/master&&+!test"$(gitconfigbranch.my5.remote)"=local&&+!test"$(gitconfigbranch.my5.merge)"=refs/heads/master+'++test_expect_success'test tracking setup via config''+gitconfigbranch.autosetupmergetrue&&+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+quietgitbranchmy3local/master&&+test$(gitconfigbranch.my3.remote)=local&&+test$(gitconfigbranch.my3.merge)=refs/heads/master+'++test_expect_success'test overriding tracking setup via --no-track''+gitconfigbranch.autosetupmergetrue&&+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranch--no-trackmy2local/master&&+gitconfigbranch.autosetupmergefalse&&+!test"$(gitconfigbranch.my2.remote)"=local&&+!test"$(gitconfigbranch.my2.merge)"=refs/heads/master+'++test_expect_success'no tracking without .fetch entries''+gitconfigbranch.autosetupmergetrue&&+gitbranchmy6s&&+gitconfigbranch.automsetupmergefalse&&+test-z"$(gitconfigbranch.my6.remote)"&&+test-z"$(gitconfigbranch.my6.merge)"+'++test_expect_success'test tracking setup via --track but deeper''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&+quietgitbranch--trackmy7local/o/o&&+test"$(gitconfigbranch.my7.remote)"=local&&+test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o+'++test_expect_success'test deleting branch deletes branch config''+quietgitbranch-dmy7&&+test-z"$(gitconfigbranch.my7.remote)"&&+test-z"$(gitconfigbranch.my7.merge)"+'++test_expect_success'test deleting branch without config''+gitbranchmy7s&&+sha1=$(gitrev-parsemy7|cut-c1-7)&&+echo"Deleted branch my7 (was $sha1).">expect&&+gitbranch-dmy7>actual2>&1&&+test_i18ncmpexpectactual+'++test_expect_success'test --track without .fetch entries''+quietgitbranch--trackmy8&&+test"$(gitconfigbranch.my8.remote)"&&+test"$(gitconfigbranch.my8.merge)"+'++test_expect_success'branch from non-branch HEAD w/autosetupmerge=always''+gitconfigbranch.autosetupmergealways&&+gitbranchmy9HEAD^&&+gitconfigbranch.autosetupmergefalse+'++test_expect_success'branch from non-branch HEAD w/--track causes failure''+silenttest_must_failgitbranch--trackmy10HEAD^+'++test_expect_success'branch from tag w/--track causes failure''+gittagfoobar&&+silenttest_must_failgitbranch--trackmy11foobar+'# Keep this test last, as it changes the current branch-cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster-EOF-test_expect_success\-'git checkout -b g/h/i -l should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitcheckout-bg/h/i-lmaster&&-test_path_is_file.git/refs/heads/g/h/i&&-test_path_is_file.git/logs/refs/heads/g/h/i&&-test_cmpexpect.git/logs/refs/heads/g/h/i'+test_expect_success'git checkout -b g/h/i -l should create a branch and a log''+id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"+date="1117150200 +0000"+msg="branch: Created from master"+here>expect<<-EOF+$_z40$HEAD$id$date\t$msg+EOF+GIT_COMMITTER_DATE="2005-05-26 23:30"\+gitcheckout-q-bg/h/i-lmaster&&+test_path_is_file.git/refs/heads/g/h/i&&+test_path_is_file.git/logs/refs/heads/g/h/i&&+test_cmpexpect.git/logs/refs/heads/g/h/i+' test_expect_success'checkout -b makes reflog by default''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitconfig--unsetcore.logAllRefUpdates&&-gitcheckout-balpha&&-gitrev-parse--verifyalpha@{0}+gitcheckout-q-balpha&&+quietgitrev-parse--verifyalpha@{0}' test_expect_success'checkout -b does not make reflog when core.logAllRefUpdates = false''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitconfigcore.logAllRefUpdatesfalse&&-gitcheckout-bbeta&&-test_must_failgitrev-parse--verifybeta@{0}+gitcheckout-q-bbeta&&+silenttest_must_failgitrev-parse--verifybeta@{0}' test_expect_success'checkout -b with -l makes reflog when core.logAllRefUpdates = false''-gitcheckoutmaster&&-gitcheckout-lbgamma&&+gitcheckout-qmaster&&+gitcheckout-q-lbgamma&&gitconfig--unsetcore.logAllRefUpdates&&-gitrev-parse--verifygamma@{0}+quietgitrev-parse--verifygamma@{0}' test_expect_success'avoid ambiguous track''
@@ -339,9 +356,9 @@ test_expect_success 'autosetuprebase local on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaselocal&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase&&-gitbranch--trackmyr1mybase&&+quietgitbranch--trackmyr1mybase&&test"$(gitconfigbranch.myr1.remote)"=.&&test"$(gitconfigbranch.myr1.merge)"=refs/heads/mybase&&test"$(gitconfigbranch.myr1.rebase)"=true
@@ -351,9 +368,9 @@ test_expect_success 'autosetuprebase always on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasealways&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase2&&-gitbranch--trackmyr2mybase&&+quietgitbranch--trackmyr2mybase&&test"$(gitconfigbranch.myr2.remote)"=.&&test"$(gitconfigbranch.myr2.merge)"=refs/heads/mybase&&test"$(gitconfigbranch.myr2.rebase)"=true
@@ -363,9 +380,9 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase3&&-gitbranch--trackmyr3mybase2&&+quietgitbranch--trackmyr3mybase2&&test"$(gitconfigbranch.myr3.remote)"=.&&test"$(gitconfigbranch.myr3.merge)"=refs/heads/mybase2&&!test"$(gitconfigbranch.myr3.rebase)"=true
@@ -375,9 +392,9 @@ test_expect_success 'autosetuprebase never on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasenever&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase4&&-gitbranch--trackmyr4mybase2&&+quietgitbranch--trackmyr4mybase2&&test"$(gitconfigbranch.myr4.remote)"=.&&test"$(gitconfigbranch.myr4.merge)"=refs/heads/mybase2&&!test"$(gitconfigbranch.myr4.rebase)"=true
@@ -387,8 +404,8 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaselocal&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr5local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr5local/master&&test"$(gitconfigbranch.myr5.remote)"=local&&test"$(gitconfigbranch.myr5.merge)"=refs/heads/master&&!test"$(gitconfigbranch.myr5.rebase)"=true
@@ -398,8 +415,8 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasenever&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr6local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr6local/master&&test"$(gitconfigbranch.myr6.remote)"=local&&test"$(gitconfigbranch.myr6.merge)"=refs/heads/master&&!test"$(gitconfigbranch.myr6.rebase)"=true
@@ -409,8 +426,8 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr7local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr7local/master&&test"$(gitconfigbranch.myr7.remote)"=local&&test"$(gitconfigbranch.myr7.merge)"=refs/heads/master&&test"$(gitconfigbranch.myr7.rebase)"=true
@@ -420,8 +437,8 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr8local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr8local/master&&test"$(gitconfigbranch.myr8.remote)"=local&&test"$(gitconfigbranch.myr8.merge)"=refs/heads/master&&test"$(gitconfigbranch.myr8.rebase)"=true
@@ -431,8 +448,8 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' 'gitconfig--unsetbranch.autosetuprebase&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr9local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr9local/master&&test"$(gitconfigbranch.myr9.remote)"=local&&test"$(gitconfigbranch.myr9.merge)"=refs/heads/master&&test"z$(gitconfigbranch.myr9.rebase)"=z
@@ -441,9 +458,9 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' ' test_expect_success'autosetuprebase unconfigured on a tracked local branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase10&&-gitbranch--trackmyr10mybase2&&+quietgitbranch--trackmyr10mybase2&&test"$(gitconfigbranch.myr10.remote)"=.&&test"$(gitconfigbranch.myr10.merge)"=refs/heads/mybase2&&test"z$(gitconfigbranch.myr10.rebase)"=z
@@ -452,8 +469,8 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' test_expect_success'autosetuprebase unconfigured on untracked local branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr11mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr11mybase2&&test"z$(gitconfigbranch.myr11.remote)"=z&&test"z$(gitconfigbranch.myr11.merge)"=z&&test"z$(gitconfigbranch.myr11.rebase)"=z
@@ -462,8 +479,8 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' test_expect_success'autosetuprebase unconfigured on untracked remote branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr12local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr12local/master&&test"z$(gitconfigbranch.myr12.remote)"=z&&test"z$(gitconfigbranch.myr12.merge)"=z&&test"z$(gitconfigbranch.myr12.rebase)"=z
@@ -473,8 +490,8 @@ test_expect_success 'autosetuprebase never on an untracked local branch' 'gitconfigbranch.autosetuprebasenever&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr13mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr13mybase2&&test"z$(gitconfigbranch.myr13.remote)"=z&&test"z$(gitconfigbranch.myr13.merge)"=z&&test"z$(gitconfigbranch.myr13.rebase)"=z
@@ -484,8 +501,8 @@ test_expect_success 'autosetuprebase local on an untracked local branch' 'gitconfigbranch.autosetuprebaselocal&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr14mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr14mybase2&&test"z$(gitconfigbranch.myr14.remote)"=z&&test"z$(gitconfigbranch.myr14.merge)"=z&&test"z$(gitconfigbranch.myr14.rebase)"=z
@@ -495,8 +512,8 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' 'gitconfigbranch.autosetuprebaseremote&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr15mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr15mybase2&&test"z$(gitconfigbranch.myr15.remote)"=z&&test"z$(gitconfigbranch.myr15.merge)"=z&&test"z$(gitconfigbranch.myr15.rebase)"=z
@@ -506,8 +523,8 @@ test_expect_success 'autosetuprebase always on an untracked local branch' 'gitconfigbranch.autosetuprebasealways&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr16mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr16mybase2&&test"z$(gitconfigbranch.myr16.remote)"=z&&test"z$(gitconfigbranch.myr16.merge)"=z&&test"z$(gitconfigbranch.myr16.rebase)"=z
@@ -517,8 +534,8 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' 'gitconfigbranch.autosetuprebasenever&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr17local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr17local/master&&test"z$(gitconfigbranch.myr17.remote)"=z&&test"z$(gitconfigbranch.myr17.merge)"=z&&test"z$(gitconfigbranch.myr17.rebase)"=z
@@ -528,8 +545,8 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' 'gitconfigbranch.autosetuprebaselocal&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr18local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr18local/master&&test"z$(gitconfigbranch.myr18.remote)"=z&&test"z$(gitconfigbranch.myr18.merge)"=z&&test"z$(gitconfigbranch.myr18.rebase)"=z
@@ -539,8 +556,8 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' 'gitconfigbranch.autosetuprebaseremote&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr19local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr19local/master&&test"z$(gitconfigbranch.myr19.remote)"=z&&test"z$(gitconfigbranch.myr19.merge)"=z&&test"z$(gitconfigbranch.myr19.rebase)"=z
@@ -550,8 +567,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' 'gitconfigbranch.autosetuprebasealways&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr20local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr20local/master&&test"z$(gitconfigbranch.myr20.remote)"=z&&test"z$(gitconfigbranch.myr20.merge)"=z&&test"z$(gitconfigbranch.myr20.rebase)"=z
@@ -559,8 +576,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' ' test_expect_success'autosetuprebase always on detached HEAD''gitconfigbranch.autosetupmergealways&&-test_when_finishedgitcheckoutmaster&&-gitcheckoutHEAD^0&&+test_when_finishedgitcheckout-qmaster&&+gitcheckout-qHEAD^0&&gitbranchmy11&&test-z"$(gitconfigbranch.my11.remote)"&&test-z"$(gitconfigbranch.my11.merge)"
@@ -568,20 +585,20 @@ test_expect_success 'autosetuprebase always on detached HEAD' ' test_expect_success'detect misconfigured autosetuprebase (bad value)''gitconfigbranch.autosetuprebasegarbage&&-test_must_failgitbranch+silenttest_must_failgitbranch' test_expect_success'detect misconfigured autosetuprebase (no value)''gitconfig--unsetbranch.autosetuprebase&&echo"[branch] autosetuprebase">>.git/config&&-test_must_failgitbranch&&+silenttest_must_failgitbranch&&gitconfig--unsetbranch.autosetuprebase' test_expect_success'attempt to delete a branch without base and unmerged to HEAD''-gitcheckoutmy9&&+gitcheckout-qmy9&&gitconfig--unsetbranch.my8.merge&&-test_must_failgitbranch-dmy8+silenttest_must_failgitbranch-dmy8' test_expect_success'attempt to delete a branch merged to its base''
@@ -589,32 +606,30 @@ test_expect_success 'attempt to delete a branch merged to its base' '# we would not have allowed deleting my8 that is not merged# to my9, but it is set to track master that already has my8gitconfigbranch.my8.mergerefs/heads/master&&-gitbranch-dmy8+silentgitbranch-dmy8' test_expect_success'attempt to delete a branch merged to its base''-gitcheckoutmaster&&+gitcheckout-qmaster&&echoThird>>A&&-gitcommit-m"Third commit"A&&-gitbranch-tmy10my9&&-gitbranch-fmy10HEAD^&&+gitcommit-q-m"Third commit"A&&+quietgitbranch-tmy10my9&&+quietgitbranch-fmy10HEAD^&&# we are on master which is at the third commit, and my10# is behind us, so traditionally we would have allowed deleting# it; but my10 is set to track my9 that is further behind.-test_must_failgitbranch-dmy10+silenttest_must_failgitbranch-dmy10' test_expect_success'use set-upstream on the current branch''-gitcheckoutmaster&&-git--bareinitmyupstream.git&&-gitpushmyupstream.gitmaster:refs/heads/frotz&&+gitcheckout-qmaster&&+git--bareinit-qmyupstream.git&&+gitpush-qmyupstream.gitmaster:refs/heads/frotz&&gitremoteaddoriginmyupstream.git&&-gitfetch&&-gitbranch--set-upstreammasterorigin/frotz&&-+gitfetch-q&&+quietgitbranch--set-upstreammasterorigin/frotz&&test"z$(gitconfigbranch.master.remote)"="zorigin"&&test"z$(gitconfigbranch.master.merge)"="zrefs/heads/frotz"-' test_expect_success'use --edit-description''
@@ -637,7 +652,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '(EDITOR=./editor&&exportEDITOR&&-test_must_failgitbranch--edit-descriptionno-such-branch+silenttest_must_failgitbranch--edit-descriptionno-such-branch)'
@@ -645,11 +660,11 @@ test_expect_success 'refuse --edit-description on unborn branch for now' 'write_scripteditor<<-\EOF&&echo"New contents">"$1"EOF-gitcheckout--orphanunborn&&+gitcheckout-q--orphanunborn&&(EDITOR=./editor&&exportEDITOR&&-test_must_failgitbranch--edit-description+silenttest_must_failgitbranch--edit-description)'
@@ -5,125 +5,132 @@test_description='git branch assorted tests'+if!test-rtest-lib.sh;then+(cd${0%/*}&&./${0##*/}$@)+exit$?+fi+ ../test-lib.sh-test_expect_success\-'prepare a trivial repository'\-'echoHello>A&&+quiet(){"$@">/dev/null;}+silent(){"$@">/dev/null2>&1;}+here(){sed's/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'$@;}++test_expect_success'prepare a trivial repository''+echoHello>A&&gitupdate-index--addA&&-gitcommit-m"Initial commit."&&+gitcommit-q-m"Initial commit."&&echoWorld>>A&&gitupdate-index--addA&&-gitcommit-m"Second commit."&&-HEAD=$(gitrev-parse--verifyHEAD)'+gitcommit-q-m"Second commit."&&+HEAD=$(gitrev-parse--verifyHEAD)+'-test_expect_success\-'git branch --help should not have created a bogus branch''-test_might_failgitbranch--help</dev/null>/dev/null2>/dev/null&&+test_expect_success'git branch --help should not have created a bogus branch''+silenttest_might_failgitbranch--help</dev/null&&test_path_is_missing.git/refs/heads/--help' test_expect_success'branch -h in broken repository''-mkdirbroken&&-(-cdbroken&&-gitinit&&->.git/refs/heads/master&&-test_expect_code129gitbranch-h>usage2>&1-)&&-grep"[Uu]sage"broken/usage+gitinit-qbroken&&+test_when_finishedrm-rfbrokenusage&&+>broken/.git/refs/heads/master&&+>usage2>&1test_expect_code129git--git-dir=broken/.gitbranch-h&&+grep-q"[Uu]sage"usage'-test_expect_success\-'git branch abc should create a branch'\-'git branch abc && test_path_is_file .git/refs/heads/abc'+test_expect_success'git branch abc should create a branch''+gitbranchabc&&test_path_is_file.git/refs/heads/abc+'-test_expect_success\-'git branch a/b/c should create a branch'\-'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'+test_expect_success'git branch a/b/c should create a branch''+gitbrancha/b/c&&test_path_is_file.git/refs/heads/a/b/c+'-cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster+test_expect_success'git branch -l d/e/f should create a branch and a log''+id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"+date="1117150200 +0000"+msg="branch: Created from master"+here>expect<<-EOF+$_z40$HEAD$id$date\t$msg EOF-test_expect_success\-'git branch -l d/e/f should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitbranch-ld/e/f&&+GIT_COMMITTER_DATE="2005-05-26 23:30"gitbranch-ld/e/f&&test_path_is_file.git/refs/heads/d/e/f&&test_path_is_file.git/logs/refs/heads/d/e/f&&-test_cmpexpect.git/logs/refs/heads/d/e/f'+test_cmpexpect.git/logs/refs/heads/d/e/f+'-test_expect_success\-'git branch -d d/e/f should delete a branch and a log'\-'gitbranch-dd/e/f&&+test_expect_success'git branch -d d/e/f should delete a branch and a log''+quietgitbranch-dd/e/f&&test_path_is_missing.git/refs/heads/d/e/f&&-test_path_is_missing.git/logs/refs/heads/d/e/f'--test_expect_success\-'git branch j/k should work after branch j has been deleted'\-'gitbranchj&&-gitbranch-dj&&-gitbranchj/k'--test_expect_success\-'git branch l should work after branch l/m has been deleted'\-'gitbranchl/m&&-gitbranch-dl/m&&-gitbranchl'--test_expect_success\-'git branch -m dumps usage'\-'test_expect_code129gitbranch-m2>err&&-grep"[Uu]sage: git branch"err'--test_expect_success\-'git branch -m m m/m should work'\-'gitbranch-lm&&+test_path_is_missing.git/logs/refs/heads/d/e/f+'++test_expect_success'git branch j/k should work after branch j has been deleted''+gitbranchj&&+quietgitbranch-dj&&+gitbranchj/k+'++test_expect_success'git branch l should work after branch l/m has been deleted''+gitbranchl/m&&+quietgitbranch-dl/m&&+gitbranchl+'++test_expect_success'git branch -m dumps usage''+test_expect_code129gitbranch-m2>err&&+grep-q"[Uu]sage: git branch"err+'++test_expect_success'git branch -m m m/m should work''+gitbranch-lm&&gitbranch-mmm/m&&-test_path_is_file.git/logs/refs/heads/m/m'+test_path_is_file.git/logs/refs/heads/m/m+'-test_expect_success\-'git branch -m n/n n should work'\-'gitbranch-ln/n&&+test_expect_success'git branch -m n/n n should work''+gitbranch-ln/n&&gitbranch-mn/nn&&-test_path_is_file.git/logs/refs/heads/n'+test_path_is_file.git/logs/refs/heads/n+' test_expect_success'git branch -m o/o o should fail when o/p exists''gitbrancho/o&&gitbrancho/p&&-test_must_failgitbranch-mo/oo+silenttest_must_failgitbranch-mo/oo' test_expect_success'git branch -m q r/q should fail when r exists''gitbranchq&&gitbranchr&&-test_must_failgitbranch-mqr/q+silenttest_must_failgitbranch-mqr/q' test_expect_success'git branch -M foo bar should fail when bar is checked out''gitbranchbar&&-gitcheckout-bfoo&&-test_must_failgitbranch-Mbarfoo+gitcheckout-q-bfoo&&+silenttest_must_failgitbranch-Mbarfoo' test_expect_success'git branch -M baz bam should succeed when baz is checked out''-gitcheckout-bbaz&&+gitcheckout-q-bbaz&&gitbranchbam&&gitbranch-Mbazbam' test_expect_success'git branch -M master should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranch-Mmaster' test_expect_success'git branch -M master master should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranch-Mmastermaster' test_expect_success'git branch -M master2 master2 should work when master is checked out''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitbranchmaster2&&gitbranch-Mmaster2master2'
@@ -131,7 +138,7 @@ test_expect_success 'git branch -M master2 master2 should work when master is ch test_expect_success'git branch -v -d t should work''gitbrancht&&test_path_is_file.git/refs/heads/t&&-gitbranch-v-dt&&+quietgitbranch-v-dt&&test_path_is_missing.git/refs/heads/t'
@@ -141,188 +148,198 @@ test_expect_success 'git branch -v -m t s should work' 'gitbranch-v-mts&&test_path_is_missing.git/refs/heads/t&&test_path_is_file.git/refs/heads/s&&-gitbranch-ds+quietgitbranch-ds' test_expect_success'git branch -m -d t s should fail''gitbrancht&&test_path_is_file.git/refs/heads/t&&-test_must_failgitbranch-m-dts&&-gitbranch-dt&&+silenttest_must_failgitbranch-m-dts&&+quietgitbranch-dt&&test_path_is_missing.git/refs/heads/t' test_expect_success'git branch --list -d t should fail''gitbrancht&&test_path_is_file.git/refs/heads/t&&-test_must_failgitbranch--list-dt&&-gitbranch-dt&&+silenttest_must_failgitbranch--list-dt&&+quietgitbranch-dt&&test_path_is_missing.git/refs/heads/t'-mv.git/config.git/config-saved- test_expect_success'git branch -m q q2 without config should succeed''+mv.git/config.git/config-saved&&+test_when_finishedmv.git/config-saved.git/config&&gitbranch-mqq2&&gitbranch-mq2q'-mv.git/config-saved.git/config-+test_expect_success'git branch -m s/s s should work when s/t is deleted'' gitconfigbranch.s/s.dummyHello--test_expect_success\-'git branch -m s/s s should work when s/t is deleted'\-'gitbranch-ls/s&&+gitbranch-ls/s&&test_path_is_file.git/logs/refs/heads/s/s&&gitbranch-ls/t&&test_path_is_file.git/logs/refs/heads/s/t&&-gitbranch-ds/t&&+quietgitbranch-ds/t&&gitbranch-ms/ss&&-test_path_is_file.git/logs/refs/heads/s'--test_expect_success'config information was renamed, too'\-"test $(gitconfigbranch.s.dummy) = Hello &&-test_must_failgitconfigbranch.s/s/dummy"+test_path_is_file.git/logs/refs/heads/s+'-test_expect_success'renaming a symref is not allowed'\+test_expect_success'config information was renamed, too''+test$(gitconfigbranch.s.dummy)=Hello&&+silenttest_must_failgitconfigbranch.s/s/dummy'++test_expect_success'renaming a symref is not allowed''gitsymbolic-refrefs/heads/master2refs/heads/master&&-test_must_failgitbranch-mmaster2master3&&-gitsymbolic-refrefs/heads/master2&&+silenttest_must_failgitbranch-mmaster2master3&&+quietgitsymbolic-refrefs/heads/master2&&test_path_is_file.git/refs/heads/master&&test_path_is_missing.git/refs/heads/master3'-test_expect_successSYMLINKS\-'git branch -m u v should fail when the reflog for u is a symlink''+test_expect_successSYMLINKS'git branch -m u v should fail when the reflog for u is a symlink''gitbranch-lu&&mv.git/logs/refs/heads/ureal-u&&ln-sreal-u.git/logs/refs/heads/u&&-test_must_failgitbranch-muv+silenttest_must_failgitbranch-muv'-test_expect_success'test tracking setup via --track'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup via --track''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy1local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmy1local/master&&test$(gitconfigbranch.my1.remote)=local&&-test$(gitconfigbranch.my1.merge)=refs/heads/master'+test$(gitconfigbranch.my1.merge)=refs/heads/master+'-test_expect_success'test tracking setup (non-wildcard, matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/master:refs/remotes/local/master&&+test_expect_success'test tracking setup (non-wildcard, matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetch\+refs/heads/master:refs/remotes/local/master&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy4local/master&&+quietgitbranch--trackmy4local/master&&test$(gitconfigbranch.my4.remote)=local&&-test$(gitconfigbranch.my4.merge)=refs/heads/master'+test$(gitconfigbranch.my4.merge)=refs/heads/master+'-test_expect_success'test tracking setup (non-wildcard, not matching)'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup (non-wildcard, not matching)''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy5local/master&&+quietgitbranch--trackmy5local/master&&!test"$(gitconfigbranch.my5.remote)"=local&&-!test"$(gitconfigbranch.my5.merge)"=refs/heads/master'+!test"$(gitconfigbranch.my5.merge)"=refs/heads/master+'-test_expect_success'test tracking setup via config'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'test tracking setup via config''+gitconfigbranch.autosetupmergetrue&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranchmy3local/master&&+quietgitbranchmy3local/master&&test$(gitconfigbranch.my3.remote)=local&&-test$(gitconfigbranch.my3.merge)=refs/heads/master'+test$(gitconfigbranch.my3.merge)=refs/heads/master+'-test_expect_success'test overriding tracking setup via --no-track'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'test overriding tracking setup via --no-track''+gitconfigbranch.autosetupmergetrue&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranch--no-trackmy2local/master&&gitconfigbranch.autosetupmergefalse&&!test"$(gitconfigbranch.my2.remote)"=local&&-!test"$(gitconfigbranch.my2.merge)"=refs/heads/master'+!test"$(gitconfigbranch.my2.merge)"=refs/heads/master+'-test_expect_success'no tracking without .fetch entries'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'no tracking without .fetch entries''+gitconfigbranch.autosetupmergetrue&&gitbranchmy6s&&gitconfigbranch.automsetupmergefalse&&test-z"$(gitconfigbranch.my6.remote)"&&-test-z"$(gitconfigbranch.my6.merge)"'+test-z"$(gitconfigbranch.my6.merge)"+'-test_expect_success'test tracking setup via --track but deeper'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup via --track but deeper''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&-gitbranch--trackmy7local/o/o&&+quietgitbranch--trackmy7local/o/o&&test"$(gitconfigbranch.my7.remote)"=local&&-test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o'+test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o+'-test_expect_success'test deleting branch deletes branch config'\-'gitbranch-dmy7&&+test_expect_success'test deleting branch deletes branch config''+quietgitbranch-dmy7&&test-z"$(gitconfigbranch.my7.remote)"&&-test-z"$(gitconfigbranch.my7.merge)"'+test-z"$(gitconfigbranch.my7.merge)"+'-test_expect_success'test deleting branch without config'\-'gitbranchmy7s&&+test_expect_success'test deleting branch without config''+gitbranchmy7s&&sha1=$(gitrev-parsemy7|cut-c1-7)&&echo"Deleted branch my7 (was $sha1).">expect&&gitbranch-dmy7>actual2>&1&&-test_i18ncmpexpectactual'+test_i18ncmpexpectactual+'-test_expect_success'test --track without .fetch entries'\-'gitbranch--trackmy8&&+test_expect_success'test --track without .fetch entries''+quietgitbranch--trackmy8&&test"$(gitconfigbranch.my8.remote)"&&-test"$(gitconfigbranch.my8.merge)"'+test"$(gitconfigbranch.my8.merge)"+'-test_expect_success\-'branch from non-branch HEAD w/autosetupmerge=always'\-'gitconfigbranch.autosetupmergealways&&+test_expect_success'branch from non-branch HEAD w/autosetupmerge=always''+gitconfigbranch.autosetupmergealways&&gitbranchmy9HEAD^&&-gitconfigbranch.autosetupmergefalse'+gitconfigbranch.autosetupmergefalse+'-test_expect_success\-'branch from non-branch HEAD w/--track causes failure'\-'test_must_fail git branch --track my10 HEAD^'+test_expect_success'branch from non-branch HEAD w/--track causes failure''+silenttest_must_failgitbranch--trackmy10HEAD^+'-test_expect_success\-'branch from tag w/--track causes failure'\-'gittagfoobar&&-test_must_failgitbranch--trackmy11foobar'+test_expect_success'branch from tag w/--track causes failure''+gittagfoobar&&+silenttest_must_failgitbranch--trackmy11foobar+'# Keep this test last, as it changes the current branch-cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster+test_expect_success'git checkout -b g/h/i -l should create a branch and a log''+id="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"+date="1117150200 +0000"+msg="branch: Created from master"+here>expect<<-EOF+$_z40$HEAD$id$date\t$msg EOF-test_expect_success\-'git checkout -b g/h/i -l should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitcheckout-bg/h/i-lmaster&&+GIT_COMMITTER_DATE="2005-05-26 23:30"\+gitcheckout-q-bg/h/i-lmaster&&test_path_is_file.git/refs/heads/g/h/i&&test_path_is_file.git/logs/refs/heads/g/h/i&&-test_cmpexpect.git/logs/refs/heads/g/h/i'+test_cmpexpect.git/logs/refs/heads/g/h/i+' test_expect_success'checkout -b makes reflog by default''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitconfig--unsetcore.logAllRefUpdates&&-gitcheckout-balpha&&-gitrev-parse--verifyalpha@{0}+gitcheckout-q-balpha&&+quietgitrev-parse--verifyalpha@{0}' test_expect_success'checkout -b does not make reflog when core.logAllRefUpdates = false''-gitcheckoutmaster&&+gitcheckout-qmaster&&gitconfigcore.logAllRefUpdatesfalse&&-gitcheckout-bbeta&&-test_must_failgitrev-parse--verifybeta@{0}+gitcheckout-q-bbeta&&+silenttest_must_failgitrev-parse--verifybeta@{0}' test_expect_success'checkout -b with -l makes reflog when core.logAllRefUpdates = false''-gitcheckoutmaster&&-gitcheckout-lbgamma&&+gitcheckout-qmaster&&+gitcheckout-q-lbgamma&&gitconfig--unsetcore.logAllRefUpdates&&-gitrev-parse--verifygamma@{0}+quietgitrev-parse--verifygamma@{0}' test_expect_success'avoid ambiguous track''
@@ -339,9 +356,9 @@ test_expect_success 'autosetuprebase local on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaselocal&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase&&-gitbranch--trackmyr1mybase&&+quietgitbranch--trackmyr1mybase&&test"$(gitconfigbranch.myr1.remote)"=.&&test"$(gitconfigbranch.myr1.merge)"=refs/heads/mybase&&test"$(gitconfigbranch.myr1.rebase)"=true
@@ -351,9 +368,9 @@ test_expect_success 'autosetuprebase always on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasealways&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase2&&-gitbranch--trackmyr2mybase&&+quietgitbranch--trackmyr2mybase&&test"$(gitconfigbranch.myr2.remote)"=.&&test"$(gitconfigbranch.myr2.merge)"=refs/heads/mybase&&test"$(gitconfigbranch.myr2.rebase)"=true
@@ -363,9 +380,9 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase3&&-gitbranch--trackmyr3mybase2&&+quietgitbranch--trackmyr3mybase2&&test"$(gitconfigbranch.myr3.remote)"=.&&test"$(gitconfigbranch.myr3.merge)"=refs/heads/mybase2&&!test"$(gitconfigbranch.myr3.rebase)"=true
@@ -375,9 +392,9 @@ test_expect_success 'autosetuprebase never on a tracked local branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasenever&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase4&&-gitbranch--trackmyr4mybase2&&+quietgitbranch--trackmyr4mybase2&&test"$(gitconfigbranch.myr4.remote)"=.&&test"$(gitconfigbranch.myr4.merge)"=refs/heads/mybase2&&!test"$(gitconfigbranch.myr4.rebase)"=true
@@ -387,8 +404,8 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaselocal&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr5local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr5local/master&&test"$(gitconfigbranch.myr5.remote)"=local&&test"$(gitconfigbranch.myr5.merge)"=refs/heads/master&&!test"$(gitconfigbranch.myr5.rebase)"=true
@@ -398,8 +415,8 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebasenever&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr6local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr6local/master&&test"$(gitconfigbranch.myr6.remote)"=local&&test"$(gitconfigbranch.myr6.merge)"=refs/heads/master&&!test"$(gitconfigbranch.myr6.rebase)"=true
@@ -409,8 +426,8 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr7local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr7local/master&&test"$(gitconfigbranch.myr7.remote)"=local&&test"$(gitconfigbranch.myr7.merge)"=refs/heads/master&&test"$(gitconfigbranch.myr7.rebase)"=true
@@ -420,8 +437,8 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' 'gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&gitconfigbranch.autosetuprebaseremote&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr8local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr8local/master&&test"$(gitconfigbranch.myr8.remote)"=local&&test"$(gitconfigbranch.myr8.merge)"=refs/heads/master&&test"$(gitconfigbranch.myr8.rebase)"=true
@@ -431,8 +448,8 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' 'gitconfig--unsetbranch.autosetuprebase&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmyr9local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--trackmyr9local/master&&test"$(gitconfigbranch.myr9.remote)"=local&&test"$(gitconfigbranch.myr9.merge)"=refs/heads/master&&test"z$(gitconfigbranch.myr9.rebase)"=z
@@ -441,9 +458,9 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' ' test_expect_success'autosetuprebase unconfigured on a tracked local branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/o||gitfetchlocal)&&+(gitshow-ref-qrefs/remotes/local/o||gitfetch-qlocal)&&gitbranchmybase10&&-gitbranch--trackmyr10mybase2&&+quietgitbranch--trackmyr10mybase2&&test"$(gitconfigbranch.myr10.remote)"=.&&test"$(gitconfigbranch.myr10.merge)"=refs/heads/mybase2&&test"z$(gitconfigbranch.myr10.rebase)"=z
@@ -452,8 +469,8 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' test_expect_success'autosetuprebase unconfigured on untracked local branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr11mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr11mybase2&&test"z$(gitconfigbranch.myr11.remote)"=z&&test"z$(gitconfigbranch.myr11.merge)"=z&&test"z$(gitconfigbranch.myr11.rebase)"=z
@@ -462,8 +479,8 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' test_expect_success'autosetuprebase unconfigured on untracked remote branch''gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr12local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr12local/master&&test"z$(gitconfigbranch.myr12.remote)"=z&&test"z$(gitconfigbranch.myr12.merge)"=z&&test"z$(gitconfigbranch.myr12.rebase)"=z
@@ -473,8 +490,8 @@ test_expect_success 'autosetuprebase never on an untracked local branch' 'gitconfigbranch.autosetuprebasenever&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr13mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr13mybase2&&test"z$(gitconfigbranch.myr13.remote)"=z&&test"z$(gitconfigbranch.myr13.merge)"=z&&test"z$(gitconfigbranch.myr13.rebase)"=z
@@ -484,8 +501,8 @@ test_expect_success 'autosetuprebase local on an untracked local branch' 'gitconfigbranch.autosetuprebaselocal&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr14mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr14mybase2&&test"z$(gitconfigbranch.myr14.remote)"=z&&test"z$(gitconfigbranch.myr14.merge)"=z&&test"z$(gitconfigbranch.myr14.rebase)"=z
@@ -495,8 +512,8 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' 'gitconfigbranch.autosetuprebaseremote&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr15mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr15mybase2&&test"z$(gitconfigbranch.myr15.remote)"=z&&test"z$(gitconfigbranch.myr15.merge)"=z&&test"z$(gitconfigbranch.myr15.rebase)"=z
@@ -506,8 +523,8 @@ test_expect_success 'autosetuprebase always on an untracked local branch' 'gitconfigbranch.autosetuprebasealways&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr16mybase2&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr16mybase2&&test"z$(gitconfigbranch.myr16.remote)"=z&&test"z$(gitconfigbranch.myr16.merge)"=z&&test"z$(gitconfigbranch.myr16.rebase)"=z
@@ -517,8 +534,8 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' 'gitconfigbranch.autosetuprebasenever&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr17local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr17local/master&&test"z$(gitconfigbranch.myr17.remote)"=z&&test"z$(gitconfigbranch.myr17.merge)"=z&&test"z$(gitconfigbranch.myr17.rebase)"=z
@@ -528,8 +545,8 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' 'gitconfigbranch.autosetuprebaselocal&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr18local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr18local/master&&test"z$(gitconfigbranch.myr18.remote)"=z&&test"z$(gitconfigbranch.myr18.merge)"=z&&test"z$(gitconfigbranch.myr18.rebase)"=z
@@ -539,8 +556,8 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' 'gitconfigbranch.autosetuprebaseremote&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr19local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr19local/master&&test"z$(gitconfigbranch.myr19.remote)"=z&&test"z$(gitconfigbranch.myr19.merge)"=z&&test"z$(gitconfigbranch.myr19.rebase)"=z
@@ -550,8 +567,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' 'gitconfigbranch.autosetuprebasealways&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmyr20local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetch-qlocal)&&+quietgitbranch--no-trackmyr20local/master&&test"z$(gitconfigbranch.myr20.remote)"=z&&test"z$(gitconfigbranch.myr20.merge)"=z&&test"z$(gitconfigbranch.myr20.rebase)"=z
@@ -559,8 +576,8 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' ' test_expect_success'autosetuprebase always on detached HEAD''gitconfigbranch.autosetupmergealways&&-test_when_finishedgitcheckoutmaster&&-gitcheckoutHEAD^0&&+test_when_finishedgitcheckout-qmaster&&+gitcheckout-qHEAD^0&&gitbranchmy11&&test-z"$(gitconfigbranch.my11.remote)"&&test-z"$(gitconfigbranch.my11.merge)"
@@ -568,20 +585,20 @@ test_expect_success 'autosetuprebase always on detached HEAD' ' test_expect_success'detect misconfigured autosetuprebase (bad value)''gitconfigbranch.autosetuprebasegarbage&&-test_must_failgitbranch+silenttest_must_failgitbranch' test_expect_success'detect misconfigured autosetuprebase (no value)''gitconfig--unsetbranch.autosetuprebase&&echo"[branch] autosetuprebase">>.git/config&&-test_must_failgitbranch&&+silenttest_must_failgitbranch&&gitconfig--unsetbranch.autosetuprebase' test_expect_success'attempt to delete a branch without base and unmerged to HEAD''-gitcheckoutmy9&&+gitcheckout-qmy9&&gitconfig--unsetbranch.my8.merge&&-test_must_failgitbranch-dmy8+silenttest_must_failgitbranch-dmy8' test_expect_success'attempt to delete a branch merged to its base''
@@ -589,32 +606,30 @@ test_expect_success 'attempt to delete a branch merged to its base' '# we would not have allowed deleting my8 that is not merged# to my9, but it is set to track master that already has my8gitconfigbranch.my8.mergerefs/heads/master&&-gitbranch-dmy8+silentgitbranch-dmy8' test_expect_success'attempt to delete a branch merged to its base''-gitcheckoutmaster&&+gitcheckout-qmaster&&echoThird>>A&&-gitcommit-m"Third commit"A&&-gitbranch-tmy10my9&&-gitbranch-fmy10HEAD^&&+gitcommit-q-m"Third commit"A&&+quietgitbranch-tmy10my9&&+quietgitbranch-fmy10HEAD^&&# we are on master which is at the third commit, and my10# is behind us, so traditionally we would have allowed deleting# it; but my10 is set to track my9 that is further behind.-test_must_failgitbranch-dmy10+silenttest_must_failgitbranch-dmy10' test_expect_success'use set-upstream on the current branch''-gitcheckoutmaster&&-git--bareinitmyupstream.git&&-gitpushmyupstream.gitmaster:refs/heads/frotz&&+gitcheckout-qmaster&&+git--bareinit-qmyupstream.git&&+gitpush-qmyupstream.gitmaster:refs/heads/frotz&&gitremoteaddoriginmyupstream.git&&-gitfetch&&-gitbranch--set-upstreammasterorigin/frotz&&-+gitfetch-q&&+quietgitbranch--set-upstreammasterorigin/frotz&&test"z$(gitconfigbranch.master.remote)"="zorigin"&&test"z$(gitconfigbranch.master.merge)"="zrefs/heads/frotz"-' test_expect_success'use --edit-description''
@@ -637,7 +652,7 @@ test_expect_success 'detect typo in branch name when using --edit-description' '(EDITOR=./editor&&exportEDITOR&&-test_must_failgitbranch--edit-descriptionno-such-branch+silenttest_must_failgitbranch--edit-descriptionno-such-branch)'
@@ -645,11 +660,11 @@ test_expect_success 'refuse --edit-description on unborn branch for now' 'write_scripteditor<<-\EOF&&echo"New contents">"$1"EOF-gitcheckout--orphanunborn&&+gitcheckout-q--orphanunborn&&(EDITOR=./editor&&exportEDITOR&&-test_must_failgitbranch--edit-description+silenttest_must_failgitbranch--edit-description)'
@@ -134,25 +130,22 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'unambiguously abbreviated option''-test-parse-options--int2--boolean--no-bo>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--int2--boolean--no-bo2>err|+test_cmpexpect-&&+test!-serr' test_expect_success'unambiguously abbreviated option with "="''-test-parse-options--int=2>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--int=22>err|test_cmpexpect-&&+test!-serr' test_expect_success'ambiguously abbreviated option''-test-parse-options--strin123;-test$?=129+silenttest_expect_code129test-parse-options--strin123'-cat>expect<<EOF+test_expect_success'non ambiguous option (after two options it abbreviates)''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -163,24 +156,21 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'non ambiguous option (after two options it abbreviates)''-test-parse-options--st123>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--st1232>err|test_cmpexpect-&&+test!-serr'-cat>typo.err<<EOF-error:didyoumean\`--boolean\`(withtwodashes?)-EOF- test_expect_success'detect possible typos''-test_must_failtest-parse-options-boolean>output2>output.err&&-test!-soutput&&-test_cmptypo.erroutput.err+cat>typo.err<<-\EOF&&+error:didyoumean`--boolean`(withtwodashes?)+EOF+>expect+test_must_failtest-parse-options-boolean2>err|test_cmpexpect-&&+test_cmptypo.errerr'-cat>expect<<EOF+test_expect_success'keep some options as arguments''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -192,14 +182,12 @@ dry run: no file:(notset) arg00:--quux EOF--test_expect_success'keep some options as arguments''-test-parse-options--quux>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--quux2>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF+test_expect_success'OPT_DATE() and OPT_SET_PTR() work''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:1
@@ -211,15 +199,13 @@ dry run: no file:(notset) arg00:foo EOF--test_expect_success'OPT_DATE() and OPT_SET_PTR() work''-test-parse-options-t"1970-01-01 00:00:01 +0000"--default-string\-foo-q>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options-t"1970-01-01 00:00:01 +0000"\+--default-stringfoo-q2>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF+test_expect_success'OPT_CALLBACK() and OPT_BIT() work''+cat>expect<<-\EOF&& Callback:"four",0 boolean:5 integer:4
@@ -231,24 +217,21 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_CALLBACK() and OPT_BIT() work''-test-parse-options--length=four-b-4>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--length=four-b-42>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF+test_expect_success'OPT_CALLBACK() and callback errors work''+cat>expect<<-\EOF&& Callback:"not set",1 EOF--test_expect_success'OPT_CALLBACK() and callback errors work''-test_must_failtest-parse-options--no-length>output2>output.err&&-test_cmpexpectoutput&&-test_cmpexpect.erroutput.err+test_must_failtest-parse-options--no-length2>err|+test_cmpexpect-&&+test_cmpexpect.errerr'-cat>expect<<EOF+test_expect_success'OPT_BIT() and OPT_SET_INT() work''+cat>expect<<-\EOF&& boolean:1 integer:23 timestamp:0
@@ -259,20 +242,17 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_BIT() and OPT_SET_INT() work''-test-parse-options--set23-bbbbb--no-or4>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--set23-bbbbb--no-or42>err|test_cmpexpect-&&+test!-serr' test_expect_success'OPT_NEGBIT() and OPT_SET_INT() work''-test-parse-options--set23-bbbbb--neg-or4>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--set23-bbbbb--neg-or42>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF+test_expect_success'OPT_BIT() works''+cat>expect<<-\EOF&& boolean:6 integer:0 timestamp:0
@@ -283,26 +263,23 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_BIT() works''-test-parse-options-bb--or4>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options-bb--or42>err|test_cmpexpect-&&+test!-serr' test_expect_success'OPT_NEGBIT() works''-test-parse-options-bb--no-neg-or4>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options-bb--no-neg-or42>err|test_cmpexpect-&&+test!-serr' test_expect_success'OPT_BOOLEAN() with PARSE_OPT_NODASH works''-test-parse-options++++++>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options++++++2>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF++test_expect_success'OPT_NUMBER_CALLBACK() works''+cat>expect<<-\EOF&& boolean:0 integer:12345 timestamp:0
@@ -313,14 +290,12 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_NUMBER_CALLBACK() works''-test-parse-options-12345>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options-123452>err|test_cmpexpect-&&+test!-serr'-cat>expect<<EOF+test_expect_success'negation of OPT_NONEG flags is not ambiguous''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -331,27 +306,23 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'negation of OPT_NONEG flags is not ambiguous''-test-parse-options--no-ambig>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+test-parse-options--no-ambig2>err|test_cmpexpect-&&+test!-serr'-cat>>expect<<'EOF'+test_expect_success'--list keeps list of strings''+cat>>expect<<-\EOF&& list:foo list:bar list:baz EOF-test_expect_success'--list keeps list of strings''-test-parse-options--listfoo--list=bar--list=baz>output&&-test_cmpexpectoutput+test-parse-options--listfoo--list=bar--list=baz|test_cmpexpect-' test_expect_success'--no-list resets list''-test-parse-options--list=other--list=irrelevant--list=options\---no-list--list=foo--list=bar--list=baz>output&&-test_cmpexpectoutput+test-parse-options--list=other--list=irrelevant\+--list=options--no-list--list=foo--list=bar--list=baz|+test_cmpexpect-' test_done
@@ -51,7 +59,7 @@ test_expect_success 'ls-remote self' ' test_expect_success'dies when no remote specified and no default remotes found''-test_must_failgitls-remote+silenttest_must_failgitls-remote'
@@ -70,8 +78,8 @@ test_expect_success 'use "origin" when no remote specified' ' test_expect_success'suppress "From <url>" with -q''-gitls-remote-q2>actual_err&&-test_must_failtest_cmpexp_erractual_err+quietgitls-remote-q2>actual_err&&+test_must_failcmp-sexp_erractual_err'
@@ -83,7 +91,7 @@ test_expect_success 'use branch.<name>.remote if possible' '## setup a new remote to differentiate from "origin"-gitclone.other.git&&+gitclone-q.other.git&&(cdother.git&&echo"$(gitrev-parseHEAD) HEAD"
@@ -102,11 +110,13 @@ test_expect_success 'use branch.<name>.remote if possible' ''-cat>exp<<EOF-fatal:'refs*master'doesnotappeartobeagitrepository-fatal:Theremoteendhungupunexpectedly-EOF test_expect_success'confuses pattern as remote when no remote specified''+'"+cat>exp<<-EOF+fatal:'refs*master'doesnotappeartobeagitrepository+fatal:Theremoteendhungupunexpectedly+EOF+"'## Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,# confuses <pattern> for <remote>. Although ugly, this behaviour is akin
@@ -124,7 +134,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '' test_expect_success'die with non-2 for wrong repository even with --exit-code''-gitls-remote--exit-code./no-such-repository;# not &&+silentgitls-remote--exit-code./no-such-repository;# not &&status=$?&&test$status!=2&&test$status!=0'
@@ -136,7 +146,8 @@ test_expect_success 'Report success even when nothing matches' '' test_expect_success'Report no-match with --exit-code''-test_expect_code2gitls-remote--exit-codeother.git"refs/nsn/*">actual&&+test_expect_code2gitls-remote--exit-codeother.git"refs/nsn/*"\+>actual&&>expect&&test_cmpexpectactual'
@@ -7,15 +7,37 @@ test_description='git tag Testsforoperationswithtags.'+if!test-rtest-lib.sh;then+(cd${0%/*}&&./${0##*/}$@)+exit$?+fi+ ../test-lib.sh ."$TEST_DIRECTORY"/lib-gpg.sh-# creating and listing lightweight tags:+quiet(){"$@">/dev/null;}+silent(){"$@">/dev/null2>&1;}+here(){sed's/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'$@;} tag_exists(){gitshow-ref--quiet--verifyrefs/tags/"$1"}+gen_header(){# name, object, type, time+cat<<-EOF&&+object$2+type$3+tag$1+taggerCOMitter<committer@example.com>$4-0700++EOF+here+}++get_header(){+gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"+}+# todo: git tag -l now returns always zero, when fixed, change this test test_expect_success'listing all tags in an empty tree should succeed''gittag-l&&
@@ -27,36 +49,38 @@ test_expect_success 'listing all tags in an empty tree should output nothing' 'test`gittag|wc-l`-eq0'-test_expect_success'looking for a tag in an empty tree should fail'\-'! (tag_exists mytag)'+test_expect_success'looking for a tag in an empty tree should fail''+!tag_existsmytag+' test_expect_success'creating a tag in an empty tree should fail''-test_must_failgittagmynotag&&+silenttest_must_failgittagmynotag&&!tag_existsmynotag' test_expect_success'creating a tag for HEAD in an empty tree should fail''-test_must_failgittagmytagheadHEAD&&+silenttest_must_failgittagmytagheadHEAD&&!tag_existsmytaghead' test_expect_success'creating a tag for an unknown revision should fail''-test_must_failgittagmytagnorevaaaaaaaaaaa&&+silenttest_must_failgittagmytagnorevaaaaaaaaaaa&&!tag_existsmytagnorev'-# commit used in the tests, test_tick is also called here to freeze the date: test_expect_success'creating a tag using default HEAD should succeed''+# commit used in the tests+# test_tick is also called here to freeze the date:test_tick&&-echofoo>foo&&+echo>foofoo&&gitaddfoo&&-gitcommit-mFoo&&+gitcommit-q-mFoo&&gittagmytag' test_expect_success'listing all tags if one exists should succeed''-gittag-l&&-gittag+quietgittag-l&&+quietgittag' test_expect_success'listing all tags if one exists should output that tag''
@@ -66,36 +90,36 @@ test_expect_success 'listing all tags if one exists should output that tag' '# pattern matching:-test_expect_success'listing a tag using a matching pattern should succeed'\-'git tag -l mytag'+test_expect_success'listing a tag using a matching pattern should succeed''+quietgittag-lmytag+'-test_expect_success\-'listing a tag using a matching pattern should output that tag'\-'test `git tag -l mytag` = mytag'+test_expect_success'listing a tag using a matching pattern should output that tag''+test`gittag-lmytag`=mytag+'# todo: git tag -l now returns always zero, when fixed, change this test-test_expect_success\-'listing tags using a non-matching pattern should suceed'\-'git tag -l xxx'+test_expect_success'listing tags using a non-matching pattern should suceed''+gittag-lxxx+'-test_expect_success\-'listing tags using a non-matching pattern should output nothing'\-'test `git tag -l xxx | wc -l` -eq 0'+test_expect_success'listing tags using a non-matching pattern should output nothing''+test`gittag-lxxx|wc-l`-eq0+'# special cases for creating tags:-test_expect_success\-'trying to create a tag with the name of one existing should fail'\-'test_must_fail git tag mytag'+test_expect_success'trying to create a tag with the name of one existing should fail''+silenttest_must_failgittagmytag+'-test_expect_success\-'trying to create a tag with a non-valid name should fail''+test_expect_success'trying to create a tag with a non-valid name should fail''test`gittag-l|wc-l`-eq1&&-test_must_failgittag""&&-test_must_failgittag.othertag&&-test_must_failgittag"other tag"&&-test_must_failgittag"othertag^"&&-test_must_failgittag"other~tag"&&+silenttest_must_failgittag""&&+silenttest_must_failgittag.othertag&&+silenttest_must_failgittag"other tag"&&+silenttest_must_failgittag"othertag^"&&+silenttest_must_failgittag"other~tag"&&test`gittag-l|wc-l`-eq1'
@@ -108,51 +132,49 @@ test_expect_success 'creating a tag using HEAD directly should succeed' ' test_expect_success'trying to delete an unknown tag should fail''!tag_existsunknown-tag&&-test_must_failgittag-dunknown-tag+silenttest_must_failgittag-dunknown-tag'-cat>expect<<EOF+test_expect_success'trying to delete tags without params should succeed and do nothing''+cat>expect<<-EOF&& myhead mytag EOF-test_expect_success\-'trying to delete tags without params should succeed and do nothing''-gittag-l>actual&&test_cmpexpectactual&&+gittag-l|test_cmpexpect-&&gittag-d&&-gittag-l>actual&&test_cmpexpectactual+gittag-l|test_cmpexpect-'-test_expect_success\-'deleting two existing tags in one command should succeed''+test_expect_success'deleting two existing tags in one command should succeed''tag_existsmytag&&tag_existsmyhead&&-gittag-dmytagmyhead&&+quietgittag-dmytagmyhead&&!tag_existsmytag&&!tag_existsmyhead'-test_expect_success\-'creating a tag with the name of another deleted one should succeed''+test_expect_success'creating a tag with the name of another deleted one should succeed''!tag_existsmytag&&gittagmytag&&tag_existsmytag'-test_expect_success\-'trying to delete two tags, existing and not, should fail in the 2nd''+test_expect_success'trying to delete two tags, existing and not, should fail in the 2nd''tag_existsmytag&&!tag_existsmyhead&&-test_must_failgittag-dmytaganothertag&&+silenttest_must_failgittag-dmytaganothertag&&!tag_existsmytag&&!tag_existsmyhead'-test_expect_success'trying to delete an already deleted tag should fail'\-'test_must_fail git tag -d mytag'+test_expect_success'trying to delete an already deleted tag should fail''+silenttest_must_failgittag-dmytag+'# listing various tags with pattern matching:-cat>expect<<EOF+test_expect_success'listing all tags should print them ordered''+cat>expect<<-EOF&& a1 aa1 cba
@@ -163,7 +185,6 @@ v1.0 v1.0.1 v1.1.3 EOF-test_expect_success'listing all tags should print them ordered''gittagv1.0.1&&gittagt211&&gittagaa1&&
@@ -173,217 +194,189 @@ test_expect_success 'listing all tags should print them ordered' 'gittaga1&&gittagv1.0&&gittagt210&&-gittag-l>actual&&-test_cmpexpectactual&&-gittag>actual&&-test_cmpexpectactual+gittag-l|test_cmpexpect-&&+gittag|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags with substring as pattern must print those matching''+cat>expect<<-EOF&& a1 aa1 cba EOF-test_expect_success\-'listing tags with substring as pattern must print those matching''-rm*a*&&-gittag-l"*a*">current&&-test_cmpexpectcurrent+gittag-l"*a*"|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags with a suffix as pattern must print those matching''+cat>expect<<-EOF&& v0.2.1 v1.0.1 EOF-test_expect_success\-'listing tags with a suffix as pattern must print those matching''-gittag-l"*.1">actual&&-test_cmpexpectactual+gittag-l"*.1"|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags with a prefix as pattern must print those matching''+cat>expect<<-EOF&& t210 t211 EOF-test_expect_success\-'listing tags with a prefix as pattern must print those matching''-gittag-l"t21*">actual&&-test_cmpexpectactual+gittag-l"t21*"|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&& a1 EOF-test_expect_success\-'listing tags using a name as pattern must print that one matching''-gittag-la1>actual&&-test_cmpexpectactual+gittag-la1|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&& v1.0 EOF-test_expect_success\-'listing tags using a name as pattern must print that one matching''-gittag-lv1.0>actual&&-test_cmpexpectactual+gittag-lv1.0|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags with ? in the pattern should print those matching''+cat>expect<<-EOF&& v1.0.1 v1.1.3 EOF-test_expect_success\-'listing tags with ? in the pattern should print those matching''-gittag-l"v1.?.?">actual&&-test_cmpexpectactual+gittag-l"v1.?.?"|test_cmpexpect-'->expect-test_expect_success\-'listing tags using v.* should print nothing because none have v.''-gittag-l"v.*">actual&&-test_cmpexpectactual+test_expect_success'listing tags using v.* should print nothing because none have v.''+>expect&&+gittag-l"v.*"|test_cmpexpect-'-cat>expect<<EOF+test_expect_success'listing tags using v* should print only those having v''+cat>expect<<-EOF&& v0.2.1 v1.0 v1.0.1 v1.1.3 EOF-test_expect_success\-'listing tags using v* should print only those having v''-gittag-l"v*">actual&&-test_cmpexpectactual+gittag-l"v*"|test_cmpexpect-' test_expect_success'tag -l can accept multiple patterns''-gittag-l"v1*""v0*">actual&&-test_cmpexpectactual+gittag-l"v1*""v0*"|test_cmpexpect-'# creating and verifying lightweight tags:-test_expect_success\-'a non-annotated tag created without parameters should point to HEAD''+test_expect_success'a non-annotated tag created without parameters should point to HEAD''gittagnon-annotated-tag&&test$(gitcat-file-tnon-annotated-tag)=commit&&test$(gitrev-parsenon-annotated-tag)=$(gitrev-parseHEAD)'-test_expect_success'trying to verify an unknown tag should fail'\-'test_must_fail git tag -v unknown-tag'+test_expect_success'trying to verify an unknown tag should fail''+silenttest_must_failgittag-vunknown-tag+'-test_expect_success\-'trying to verify a non-annotated and non-signed tag should fail'\-'test_must_fail git tag -v non-annotated-tag'+test_expect_success'trying to verify a non-annotated and non-signed tag should fail''+silenttest_must_failgittag-vnon-annotated-tag+'-test_expect_success\-'trying to verify many non-annotated or unknown tags, should fail'\-'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2'+test_expect_success'trying to verify many non-annotated or unknown tags, should fail''+silenttest_must_failgittag-vunknown-tag1non-annotated-tagunknown-tag2+'# creating annotated tags:-get_tag_msg(){-gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"-}--# run test_tick before committing always gives the time in that timezone-get_tag_header(){-cat<<EOF-object$2-type$3-tag$1-taggerCOMitter<committer@example.com>$4-0700-+test_expect_success'creating an annotated tag with -m message should succeed''+commit=$(gitrev-parseHEAD)&&+time=$test_tick&&+name="annotated-tag"&&+msg="A message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg EOF-}--commit=$(gitrev-parseHEAD)-time=$test_tick--get_tag_headerannotated-tag$commitcommit$time>expect-echo"A message">>expect-test_expect_success\-'creating an annotated tag with -m message should succeed''-gittag-m"A message"annotated-tag&&-get_tag_msgannotated-tag>actual&&-test_cmpexpectactual+gittag-m"$msg"$name&&+get_header$name|test_cmpexpect-'-cat>msgfile<<EOF+test_expect_success'creating an annotated tag with -F messagefile should succeed''+name="file-annotated-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&& Anothermessageinafile. EOF-get_tag_headerfile-annotated-tag$commitcommit$time>expect-catmsgfile>>expect-test_expect_success\-'creating an annotated tag with -F messagefile should succeed''-gittag-Fmsgfilefile-annotated-tag&&-get_tag_msgfile-annotated-tag>actual&&-test_cmpexpectactual+tail-n2expect>msgfile&&+gittag-Fmsgfile$name&&+get_header$name|test_cmpexpect-'-cat>inputmsg<<EOF+test_expect_success'creating an annotated tag with -F - should succeed''+name="stdin-annotated-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&& Amessagefromthe standardinput EOF-get_tag_headerstdin-annotated-tag$commitcommit$time>expect-catinputmsg>>expect-test_expect_success'creating an annotated tag with -F - should succeed''-gittag-F-stdin-annotated-tag<inputmsg&&-get_tag_msgstdin-annotated-tag>actual&&-test_cmpexpectactual+tail-n2expect|gittag-F-$name&&+get_header$name|test_cmpexpect-'-test_expect_success\-'trying to create a tag with a non-existing -F file should fail''+test_expect_success'trying to create a tag with a non-existing -F file should fail''!test-fnonexistingfile&&!tag_existsnotag&&-test_must_failgittag-Fnonexistingfilenotag&&+silenttest_must_failgittag-Fnonexistingfilenotag&&!tag_existsnotag'-test_expect_success\-'trying to create tags giving both -m or -F options should fail''-echo"message file 1">msgfile1&&-echo"message file 2">msgfile2&&+test_expect_success'trying to create tags giving both -m or -F options should fail''+echo>msgfile1"message file 1"&&+echo>msgfile2"message file 2"&&!tag_existsmsgtag&&-test_must_failgittag-m"message 1"-Fmsgfile1msgtag&&+silenttest_must_failgittag-m"message 1"-Fmsgfile1msgtag&&!tag_existsmsgtag&&-test_must_failgittag-Fmsgfile1-m"message 1"msgtag&&+silenttest_must_failgittag-Fmsgfile1-m"message 1"msgtag&&!tag_existsmsgtag&&-test_must_failgittag-m"message 1"-Fmsgfile1\+silenttest_must_failgittag-m"message 1"-Fmsgfile1\-m"message 2"msgtag&&!tag_existsmsgtag'# blank and empty messages:-get_tag_headerempty-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with an empty -m message should succeed''-gittag-m""empty-annotated-tag&&-get_tag_msgempty-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with an empty -m message should succeed''+name="empty-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-m""$name&&+get_header$name|test_cmpexpect-'->emptyfile-get_tag_headeremptyfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with an empty -F messagefile should succeed''-gittag-Femptyfileemptyfile-annotated-tag&&-get_tag_msgemptyfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with an empty -F messagefile should succeed''+>emptyfile&&+name="emptyfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Femptyfile$name&&+get_header$name|test_cmpexpect-'-printf'\n\n \n\t\nLeading blank lines\n'>blanksfile-printf'\n\t \t \nRepeated blank lines\n'>>blanksfile-printf'\n\n\nTrailing spaces \t \n'>>blanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>blanksfile-get_tag_headerblanks-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF+test_expect_success'extra blanks in the message for an annotated tag should be removed''+here>blanksfile<<-\EOF&&++\s\s+\t+Leadingblanklines++\t\s\t\s\s+Repeatedblanklines++++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+name="blanks-annotated-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&& Leadingblanklines Repeatedblanklines
@@ -392,44 +385,41 @@ Trailing spaces Trailingblanklines EOF-test_expect_success\-'extra blanks in the message for an annotated tag should be removed''-gittag-Fblanksfileblanks-annotated-tag&&-get_tag_msgblanks-annotated-tag>actual&&-test_cmpexpectactual+gittag-Fblanksfile$name&&+get_header$name|test_cmpexpect-'-get_tag_headerblank-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with blank -m message with spaces should succeed''-gittag-m" "blank-annotated-tag&&-get_tag_msgblank-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with blank -m message with spaces should succeed''+name="blank-annotated-tag"&&+gen_header$name$commitcommit$time</dev/null>expect&&+gittag-m" "$name&&+get_header$name|test_cmpexpect-'-echo' '>blankfile-echo''>>blankfile-echo' '>>blankfile-get_tag_headerblankfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with blank -F messagefile with spaces should succeed''-gittag-Fblankfileblankfile-annotated-tag&&-get_tag_msgblankfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with blank -F messagefile with spaces should succeed''+here>blankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+name="blankfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fblankfile$name&&+get_header$name|test_cmpexpect-'-printf' '>blanknonlfile-get_tag_headerblanknonlfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with -F file of spaces and no newline should succeed''-gittag-Fblanknonlfileblanknonlfile-annotated-tag&&-get_tag_msgblanknonlfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with -F file of spaces and no newline should succeed''+printf>blanknonlfile" "&&+name="blanknonlfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fblanknonlfile$name&&+get_header$name|test_cmpexpect-'# messages with commented lines:-cat>commentsfile<<EOF+test_expect_success'creating a tag using a -F messagefile with #comments should succeed''+cat>commentsfile<<-EOF&&# A comment############
@@ -446,8 +436,8 @@ Another line. Lastline. EOF-get_tag_headercomments-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF+name="comments-annotated-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&& Themessage. Oneline.
@@ -455,279 +445,235 @@ Another line. Lastline. EOF-test_expect_success\-'creating a tag using a -F messagefile with #comments should succeed''-gittag-Fcommentsfilecomments-annotated-tag&&-get_tag_msgcomments-annotated-tag>actual&&-test_cmpexpectactual+gittag-Fcommentsfile$name&&+get_header$name|test_cmpexpect-'-get_tag_headercomment-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with a #comment in the -m message should succeed''-gittag-m"#comment"comment-annotated-tag&&-get_tag_msgcomment-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with a #comment in the -m message should succeed''+name="comment-annotated-tag"&&+gen_header$name$commitcommit$time>expect</dev/null&&+gittag-m"#comment"$name&&+get_header$name|test_cmpexpect-'-echo'#comment'>commentfile-echo''>>commentfile-echo'####'>>commentfile-get_tag_headercommentfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with #comments in the -F messagefile should succeed''-gittag-Fcommentfilecommentfile-annotated-tag&&-get_tag_msgcommentfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with #comments in the -F messagefile should succeed''+cat>commentfile<<-EOF&&+#comment++####+EOF+name="commentfile-annotated-tag"&&+gen_header$name$commitcommit$time>expect</dev/null&&+gittag-Fcommentfile$name&&+get_header$name|test_cmpexpect-'-printf'#comment'>commentnonlfile-get_tag_headercommentnonlfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with a file of #comment and no newline should succeed''-gittag-Fcommentnonlfilecommentnonlfile-annotated-tag&&-get_tag_msgcommentnonlfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with a file of #comment and no newline should succeed''+printf>commentnonlfile"#comment"&&+name="commentnonlfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fcommentnonlfile$name&&+get_header$name|test_cmpexpect-'# listing messages for annotated non-signed tags:-test_expect_success\-'listing the one-line message of a non-signed tag should succeed''+test_expect_success'listing the one-line message of a non-signed tag should succeed''gittag-m"A msg"tag-one-line&&-echo"tag-one-line">expect&&-gittag-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-one-line>actual&&-test_cmpexpectactual&&--echo"tag-one-line A msg">expect&&-gittag-n1-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-one-line>actual&&-test_cmpexpectactual&&-gittag-n2-ltag-one-line>actual&&-test_cmpexpectactual&&-gittag-n999-ltag-one-line>actual&&-test_cmpexpectactual+echo>expect"tag-one-line"&&+gittag-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n0-ltag-one-line|test_cmpexpect-&&++echo>expect"tag-one-line A msg"&&+gittag-n1-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n1-ltag-one-line|test_cmpexpect-&&+gittag-n2-ltag-one-line|test_cmpexpect-&&+gittag-n999-ltag-one-line|test_cmpexpect-'-test_expect_success\-'listing the zero-lines message of a non-signed tag should succeed''+test_expect_success'listing the zero-lines message of a non-signed tag should succeed''gittag-m""tag-zero-lines&&-echo"tag-zero-lines">expect&&-gittag-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-zero-lines>actual&&-test_cmpexpectactual&&--echo"tag-zero-lines ">expect&&-gittag-n1-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n2-ltag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n999-ltag-zero-lines>actual&&-test_cmpexpectactual+echo>expect"tag-zero-lines"&&+gittag-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n0-ltag-zero-lines|test_cmpexpect-&&++echo>expect"tag-zero-lines "&&+gittag-n1-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n1-ltag-zero-lines|test_cmpexpect-&&+gittag-n2-ltag-zero-lines|test_cmpexpect-&&+gittag-n999-ltag-zero-lines|test_cmpexpect-'-echo'tag line one'>annotagmsg-echo'tag line two'>>annotagmsg-echo'tag line three'>>annotagmsg-test_expect_success\-'listing many message lines of a non-signed tag should succeed''+test_expect_success'listing many message lines of a non-signed tag should succeed''+cat>annotagmsg<<-EOF&&+taglineone+taglinetwo+taglinethree+EOFgittag-Fannotagmsgtag-lines&&-echo"tag-lines">expect&&-gittag-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n0-ltag-lines|test_cmpexpect-&&echo"tag-lines tag line one">expect&&-gittag-n1-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-n1-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n1-ltag-lines|test_cmpexpect-&&echo" tag line two">>expect&&-gittag-n2-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n2-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-n2-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n2-ltag-lines|test_cmpexpect-&&echo" tag line three">>expect&&-gittag-n3-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n3-ltag-lines>actual&&-test_cmpexpectactual&&-gittag-n4-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n4-ltag-lines>actual&&-test_cmpexpectactual&&-gittag-n99-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n99-ltag-lines>actual&&-test_cmpexpectactual+gittag-n3-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n3-ltag-lines|test_cmpexpect-&&+gittag-n4-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n4-ltag-lines|test_cmpexpect-&&+gittag-n99-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n99-ltag-lines|test_cmpexpect-' test_expect_success'annotations for blobs are empty''-blob=$(githash-object-w--stdin<<-\EOF+blob=$(githash-object-w--stdin<<-EOFBlobparagraph1.Blobparagraph2.EOF)&&gittagtag-blob$blob&&-echo"tag-blob ">expect&&-gittag-n1-ltag-blob>actual&&-test_cmpexpectactual+echo>expect"tag-blob "&&+gittag-n1-ltag-blob|test_cmpexpect-'# trying to verify annotated non-signed tags:-test_expect_successGPG\-'trying to verify an annotated non-signed tag should fail''+test_expect_successGPG'trying to verify an annotated non-signed tag should fail''tag_existsannotated-tag&&-test_must_failgittag-vannotated-tag+silenttest_must_failgittag-vannotated-tag'-test_expect_successGPG\-'trying to verify a file-annotated non-signed tag should fail''+test_expect_successGPG'trying to verify a file-annotated non-signed tag should fail''tag_existsfile-annotated-tag&&-test_must_failgittag-vfile-annotated-tag+silenttest_must_failgittag-vfile-annotated-tag'-test_expect_successGPG\-'trying to verify two annotated non-signed tags should fail''+test_expect_successGPG'trying to verify two annotated non-signed tags should fail''tag_existsannotated-tagfile-annotated-tag&&-test_must_failgittag-vannotated-tagfile-annotated-tag+silenttest_must_failgittag-vannotated-tagfile-annotated-tag'# creating and verifying signed tags:-get_tag_headersigned-tag$commitcommit$time>expect-echo'A signed tag message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'creating a signed tag with -m message should succeed''-gittag-s-m"A signed tag message"signed-tag&&-get_tag_msgsigned-tag>actual&&-test_cmpexpectactual+name="signed-tag"&&+msg="A signed tag message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$name&&+get_header$name|test_cmpexpect-'-get_tag_headeru-signed-tag$commitcommit$time>expect-echo'Another message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'sign with a given key id''--gittag-ucommitter@example.com-m"Another message"u-signed-tag&&-get_tag_msgu-signed-tag>actual&&-test_cmpexpectactual-+name="u-signed-tag"&&+msg="Another message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-ucommitter@example.com-m"$msg"$name&&+get_header$name|test_cmpexpect-' test_expect_successGPG'sign with an unknown id (1)''--test_must_failgittag-uauthor@example.com\+silenttest_must_failgittag-uauthor@example.com\-m"Another message"o-signed-tag-' test_expect_successGPG'sign with an unknown id (2)''--test_must_failgittag-uDEADBEEF-m"Another message"o-signed-tag-+silenttest_must_failgittag-uDEADBEEF-m"Another message"o-signed-tag'-cat>fakeeditor<<'EOF'-#!/bin/sh+test_expect_successGPG'-u implies signed tag''+cat<<-\EOF|write_scriptfakeeditor&&test-n"$1"&&exec>"$1"echoAsignedtagmessageechofromafakeeditor. EOF-chmod+xfakeeditor--get_tag_headerimplied-sign$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'-u implies signed tag''-GIT_EDITOR=./fakeeditorgittag-uCDDE430Dimplied-sign&&-get_tag_msgimplied-sign>actual&&-test_cmpexpectactual+name="implied-signed"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOF+GIT_EDITOR=./fakeeditorgittag-uCDDE430D$name&&+get_header$name|test_cmpexpect-'-cat>sigmsgfile<<EOF+test_expect_successGPG'creating a signed tag with -F messagefile should succeed''+name="file-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&& Anothersignedtag messageinafile.+-----BEGINPGPSIGNATURE----- EOF-get_tag_headerfile-signed-tag$commitcommit$time>expect-catsigmsgfile>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with -F messagefile should succeed''-gittag-s-Fsigmsgfilefile-signed-tag&&-get_tag_msgfile-signed-tag>actual&&-test_cmpexpectactual+tail-n3expect|head-n2>sigmsgfile+gittag-s-Fsigmsgfile$name&&+get_header$name|test_cmpexpect-'-cat>siginputmsg<<EOF+test_expect_successGPG'creating a signed tag with -F - should succeed''+name="stdin-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&& Asignedtagmessagefrom thestandardinput+-----BEGINPGPSIGNATURE----- EOF-get_tag_headerstdin-signed-tag$commitcommit$time>expect-catsiginputmsg>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'creating a signed tag with -F - should succeed''-gittag-s-F-stdin-signed-tag<siginputmsg&&-get_tag_msgstdin-signed-tag>actual&&-test_cmpexpectactual+tail-n3expect|head-n2|gittag-s-F-$name&&+get_header$name|test_cmpexpect-'-get_tag_headerimplied-annotate$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-s implies annotated tag''-GIT_EDITOR=./fakeeditorgittag-simplied-annotate&&-get_tag_msgimplied-annotate>actual&&-test_cmpexpectactual+name="implied-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOF+GIT_EDITOR=./fakeeditorgittag-s$name&&+get_header$name|test_cmpexpect-'-test_expect_successGPG\-'trying to create a signed tag with non-existing -F file should fail''+test_expect_successGPG'trying to create a signed tag with non-existing -F file should fail''!test-fnonexistingfile&&!tag_existsnosigtag&&-test_must_failgittag-s-Fnonexistingfilenosigtag&&+silenttest_must_failgittag-s-Fnonexistingfilenosigtag&&!tag_existsnosigtag'-test_expect_successGPG'verifying a signed tag should succeed'\-'git tag -v signed-tag'+test_expect_successGPG'verifying a signed tag should succeed''+silentgittag-vsigned-tag+'-test_expect_successGPG'verifying two signed tags in one command should succeed'\-'git tag -v signed-tag file-signed-tag'+test_expect_successGPG'verifying two signed tags in one command should succeed''+silentgittag-vsigned-tagfile-signed-tag+'-test_expect_successGPG\-'verifying many signed and non-signed tags should fail''-test_must_failgittag-vsigned-tagannotated-tag&&-test_must_failgittag-vfile-annotated-tagfile-signed-tag&&-test_must_failgittag-vannotated-tag\+test_expect_successGPG'verifying many signed and non-signed tags should fail''+silenttest_must_failgittag-vsigned-tagannotated-tag&&+silenttest_must_failgittag-vfile-annotated-tagfile-signed-tag&&+silenttest_must_failgittag-vannotated-tag\file-signed-tagfile-annotated-tag&&-test_must_failgittag-vsigned-tagannotated-tagfile-signed-tag+silenttest_must_failgittag-vsigned-tag\+annotated-tagfile-signed-tag' test_expect_successGPG'verifying a forged tag should fail''
@@ -735,38 +681,53 @@ test_expect_success GPG 'verifying a forged tag should fail' 'sed-e"s/signed-tag/forged-tag/"|gitmktag)&&gittagforged-tag$forged&&-test_must_failgittag-vforged-tag+silenttest_must_failgittag-vforged-tag'# blank and empty messages for signed tags:-get_tag_headerempty-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with an empty -m message should succeed''-gittag-s-m""empty-signed-tag&&-get_tag_msgempty-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vempty-signed-tag-'-->sigemptyfile-get_tag_headeremptyfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with an empty -F messagefile should succeed''-gittag-s-Fsigemptyfileemptyfile-signed-tag&&-get_tag_msgemptyfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vemptyfile-signed-tag-'--printf'\n\n \n\t\nLeading blank lines\n'>sigblanksfile-printf'\n\t \t \nRepeated blank lines\n'>>sigblanksfile-printf'\n\n\nTrailing spaces \t \n'>>sigblanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>sigblanksfile-get_tag_headerblanks-signed-tag$commitcommit$time>expect-cat>>expect<<EOF+test_expect_successGPG'creating a signed tag with an empty -m message should succeed''+name="empty-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m""$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with an empty -F messagefile should succeed''+>sigemptyfile&&+name="emptyfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigemptyfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'extra blanks in the message for a signed tag should be removed''+here>sigblanksfile<<-\EOF&&++\s\s+\t+Leadingblanklines++\t\s\t\s\s+Repeatedblanklines++++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+name="blanks-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&& Leadingblanklines Repeatedblanklines
@@ -774,53 +735,53 @@ Repeated blank lines Trailingspaces Trailingblanklines+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblanksfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with a blank -m message should succeed''+name="blank-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+-----BEGINPGPSIGNATURE----- EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'extra blanks in the message for a signed tag should be removed''-gittag-s-Fsigblanksfileblanks-signed-tag&&-get_tag_msgblanks-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblanks-signed-tag-'--get_tag_headerblank-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a blank -m message should succeed''-gittag-s-m" "blank-signed-tag&&-get_tag_msgblank-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblank-signed-tag-'--echo' '>sigblankfile-echo''>>sigblankfile-echo' '>>sigblankfile-get_tag_headerblankfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with blank -F file with spaces should succeed''-gittag-s-Fsigblankfileblankfile-signed-tag&&-get_tag_msgblankfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblankfile-signed-tag-'--printf' '>sigblanknonlfile-get_tag_headerblanknonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with spaces and no newline should succeed''-gittag-s-Fsigblanknonlfileblanknonlfile-signed-tag&&-get_tag_msgblanknonlfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vsigned-tag+gittag-s-m" "$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with blank -F file with spaces should succeed''+here>sigblankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+name="blankfile-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblankfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with spaces and no newline should succeed''+printf>sigblanknonlfile" "&&+name="blanknonlfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblanknonlfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name'# messages with commented lines for signed tags:-cat>sigcommentsfile<<EOF+test_expect_successGPG'creating a signed tag with a -F file with #comments should succeed''+cat>sigcommentsfile<<-EOF&&# A comment############
@@ -837,303 +798,257 @@ Another line. Lastline. EOF-get_tag_headercomments-signed-tag$commitcommit$time>expect-cat>>expect<<EOF+name="comments-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&& Themessage. Oneline. Anotherline. Lastline.+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentsfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with #commented -m message should succeed''+name="comment-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"#comment"$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with #commented -F messagefile should succeed''+cat>sigcommentfile<<-EOF&&+#comment++#### EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a -F file with #comments should succeed''-gittag-s-Fsigcommentsfilecomments-signed-tag&&-get_tag_msgcomments-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcomments-signed-tag-'--get_tag_headercomment-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with #commented -m message should succeed''-gittag-s-m"#comment"comment-signed-tag&&-get_tag_msgcomment-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcomment-signed-tag-'--echo'#comment'>sigcommentfile-echo''>>sigcommentfile-echo'####'>>sigcommentfile-get_tag_headercommentfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with #commented -F messagefile should succeed''-gittag-s-Fsigcommentfilecommentfile-signed-tag&&-get_tag_msgcommentfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcommentfile-signed-tag-'--printf'#comment'>sigcommentnonlfile-get_tag_headercommentnonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a #comment and no newline should succeed''-gittag-s-Fsigcommentnonlfilecommentnonlfile-signed-tag&&-get_tag_msgcommentnonlfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcommentnonlfile-signed-tag+name="commentfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with a #comment and no newline should succeed''+printf"#comment">sigcommentnonlfile&&+name="commentnonlfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentnonlfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name'# listing messages for signed tags:-test_expect_successGPG\-'listing the one-line message of a signed tag should succeed''+test_expect_successGPG'listing the one-line message of a signed tag should succeed''gittag-s-m"A message line signed"stag-one-line&&echo"stag-one-line">expect&&-gittag-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-one-line>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n0-lstag-one-line|test_cmpexpect-&&echo"stag-one-line A message line signed">expect&&-gittag-n1-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-one-line>actual&&-test_cmpexpectactual&&-gittag-n2-lstag-one-line>actual&&-test_cmpexpectactual&&-gittag-n999-lstag-one-line>actual&&-test_cmpexpectactual+gittag-n1-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n1-lstag-one-line|test_cmpexpect-&&+gittag-n2-lstag-one-line|test_cmpexpect-&&+gittag-n999-lstag-one-line|test_cmpexpect-'-test_expect_successGPG\-'listing the zero-lines message of a signed tag should succeed''+test_expect_successGPG'listing the zero-lines message of a signed tag should succeed''gittag-s-m""stag-zero-lines&&echo"stag-zero-lines">expect&&-gittag-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-zero-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n0-lstag-zero-lines|test_cmpexpect-&&echo"stag-zero-lines ">expect&&-gittag-n1-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n2-lstag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n999-lstag-zero-lines>actual&&-test_cmpexpectactual-'--echo'stag line one'>sigtagmsg-echo'stag line two'>>sigtagmsg-echo'stag line three'>>sigtagmsg-test_expect_successGPG\-'listing many message lines of a signed tag should succeed''+gittag-n1-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n1-lstag-zero-lines|test_cmpexpect-&&+gittag-n2-lstag-zero-lines|test_cmpexpect-&&+gittag-n999-lstag-zero-lines|test_cmpexpect-+'++test_expect_successGPG'listing many message lines of a signed tag should succeed''+cat>sigtagmsg<<-EOF&&+staglineone+staglinetwo+staglinethree+EOFgittag-s-Fsigtagmsgstag-lines&&echo"stag-lines">expect&&-gittag-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n0-lstag-lines|test_cmpexpect-&&echo"stag-lines stag line one">expect&&-gittag-n1-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-n1-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n1-lstag-lines|test_cmpexpect-&&echo" stag line two">>expect&&-gittag-n2-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n2-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-n2-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n2-lstag-lines|test_cmpexpect-&&echo" stag line three">>expect&&-gittag-n3-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n3-lstag-lines>actual&&-test_cmpexpectactual&&-gittag-n4-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n4-lstag-lines>actual&&-test_cmpexpectactual&&-gittag-n99-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n99-lstag-lines>actual&&-test_cmpexpectactual+gittag-n3-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n3-lstag-lines|test_cmpexpect-&&+gittag-n4-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n4-lstag-lines|test_cmpexpect-&&+gittag-n99-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n99-lstag-lines|test_cmpexpect-'-# tags pointing to objects different from commits:-tree=$(gitrev-parseHEAD^{tree})-blob=$(gitrev-parseHEAD:foo)-tag=$(gitrev-parsesigned-tag2>/dev/null)--get_tag_headertree-signed-tag$treetree$time>expect-echo"A message for a tree">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to a tree should succeed''-gittag-s-m"A message for a tree"tree-signed-tagHEAD^{tree}&&-get_tag_msgtree-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag pointing to a tree should succeed''+# tags pointing to objects different from commits:+tree=$(gitrev-parseHEAD^{tree})&&+blob=$(gitrev-parseHEAD:foo)&&+tag=$(gitrev-parsesigned-tag)&&+name="tree-signed-tag"&&+msg="A message for a tree"&&+gen_header$name$treetree$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$nameHEAD^{tree}&&+get_header$name|test_cmpexpect-'-get_tag_headerblob-signed-tag$blobblob$time>expect-echo"A message for a blob">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to a blob should succeed''-gittag-s-m"A message for a blob"blob-signed-tagHEAD:foo&&-get_tag_msgblob-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag pointing to a blob should succeed''+msg="A message for a blob"&&+name="blob-signed-tag"&&+gen_header$name$blobblob$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$nameHEAD:foo&&+get_header$name|test_cmpexpect-'-get_tag_headertag-signed-tag$tagtag$time>expect-echo"A message for another tag">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to another tag should succeed''-gittag-s-m"A message for another tag"tag-signed-tagsigned-tag&&-get_tag_msgtag-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag pointing to another tag should succeed''+msg="A message for another tag"&&+name="tag-signed-tag"&&+gen_header$name$tagtag$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$namesigned-tag&&+get_header$name|test_cmpexpect-'# usage with rfc1991 signatures-echo"rfc1991">gpghome/gpg.conf-get_tag_headerrfc1991-signed-tag$commitcommit$time>expect-echo"RFC1991 signed tag">>expect-echo'-----BEGIN PGP MESSAGE-----'>>expect-test_expect_successGPG\-'creating a signed tag with rfc1991''-gittag-s-m"RFC1991 signed tag"rfc1991-signed-tag$commit&&-get_tag_msgrfc1991-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag with rfc1991''+echo"rfc1991">gpghome/gpg.conf&&+msg="RFC1991 signed tag"&&+name="rfc1991-signed-tag"+gen_header$name$commitcommit$time>expect<<-EOF&&+$msg+-----BEGINPGPMESSAGE-----+EOF+gittag-s-m"$msg"$name$commit&&+get_header$name|test_cmpexpect-'-cat>fakeeditor<<'EOF'-#!/bin/sh+test_expect_successGPG'reediting a signed tag body omits signature''+cat<<-\EOF|write_scriptfakeeditor&& cp"$1"actual EOF-chmod+xfakeeditor--test_expect_successGPG\-'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&-GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&+GIT_EDITOR=./fakeeditor\+quietgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-test_expect_successGPG\-'verifying rfc1991 signature''-gittag-vrfc1991-signed-tag+test_expect_successGPG'verifying rfc1991 signature''+silentgittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature''+test_expect_successGPG'list tag with rfc1991 signature''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&-gittag-l-n1rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n2rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n999rfc1991-signed-tag>actual&&-test_cmpexpectactual+gittag-l-n1rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n2rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n999rfc1991-signed-tag|test_cmpexpect-'-rm-fgpghome/gpg.conf--test_expect_successGPG\-'verifying rfc1991 signature without --rfc1991''-gittag-vrfc1991-signed-tag+test_expect_successGPG'verifying rfc1991 signature without --rfc1991''+rm-fgpghome/gpg.conf&&+silentgittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature without --rfc1991''-echo"rfc1991-signed-tag RFC1991 signed tag">expect&&-gittag-l-n1rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n2rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n999rfc1991-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'list tag with rfc1991 signature without --rfc1991''+echo>expect"rfc1991-signed-tag RFC1991 signed tag"&&+gittag-l-n1rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n2rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n999rfc1991-signed-tag|test_cmpexpect-'-test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&-GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&+GIT_EDITOR=./fakeeditor\+quietgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'+test_expect_successGPG'git tag -s fails if gpg is misconfigured''# try to sign with bad user.signingkey-gitconfiguser.signingkeyBobTheMouse-test_expect_successGPG\-'git tag -s fails if gpg is misconfigured'\-'test_must_fail git tag -s -m tail tag-gpg-failure'+gitconfiguser.signingkeyBobTheMouse&&+silenttest_must_failgittag-s-mtailtag-gpg-failure&& gitconfig--unsetuser.signingkey+'+test_expect_successGPG'verify signed tag fails when public key is not present''# try to verify without gpg:+rm-rfgpghome&&+silenttest_must_failgittag-vsigned-tag+'-rm-rfgpghome-test_expect_successGPG\-'verify signed tag fails when public key is not present'\-'test_must_fail git tag -v signed-tag'--test_expect_success\-'git tag -a fails if tag annotation is empty''-!(GIT_EDITOR=catgittag-ainitial-comment)+test_expect_success'git tag -a fails if tag annotation is empty''+!(GIT_EDITOR=catsilentgittag-ainitial-comment)'-test_expect_success\-'message in editor has initial comment''-!(GIT_EDITOR=catgittag-ainitial-comment>actual)+test_expect_success'message in editor has initial comment''+!(GIT_EDITOR=catgittag-ainitial-comment>actual2>/dev/null)' test_expect_success'message in editor has initial comment: first line''# check the first line --- should be emptyecho>first.expect&&-sed-e1q<actual>first.actual&&+sed-e1qactual>first.actual&&test_i18ncmpfirst.expectfirst.actual'-test_expect_success\-'message in editor has initial comment: remainder''+test_expect_success'message in editor has initial comment: remainder''# remove commented lines from the remainder -- should be empty>rest.expectsed-e1d-e'/^#/d'<actual>rest.actual&&test_cmprest.expectrest.actual'-get_tag_headerreuse$commitcommit$time>expect-echo"An annotation to be reused">>expect-test_expect_success\-'overwriting an annoted tag should use its previous body''-gittag-a-m"An annotation to be reused"reuse&&-GIT_EDITOR=truegittag-f-areuse&&-get_tag_msgreuse>actual&&-test_cmpexpectactual+test_expect_success'overwriting an annoted tag should use its previous body''+name="reuse"&&+msg="An annotation to be reused"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+reuse+EOF+gittag-a-m"$msg"$name&&+GIT_EDITOR=truegittag-f-a-m"reuse"$name&&+get_header$name|test_cmpexpect-' test_expect_success'filename for the message is relative to cwd''
@@ -1144,7 +1059,7 @@ test_expect_success 'filename for the message is relative to cwd' 'cdsubdir&&gittag-a-Fmsgfile-5tag-from-subdir)&&-gitcat-filetagtag-from-subdir|grep"in sub directory"+gitcat-filetagtag-from-subdir|grep-q"in sub directory"' test_expect_success'filename for the message is relative to cwd''
@@ -1153,110 +1068,91 @@ test_expect_success 'filename for the message is relative to cwd' 'cdsubdir&&gittag-a-Fmsgfile-6tag-from-subdir-2)&&-gitcat-filetagtag-from-subdir-2|grep"in sub directory"+gitcat-filetagtag-from-subdir-2|grep-q"in sub directory"'-# create a few more commits to test --contains--hash1=$(gitrev-parseHEAD)- test_expect_success'creating second commit and tag''+# create a few more commits to test --contains+hash1=$(gitrev-parseHEAD)&&echofoo-2.0>foo&&gitaddfoo&&-gitcommit-msecond&&+gitcommit-q-msecond&&+hash2=$(gitrev-parseHEAD)&&gittagv2.0'-hash2=$(gitrev-parseHEAD)- test_expect_success'creating third commit without tag''echofoo-dev>foo&&gitaddfoo&&-gitcommit-mthird-'-+gitcommit-q-mthird&&hash3=$(gitrev-parseHEAD)+'-# simple linear checks of --continue--cat>expected<<EOF+test_expect_success'checking that first commit is in all tags (hash)''+# simple linear checks of --contains+cat>expect<<-EOF&& v0.2.1 v1.0 v1.0.1 v1.1.3 v2.0 EOF+gittag-l--contains$hash1v*|test_cmpexpect-+'-test_expect_success'checking that first commit is in all tags (hash)'"-gittag-l--contains$hash1v*>actual&&-test_cmpexpectedactual-"-+test_expect_success'checking that first commit is in all tags (tag)''# other ways of specifying the commit-test_expect_success'checking that first commit is in all tags (tag)'"-gittag-l--containsv1.0v*>actual&&-test_cmpexpectedactual-"+gittag-l--containsv1.0v*|test_cmpexpect-+'-test_expect_success'checking that first commit is in all tags (relative)'"-gittag-l--containsHEAD~2v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that first commit is in all tags (relative)''+gittag-l--containsHEAD~2v*|test_cmpexpect-+'-cat>expected<<EOF+test_expect_success'checking that second commit only has one tag''+cat>expect<<-EOF&& v2.0 EOF+gittag-l--contains$hash2v*|test_cmpexpect-+'-test_expect_success'checking that second commit only has one tag'"-gittag-l--contains$hash2v*>actual&&-test_cmpexpectedactual-"---cat>expected<<EOF-EOF--test_expect_success'checking that third commit has no tags'"-gittag-l--contains$hash3v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that third commit has no tags''+>expect+gittag-l--contains$hash3v*|test_cmpexpect-+'# how about a simple merge? test_expect_success'creating simple branch''gitbranchstablev2.0&&-gitcheckoutstable&&+gitcheckout-qstable&&echofoo-3.0>foo&&-gitcommitfoo-mfourth&&+gitcommit-qfoo-mfourth&&+hash4=$(gitrev-parseHEAD)&&gittagv3.0'-hash4=$(gitrev-parseHEAD)--cat>expected<<EOF+test_expect_success'checking that branch head only has one tag''+cat>expect<<-EOF&& v3.0 EOF--test_expect_success'checking that branch head only has one tag'"-gittag-l--contains$hash4v*>actual&&-test_cmpexpectedactual-"+gittag-l--contains$hash4v*|test_cmpexpect-+' test_expect_success'merging original branch into this branch''-gitmerge--strategy=oursmaster&&+gitmerge-q--strategy=oursmaster&&gittagv4.0'-cat>expected<<EOF+test_expect_success'checking that original branch head has one tag now''+cat>expect<<-EOF&& v4.0 EOF+gittag-l--contains$hash3v*|test_cmpexpect-+'-test_expect_success'checking that original branch head has one tag now'"-gittag-l--contains$hash3v*>actual&&-test_cmpexpectedactual-"--cat>expected<<EOF+test_expect_success'checking that initial commit is in all tags''+cat>expect<<-EOF&& v0.2.1 v1.0 v1.0.1
@@ -1265,60 +1161,50 @@ v2.0 v3.0 v4.0 EOF+gittag-l--contains$hash1v*|test_cmpexpect-+'-test_expect_success'checking that initial commit is in all tags'"-gittag-l--contains$hash1v*>actual&&-test_cmpexpectedactual-"--# mixing modes and options: test_expect_success'mixing incompatibles modes and options is forbidden''-test_must_failgittag-a&&-test_must_failgittag-l-v&&-test_must_failgittag-n100&&-test_must_failgittag-l-mmsg&&-test_must_failgittag-l-Fsomefile&&-test_must_failgittag-v-s+# mixing modes and options:+silenttest_must_failgittag-a&&+silenttest_must_failgittag-l-v&&+silenttest_must_failgittag-n100&&+silenttest_must_failgittag-l-mmsg&&+silenttest_must_failgittag-l-Fsomefile&&+silenttest_must_failgittag-v-s&&+silenttest_must_failgittag--points-at=v4.0foo'# check points-at-test_expect_success'--points-at cannot be used in non-list mode''-test_must_failgittag--points-at=v4.0foo-'- test_expect_success'--points-at finds lightweight tags''echov4.0>expect&&-gittag--points-atv4.0>actual&&-test_cmpexpectactual+gittag--points-atv4.0|test_cmpexpect-' test_expect_success'--points-at finds annotated tags of commits''gittag-m"v4.0, annotated"annotated-v4.0v4.0&&echoannotated-v4.0>expect&&-gittag-l--points-atv4.0"annotated*">actual&&-test_cmpexpectactual+gittag-l--points-atv4.0"annotated*"|test_cmpexpect-' test_expect_success'--points-at finds annotated tags of tags''gittag-m"describing the v4.0 tag object"\annotated-again-v4.0annotated-v4.0&&-cat>expect<<-\EOF&&+cat>expect<<-EOF&&annotated-again-v4.0annotated-v4.0EOF-gittag--points-at=annotated-v4.0>actual&&-test_cmpexpectactual+gittag--points-at=annotated-v4.0|test_cmpexpect-' test_expect_success'multiple --points-at are OR-ed together''-cat>expect<<-\EOF&&+cat>expect<<-EOF&&v2.0v3.0EOF-gittag--points-at=v2.0--points-at=v3.0>actual&&-test_cmpexpectactual+gittag--points-at=v2.0--points-at=v3.0|test_cmpexpect-' test_done
@@ -7,15 +7,37 @@ test_description='git tag Testsforoperationswithtags.'+if!test-rtest-lib.sh;then+(cd${0%/*}&&./${0##*/}$@)+exit$?+fi+ ../test-lib.sh ."$TEST_DIRECTORY"/lib-gpg.sh-# creating and listing lightweight tags:+quiet(){"$@">/dev/null;}+silent(){"$@">/dev/null2>&1;}+here(){sed's/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'$@;} tag_exists(){gitshow-ref--quiet--verifyrefs/tags/"$1"}+gen_header(){# name, object, type, time+cat<<-EOF&&+object$2+type$3+tag$1+taggerCOMitter<committer@example.com>$4-0700++EOF+here+}++get_header(){+gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"+}+# todo: git tag -l now returns always zero, when fixed, change this test test_expect_success'listing all tags in an empty tree should succeed''gittag-l&&
@@ -27,36 +49,38 @@ test_expect_success 'listing all tags in an empty tree should output nothing' 'test`gittag|wc-l`-eq0'-test_expect_success'looking for a tag in an empty tree should fail'\-'! (tag_exists mytag)'+test_expect_success'looking for a tag in an empty tree should fail''+!tag_existsmytag+' test_expect_success'creating a tag in an empty tree should fail''-test_must_failgittagmynotag&&+silenttest_must_failgittagmynotag&&!tag_existsmynotag' test_expect_success'creating a tag for HEAD in an empty tree should fail''-test_must_failgittagmytagheadHEAD&&+silenttest_must_failgittagmytagheadHEAD&&!tag_existsmytaghead' test_expect_success'creating a tag for an unknown revision should fail''-test_must_failgittagmytagnorevaaaaaaaaaaa&&+silenttest_must_failgittagmytagnorevaaaaaaaaaaa&&!tag_existsmytagnorev'-# commit used in the tests, test_tick is also called here to freeze the date: test_expect_success'creating a tag using default HEAD should succeed''+# commit used in the tests+# test_tick is also called here to freeze the date:test_tick&&-echofoo>foo&&+echo>foofoo&&gitaddfoo&&-gitcommit-mFoo&&+gitcommit-q-mFoo&&gittagmytag' test_expect_success'listing all tags if one exists should succeed''-gittag-l&&-gittag+quietgittag-l&&+quietgittag' test_expect_success'listing all tags if one exists should output that tag''
@@ -66,36 +90,36 @@ test_expect_success 'listing all tags if one exists should output that tag' '# pattern matching:-test_expect_success'listing a tag using a matching pattern should succeed'\-'git tag -l mytag'+test_expect_success'listing a tag using a matching pattern should succeed''+quietgittag-lmytag+'-test_expect_success\-'listing a tag using a matching pattern should output that tag'\-'test `git tag -l mytag` = mytag'+test_expect_success'listing a tag using a matching pattern should output that tag''+test`gittag-lmytag`=mytag+'# todo: git tag -l now returns always zero, when fixed, change this test-test_expect_success\-'listing tags using a non-matching pattern should suceed'\-'git tag -l xxx'+test_expect_success'listing tags using a non-matching pattern should suceed''+gittag-lxxx+'-test_expect_success\-'listing tags using a non-matching pattern should output nothing'\-'test `git tag -l xxx | wc -l` -eq 0'+test_expect_success'listing tags using a non-matching pattern should output nothing''+test`gittag-lxxx|wc-l`-eq0+'# special cases for creating tags:-test_expect_success\-'trying to create a tag with the name of one existing should fail'\-'test_must_fail git tag mytag'+test_expect_success'trying to create a tag with the name of one existing should fail''+silenttest_must_failgittagmytag+'-test_expect_success\-'trying to create a tag with a non-valid name should fail''+test_expect_success'trying to create a tag with a non-valid name should fail''test`gittag-l|wc-l`-eq1&&-test_must_failgittag""&&-test_must_failgittag.othertag&&-test_must_failgittag"other tag"&&-test_must_failgittag"othertag^"&&-test_must_failgittag"other~tag"&&+silenttest_must_failgittag""&&+silenttest_must_failgittag.othertag&&+silenttest_must_failgittag"other tag"&&+silenttest_must_failgittag"othertag^"&&+silenttest_must_failgittag"other~tag"&&test`gittag-l|wc-l`-eq1'
@@ -108,62 +132,59 @@ test_expect_success 'creating a tag using HEAD directly should succeed' ' test_expect_success'trying to delete an unknown tag should fail''!tag_existsunknown-tag&&-test_must_failgittag-dunknown-tag+silenttest_must_failgittag-dunknown-tag'-cat>expect<<EOF-myhead-mytag-EOF-test_expect_success\-'trying to delete tags without params should succeed and do nothing''-gittag-l>actual&&test_cmpexpectactual&&+test_expect_success'trying to delete tags without params should succeed and do nothing''+cat>expect<<-EOF&&+myhead+mytag+EOF+gittag-l|test_cmpexpect-&&gittag-d&&-gittag-l>actual&&test_cmpexpectactual+gittag-l|test_cmpexpect-'-test_expect_success\-'deleting two existing tags in one command should succeed''+test_expect_success'deleting two existing tags in one command should succeed''tag_existsmytag&&tag_existsmyhead&&-gittag-dmytagmyhead&&+quietgittag-dmytagmyhead&&!tag_existsmytag&&!tag_existsmyhead'-test_expect_success\-'creating a tag with the name of another deleted one should succeed''+test_expect_success'creating a tag with the name of another deleted one should succeed''!tag_existsmytag&&gittagmytag&&tag_existsmytag'-test_expect_success\-'trying to delete two tags, existing and not, should fail in the 2nd''+test_expect_success'trying to delete two tags, existing and not, should fail in the 2nd''tag_existsmytag&&!tag_existsmyhead&&-test_must_failgittag-dmytaganothertag&&+silenttest_must_failgittag-dmytaganothertag&&!tag_existsmytag&&!tag_existsmyhead'-test_expect_success'trying to delete an already deleted tag should fail'\-'test_must_fail git tag -d mytag'+test_expect_success'trying to delete an already deleted tag should fail''+silenttest_must_failgittag-dmytag+'# listing various tags with pattern matching:-cat>expect<<EOF-a1-aa1-cba-t210-t211-v0.2.1-v1.0-v1.0.1-v1.1.3-EOF test_expect_success'listing all tags should print them ordered''+cat>expect<<-EOF&&+a1+aa1+cba+t210+t211+v0.2.1+v1.0+v1.0.1+v1.1.3+EOFgittagv1.0.1&&gittagt211&&gittagaa1&&
@@ -173,561 +194,486 @@ test_expect_success 'listing all tags should print them ordered' 'gittaga1&&gittagv1.0&&gittagt210&&-gittag-l>actual&&-test_cmpexpectactual&&-gittag>actual&&-test_cmpexpectactual+gittag-l|test_cmpexpect-&&+gittag|test_cmpexpect-'-cat>expect<<EOF-a1-aa1-cba-EOF-test_expect_success\-'listing tags with substring as pattern must print those matching''-rm*a*&&-gittag-l"*a*">current&&-test_cmpexpectcurrent-'--cat>expect<<EOF-v0.2.1-v1.0.1-EOF-test_expect_success\-'listing tags with a suffix as pattern must print those matching''-gittag-l"*.1">actual&&-test_cmpexpectactual+test_expect_success'listing tags with substring as pattern must print those matching''+cat>expect<<-EOF&&+a1+aa1+cba+EOF+gittag-l"*a*"|test_cmpexpect-'-cat>expect<<EOF-t210-t211-EOF-test_expect_success\-'listing tags with a prefix as pattern must print those matching''-gittag-l"t21*">actual&&-test_cmpexpectactual+test_expect_success'listing tags with a suffix as pattern must print those matching''+cat>expect<<-EOF&&+v0.2.1+v1.0.1+EOF+gittag-l"*.1"|test_cmpexpect-'-cat>expect<<EOF-a1-EOF-test_expect_success\-'listing tags using a name as pattern must print that one matching''-gittag-la1>actual&&-test_cmpexpectactual+test_expect_success'listing tags with a prefix as pattern must print those matching''+cat>expect<<-EOF&&+t210+t211+EOF+gittag-l"t21*"|test_cmpexpect-'-cat>expect<<EOF-v1.0-EOF-test_expect_success\-'listing tags using a name as pattern must print that one matching''-gittag-lv1.0>actual&&-test_cmpexpectactual+test_expect_success'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&&+a1+EOF+gittag-la1|test_cmpexpect-'-cat>expect<<EOF-v1.0.1-v1.1.3-EOF-test_expect_success\-'listing tags with ? in the pattern should print those matching''-gittag-l"v1.?.?">actual&&-test_cmpexpectactual+test_expect_success'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&&+v1.0+EOF+gittag-lv1.0|test_cmpexpect-'->expect-test_expect_success\-'listing tags using v.* should print nothing because none have v.''-gittag-l"v.*">actual&&-test_cmpexpectactual+test_expect_success'listing tags with ? in the pattern should print those matching''+cat>expect<<-EOF&&+v1.0.1+v1.1.3+EOF+gittag-l"v1.?.?"|test_cmpexpect-'-cat>expect<<EOF-v0.2.1-v1.0-v1.0.1-v1.1.3-EOF-test_expect_success\-'listing tags using v* should print only those having v''-gittag-l"v*">actual&&-test_cmpexpectactual+test_expect_success'listing tags using v.* should print nothing because none have v.''+>expect&&+gittag-l"v.*"|test_cmpexpect-+'++test_expect_success'listing tags using v* should print only those having v''+cat>expect<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+EOF+gittag-l"v*"|test_cmpexpect-' test_expect_success'tag -l can accept multiple patterns''-gittag-l"v1*""v0*">actual&&-test_cmpexpectactual+gittag-l"v1*""v0*"|test_cmpexpect-'# creating and verifying lightweight tags:-test_expect_success\-'a non-annotated tag created without parameters should point to HEAD''+test_expect_success'a non-annotated tag created without parameters should point to HEAD''gittagnon-annotated-tag&&test$(gitcat-file-tnon-annotated-tag)=commit&&test$(gitrev-parsenon-annotated-tag)=$(gitrev-parseHEAD)'-test_expect_success'trying to verify an unknown tag should fail'\-'test_must_fail git tag -v unknown-tag'+test_expect_success'trying to verify an unknown tag should fail''+silenttest_must_failgittag-vunknown-tag+'-test_expect_success\-'trying to verify a non-annotated and non-signed tag should fail'\-'test_must_fail git tag -v non-annotated-tag'+test_expect_success'trying to verify a non-annotated and non-signed tag should fail''+silenttest_must_failgittag-vnon-annotated-tag+'-test_expect_success\-'trying to verify many non-annotated or unknown tags, should fail'\-'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2'+test_expect_success'trying to verify many non-annotated or unknown tags, should fail''+silenttest_must_failgittag-vunknown-tag1non-annotated-tagunknown-tag2+'# creating annotated tags:-get_tag_msg(){-gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"-}--# run test_tick before committing always gives the time in that timezone-get_tag_header(){-cat<<EOF-object$2-type$3-tag$1-taggerCOMitter<committer@example.com>$4-0700--EOF-}--commit=$(gitrev-parseHEAD)-time=$test_tick--get_tag_headerannotated-tag$commitcommit$time>expect-echo"A message">>expect-test_expect_success\-'creating an annotated tag with -m message should succeed''-gittag-m"A message"annotated-tag&&-get_tag_msgannotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating an annotated tag with -m message should succeed''+commit=$(gitrev-parseHEAD)&&+time=$test_tick&&+name="annotated-tag"&&+msg="A message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg+EOF+gittag-m"$msg"$name&&+get_header$name|test_cmpexpect-'-cat>msgfile<<EOF-Anothermessage-inafile.-EOF-get_tag_headerfile-annotated-tag$commitcommit$time>expect-catmsgfile>>expect-test_expect_success\-'creating an annotated tag with -F messagefile should succeed''-gittag-Fmsgfilefile-annotated-tag&&-get_tag_msgfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating an annotated tag with -F messagefile should succeed''+name="file-annotated-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Anothermessage+inafile.+EOF+tail-n2expect>msgfile&&+gittag-Fmsgfile$name&&+get_header$name|test_cmpexpect-'-cat>inputmsg<<EOF-Amessagefromthe-standardinput-EOF-get_tag_headerstdin-annotated-tag$commitcommit$time>expect-catinputmsg>>expect test_expect_success'creating an annotated tag with -F - should succeed''-gittag-F-stdin-annotated-tag<inputmsg&&-get_tag_msgstdin-annotated-tag>actual&&-test_cmpexpectactual+name="stdin-annotated-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Amessagefromthe+standardinput+EOF+tail-n2expect|gittag-F-$name&&+get_header$name|test_cmpexpect-'-test_expect_success\-'trying to create a tag with a non-existing -F file should fail''+test_expect_success'trying to create a tag with a non-existing -F file should fail''!test-fnonexistingfile&&!tag_existsnotag&&-test_must_failgittag-Fnonexistingfilenotag&&+silenttest_must_failgittag-Fnonexistingfilenotag&&!tag_existsnotag'-test_expect_success\-'trying to create tags giving both -m or -F options should fail''-echo"message file 1">msgfile1&&-echo"message file 2">msgfile2&&+test_expect_success'trying to create tags giving both -m or -F options should fail''+echo>msgfile1"message file 1"&&+echo>msgfile2"message file 2"&&!tag_existsmsgtag&&-test_must_failgittag-m"message 1"-Fmsgfile1msgtag&&+silenttest_must_failgittag-m"message 1"-Fmsgfile1msgtag&&!tag_existsmsgtag&&-test_must_failgittag-Fmsgfile1-m"message 1"msgtag&&+silenttest_must_failgittag-Fmsgfile1-m"message 1"msgtag&&!tag_existsmsgtag&&-test_must_failgittag-m"message 1"-Fmsgfile1\+silenttest_must_failgittag-m"message 1"-Fmsgfile1\-m"message 2"msgtag&&!tag_existsmsgtag'# blank and empty messages:-get_tag_headerempty-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with an empty -m message should succeed''-gittag-m""empty-annotated-tag&&-get_tag_msgempty-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with an empty -m message should succeed''+name="empty-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-m""$name&&+get_header$name|test_cmpexpect-'->emptyfile-get_tag_headeremptyfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with an empty -F messagefile should succeed''-gittag-Femptyfileemptyfile-annotated-tag&&-get_tag_msgemptyfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with an empty -F messagefile should succeed''+>emptyfile&&+name="emptyfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Femptyfile$name&&+get_header$name|test_cmpexpect-'-printf'\n\n \n\t\nLeading blank lines\n'>blanksfile-printf'\n\t \t \nRepeated blank lines\n'>>blanksfile-printf'\n\n\nTrailing spaces \t \n'>>blanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>blanksfile-get_tag_headerblanks-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF-Leadingblanklines+test_expect_success'extra blanks in the message for an annotated tag should be removed''+here>blanksfile<<-\EOF&&-Repeatedblanklines+\s\s+\t+Leadingblanklines-Trailingspaces+\t\s\t\s\s+Repeatedblanklines-Trailingblanklines-EOF-test_expect_success\-'extra blanks in the message for an annotated tag should be removed''-gittag-Fblanksfileblanks-annotated-tag&&-get_tag_msgblanks-annotated-tag>actual&&-test_cmpexpectactual+++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+name="blanks-annotated-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+Leadingblanklines++Repeatedblanklines++Trailingspaces++Trailingblanklines+EOF+gittag-Fblanksfile$name&&+get_header$name|test_cmpexpect-'-get_tag_headerblank-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with blank -m message with spaces should succeed''-gittag-m" "blank-annotated-tag&&-get_tag_msgblank-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with blank -m message with spaces should succeed''+name="blank-annotated-tag"&&+gen_header$name$commitcommit$time</dev/null>expect&&+gittag-m" "$name&&+get_header$name|test_cmpexpect-'-echo' '>blankfile-echo''>>blankfile-echo' '>>blankfile-get_tag_headerblankfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with blank -F messagefile with spaces should succeed''-gittag-Fblankfileblankfile-annotated-tag&&-get_tag_msgblankfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with blank -F messagefile with spaces should succeed''+here>blankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+name="blankfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fblankfile$name&&+get_header$name|test_cmpexpect-'-printf' '>blanknonlfile-get_tag_headerblanknonlfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with -F file of spaces and no newline should succeed''-gittag-Fblanknonlfileblanknonlfile-annotated-tag&&-get_tag_msgblanknonlfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with -F file of spaces and no newline should succeed''+printf>blanknonlfile" "&&+name="blanknonlfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fblanknonlfile$name&&+get_header$name|test_cmpexpect-'# messages with commented lines:-cat>commentsfile<<EOF-# A comment+test_expect_success'creating a tag using a -F messagefile with #comments should succeed''+cat>commentsfile<<-EOF&&+# A comment-############-Themessage.-############-Oneline.+############+Themessage.+############+Oneline.-# commented lines-# commented lines+# commented lines+# commented lines-Anotherline.-# comments+Anotherline.+# comments-Lastline.-EOF-get_tag_headercomments-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF-Themessage.-Oneline.+Lastline.+EOF+name="comments-annotated-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+Themessage.+Oneline.-Anotherline.+Anotherline.-Lastline.-EOF-test_expect_success\-'creating a tag using a -F messagefile with #comments should succeed''-gittag-Fcommentsfilecomments-annotated-tag&&-get_tag_msgcomments-annotated-tag>actual&&-test_cmpexpectactual+Lastline.+EOF+gittag-Fcommentsfile$name&&+get_header$name|test_cmpexpect-'-get_tag_headercomment-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with a #comment in the -m message should succeed''-gittag-m"#comment"comment-annotated-tag&&-get_tag_msgcomment-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with a #comment in the -m message should succeed''+name="comment-annotated-tag"&&+gen_header$name$commitcommit$time>expect</dev/null&&+gittag-m"#comment"$name&&+get_header$name|test_cmpexpect-'-echo'#comment'>commentfile-echo''>>commentfile-echo'####'>>commentfile-get_tag_headercommentfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with #comments in the -F messagefile should succeed''-gittag-Fcommentfilecommentfile-annotated-tag&&-get_tag_msgcommentfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with #comments in the -F messagefile should succeed''+cat>commentfile<<-EOF&&+#comment++####+EOF+name="commentfile-annotated-tag"&&+gen_header$name$commitcommit$time>expect</dev/null&&+gittag-Fcommentfile$name&&+get_header$name|test_cmpexpect-'-printf'#comment'>commentnonlfile-get_tag_headercommentnonlfile-annotated-tag$commitcommit$time>expect-test_expect_success\-'creating a tag with a file of #comment and no newline should succeed''-gittag-Fcommentnonlfilecommentnonlfile-annotated-tag&&-get_tag_msgcommentnonlfile-annotated-tag>actual&&-test_cmpexpectactual+test_expect_success'creating a tag with a file of #comment and no newline should succeed''+printf>commentnonlfile"#comment"&&+name="commentnonlfile-annotated-tag"&&+gen_header>expect$name$commitcommit$time</dev/null&&+gittag-Fcommentnonlfile$name&&+get_header$name|test_cmpexpect-'# listing messages for annotated non-signed tags:-test_expect_success\-'listing the one-line message of a non-signed tag should succeed''+test_expect_success'listing the one-line message of a non-signed tag should succeed''gittag-m"A msg"tag-one-line&&-echo"tag-one-line">expect&&-gittag-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-one-line>actual&&-test_cmpexpectactual&&--echo"tag-one-line A msg">expect&&-gittag-n1-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-one-line">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-one-line>actual&&-test_cmpexpectactual&&-gittag-n2-ltag-one-line>actual&&-test_cmpexpectactual&&-gittag-n999-ltag-one-line>actual&&-test_cmpexpectactual+echo>expect"tag-one-line"&&+gittag-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n0-ltag-one-line|test_cmpexpect-&&++echo>expect"tag-one-line A msg"&&+gittag-n1-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n-l|grep"^tag-one-line"|test_cmpexpect-&&+gittag-n1-ltag-one-line|test_cmpexpect-&&+gittag-n2-ltag-one-line|test_cmpexpect-&&+gittag-n999-ltag-one-line|test_cmpexpect-'-test_expect_success\-'listing the zero-lines message of a non-signed tag should succeed''+test_expect_success'listing the zero-lines message of a non-signed tag should succeed''gittag-m""tag-zero-lines&&-echo"tag-zero-lines">expect&&-gittag-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-zero-lines>actual&&-test_cmpexpectactual&&--echo"tag-zero-lines ">expect&&-gittag-n1-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n2-ltag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n999-ltag-zero-lines>actual&&-test_cmpexpectactual+echo>expect"tag-zero-lines"&&+gittag-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n0-ltag-zero-lines|test_cmpexpect-&&++echo>expect"tag-zero-lines "&&+gittag-n1-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n-l|grep"^tag-zero-lines"|test_cmpexpect-&&+gittag-n1-ltag-zero-lines|test_cmpexpect-&&+gittag-n2-ltag-zero-lines|test_cmpexpect-&&+gittag-n999-ltag-zero-lines|test_cmpexpect-'-echo'tag line one'>annotagmsg-echo'tag line two'>>annotagmsg-echo'tag line three'>>annotagmsg-test_expect_success\-'listing many message lines of a non-signed tag should succeed''+test_expect_success'listing many message lines of a non-signed tag should succeed''+cat>annotagmsg<<-EOF&&+taglineone+taglinetwo+taglinethree+EOFgittag-Fannotagmsgtag-lines&&-echo"tag-lines">expect&&-gittag-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n0-ltag-lines|test_cmpexpect-&&echo"tag-lines tag line one">expect&&-gittag-n1-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^tag-lines">actual&&-test_cmpexpectactual&&-gittag-n1-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-n1-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n-l|grep"^tag-lines"|test_cmpexpect-&&+gittag-n1-ltag-lines|test_cmpexpect-&&echo" tag line two">>expect&&-gittag-n2-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n2-ltag-lines>actual&&-test_cmpexpectactual&&+gittag-n2-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n2-ltag-lines|test_cmpexpect-&&echo" tag line three">>expect&&-gittag-n3-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n3-ltag-lines>actual&&-test_cmpexpectactual&&-gittag-n4-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n4-ltag-lines>actual&&-test_cmpexpectactual&&-gittag-n99-l|grep"^ *tag.line">actual&&-test_cmpexpectactual&&-gittag-n99-ltag-lines>actual&&-test_cmpexpectactual+gittag-n3-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n3-ltag-lines|test_cmpexpect-&&+gittag-n4-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n4-ltag-lines|test_cmpexpect-&&+gittag-n99-l|grep"^.*tag.line"|test_cmpexpect-&&+gittag-n99-ltag-lines|test_cmpexpect-' test_expect_success'annotations for blobs are empty''-blob=$(githash-object-w--stdin<<-\EOF-Blobparagraph1.+blob=$(githash-object-w--stdin<<-EOF+Blobparagraph1.-Blobparagraph2.+Blobparagraph2.EOF)&&gittagtag-blob$blob&&-echo"tag-blob ">expect&&-gittag-n1-ltag-blob>actual&&-test_cmpexpectactual+echo>expect"tag-blob "&&+gittag-n1-ltag-blob|test_cmpexpect-'# trying to verify annotated non-signed tags:-test_expect_successGPG\-'trying to verify an annotated non-signed tag should fail''+test_expect_successGPG'trying to verify an annotated non-signed tag should fail''tag_existsannotated-tag&&-test_must_failgittag-vannotated-tag+silenttest_must_failgittag-vannotated-tag'-test_expect_successGPG\-'trying to verify a file-annotated non-signed tag should fail''+test_expect_successGPG'trying to verify a file-annotated non-signed tag should fail''tag_existsfile-annotated-tag&&-test_must_failgittag-vfile-annotated-tag+silenttest_must_failgittag-vfile-annotated-tag'-test_expect_successGPG\-'trying to verify two annotated non-signed tags should fail''+test_expect_successGPG'trying to verify two annotated non-signed tags should fail''tag_existsannotated-tagfile-annotated-tag&&-test_must_failgittag-vannotated-tagfile-annotated-tag+silenttest_must_failgittag-vannotated-tagfile-annotated-tag'# creating and verifying signed tags:-get_tag_headersigned-tag$commitcommit$time>expect-echo'A signed tag message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'creating a signed tag with -m message should succeed''-gittag-s-m"A signed tag message"signed-tag&&-get_tag_msgsigned-tag>actual&&-test_cmpexpectactual+name="signed-tag"&&+msg="A signed tag message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$name&&+get_header$name|test_cmpexpect-'-get_tag_headeru-signed-tag$commitcommit$time>expect-echo'Another message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'sign with a given key id''--gittag-ucommitter@example.com-m"Another message"u-signed-tag&&-get_tag_msgu-signed-tag>actual&&-test_cmpexpectactual-+name="u-signed-tag"&&+msg="Another message"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-ucommitter@example.com-m"$msg"$name&&+get_header$name|test_cmpexpect-' test_expect_successGPG'sign with an unknown id (1)''--test_must_failgittag-uauthor@example.com\+silenttest_must_failgittag-uauthor@example.com\-m"Another message"o-signed-tag-' test_expect_successGPG'sign with an unknown id (2)''--test_must_failgittag-uDEADBEEF-m"Another message"o-signed-tag-+silenttest_must_failgittag-uDEADBEEF-m"Another message"o-signed-tag'-cat>fakeeditor<<'EOF'-#!/bin/sh-test-n"$1"&&exec>"$1"-echoAsignedtagmessage-echofromafakeeditor.-EOF-chmod+xfakeeditor--get_tag_headerimplied-sign$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-u implies signed tag''-GIT_EDITOR=./fakeeditorgittag-uCDDE430Dimplied-sign&&-get_tag_msgimplied-sign>actual&&-test_cmpexpectactual+cat<<-\EOF|write_scriptfakeeditor&&+test-n"$1"&&exec>"$1"+echoAsignedtagmessage+echofromafakeeditor.+EOF+name="implied-signed"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOF+GIT_EDITOR=./fakeeditorgittag-uCDDE430D$name&&+get_header$name|test_cmpexpect-'-cat>sigmsgfile<<EOF-Anothersignedtag-messageinafile.-EOF-get_tag_headerfile-signed-tag$commitcommit$time>expect-catsigmsgfile>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with -F messagefile should succeed''-gittag-s-Fsigmsgfilefile-signed-tag&&-get_tag_msgfile-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag with -F messagefile should succeed''+name="file-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Anothersignedtag+messageinafile.+-----BEGINPGPSIGNATURE-----+EOF+tail-n3expect|head-n2>sigmsgfile+gittag-s-Fsigmsgfile$name&&+get_header$name|test_cmpexpect-'-cat>siginputmsg<<EOF-Asignedtagmessagefrom-thestandardinput-EOF-get_tag_headerstdin-signed-tag$commitcommit$time>expect-catsiginputmsg>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'creating a signed tag with -F - should succeed''-gittag-s-F-stdin-signed-tag<siginputmsg&&-get_tag_msgstdin-signed-tag>actual&&-test_cmpexpectactual+name="stdin-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Asignedtagmessagefrom+thestandardinput+-----BEGINPGPSIGNATURE-----+EOF+tail-n3expect|head-n2|gittag-s-F-$name&&+get_header$name|test_cmpexpect-'-get_tag_headerimplied-annotate$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-s implies annotated tag''-GIT_EDITOR=./fakeeditorgittag-simplied-annotate&&-get_tag_msgimplied-annotate>actual&&-test_cmpexpectactual+name="implied-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOF+GIT_EDITOR=./fakeeditorgittag-s$name&&+get_header$name|test_cmpexpect-'-test_expect_successGPG\-'trying to create a signed tag with non-existing -F file should fail''+test_expect_successGPG'trying to create a signed tag with non-existing -F file should fail''!test-fnonexistingfile&&!tag_existsnosigtag&&-test_must_failgittag-s-Fnonexistingfilenosigtag&&+silenttest_must_failgittag-s-Fnonexistingfilenosigtag&&!tag_existsnosigtag'-test_expect_successGPG'verifying a signed tag should succeed'\-'git tag -v signed-tag'+test_expect_successGPG'verifying a signed tag should succeed''+silentgittag-vsigned-tag+'-test_expect_successGPG'verifying two signed tags in one command should succeed'\-'git tag -v signed-tag file-signed-tag'+test_expect_successGPG'verifying two signed tags in one command should succeed''+silentgittag-vsigned-tagfile-signed-tag+'-test_expect_successGPG\-'verifying many signed and non-signed tags should fail''-test_must_failgittag-vsigned-tagannotated-tag&&-test_must_failgittag-vfile-annotated-tagfile-signed-tag&&-test_must_failgittag-vannotated-tag\+test_expect_successGPG'verifying many signed and non-signed tags should fail''+silenttest_must_failgittag-vsigned-tagannotated-tag&&+silenttest_must_failgittag-vfile-annotated-tagfile-signed-tag&&+silenttest_must_failgittag-vannotated-tag\file-signed-tagfile-annotated-tag&&-test_must_failgittag-vsigned-tagannotated-tagfile-signed-tag+silenttest_must_failgittag-vsigned-tag\+annotated-tagfile-signed-tag' test_expect_successGPG'verifying a forged tag should fail''
@@ -735,405 +681,374 @@ test_expect_success GPG 'verifying a forged tag should fail' 'sed-e"s/signed-tag/forged-tag/"|gitmktag)&&gittagforged-tag$forged&&-test_must_failgittag-vforged-tag+silenttest_must_failgittag-vforged-tag'# blank and empty messages for signed tags:-get_tag_headerempty-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with an empty -m message should succeed''-gittag-s-m""empty-signed-tag&&-get_tag_msgempty-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vempty-signed-tag-'-->sigemptyfile-get_tag_headeremptyfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with an empty -F messagefile should succeed''-gittag-s-Fsigemptyfileemptyfile-signed-tag&&-get_tag_msgemptyfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vemptyfile-signed-tag-'--printf'\n\n \n\t\nLeading blank lines\n'>sigblanksfile-printf'\n\t \t \nRepeated blank lines\n'>>sigblanksfile-printf'\n\n\nTrailing spaces \t \n'>>sigblanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>sigblanksfile-get_tag_headerblanks-signed-tag$commitcommit$time>expect-cat>>expect<<EOF-Leadingblanklines--Repeatedblanklines--Trailingspaces--Trailingblanklines-EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'extra blanks in the message for a signed tag should be removed''-gittag-s-Fsigblanksfileblanks-signed-tag&&-get_tag_msgblanks-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblanks-signed-tag-'--get_tag_headerblank-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a blank -m message should succeed''-gittag-s-m" "blank-signed-tag&&-get_tag_msgblank-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblank-signed-tag-'--echo' '>sigblankfile-echo''>>sigblankfile-echo' '>>sigblankfile-get_tag_headerblankfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with blank -F file with spaces should succeed''-gittag-s-Fsigblankfileblankfile-signed-tag&&-get_tag_msgblankfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vblankfile-signed-tag-'--printf' '>sigblanknonlfile-get_tag_headerblanknonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with spaces and no newline should succeed''-gittag-s-Fsigblanknonlfileblanknonlfile-signed-tag&&-get_tag_msgblanknonlfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vsigned-tag+test_expect_successGPG'creating a signed tag with an empty -m message should succeed''+name="empty-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m""$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with an empty -F messagefile should succeed''+>sigemptyfile&&+name="emptyfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigemptyfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'extra blanks in the message for a signed tag should be removed''+here>sigblanksfile<<-\EOF&&++\s\s+\t+Leadingblanklines++\t\s\t\s\s+Repeatedblanklines++++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+name="blanks-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+Leadingblanklines++Repeatedblanklines++Trailingspaces++Trailingblanklines+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblanksfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with a blank -m message should succeed''+name="blank-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m" "$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with blank -F file with spaces should succeed''+here>sigblankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+name="blankfile-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblankfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with spaces and no newline should succeed''+printf>sigblanknonlfile" "&&+name="blanknonlfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigblanknonlfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name'# messages with commented lines for signed tags:-cat>sigcommentsfile<<EOF-# A comment--############-Themessage.-############-Oneline.---# commented lines-# commented lines--Anotherline.-# comments--Lastline.-EOF-get_tag_headercomments-signed-tag$commitcommit$time>expect-cat>>expect<<EOF-Themessage.-Oneline.--Anotherline.--Lastline.-EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a -F file with #comments should succeed''-gittag-s-Fsigcommentsfilecomments-signed-tag&&-get_tag_msgcomments-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcomments-signed-tag-'--get_tag_headercomment-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with #commented -m message should succeed''-gittag-s-m"#comment"comment-signed-tag&&-get_tag_msgcomment-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcomment-signed-tag-'--echo'#comment'>sigcommentfile-echo''>>sigcommentfile-echo'####'>>sigcommentfile-get_tag_headercommentfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with #commented -F messagefile should succeed''-gittag-s-Fsigcommentfilecommentfile-signed-tag&&-get_tag_msgcommentfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcommentfile-signed-tag-'--printf'#comment'>sigcommentnonlfile-get_tag_headercommentnonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a #comment and no newline should succeed''-gittag-s-Fsigcommentnonlfilecommentnonlfile-signed-tag&&-get_tag_msgcommentnonlfile-signed-tag>actual&&-test_cmpexpectactual&&-gittag-vcommentnonlfile-signed-tag+test_expect_successGPG'creating a signed tag with a -F file with #comments should succeed''+cat>sigcommentsfile<<-EOF&&+# A comment++############+Themessage.+############+Oneline.+++# commented lines+# commented lines++Anotherline.+# comments++Lastline.+EOF+name="comments-signed-tag"&&+gen_header>expect$name$commitcommit$time<<-EOF&&+Themessage.+Oneline.++Anotherline.++Lastline.+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentsfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with #commented -m message should succeed''+name="comment-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"#comment"$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with #commented -F messagefile should succeed''+cat>sigcommentfile<<-EOF&&+#comment++####+EOF+name="commentfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name+'++test_expect_successGPG'creating a signed tag with a #comment and no newline should succeed''+printf"#comment">sigcommentnonlfile&&+name="commentnonlfile-signed-tag"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-Fsigcommentnonlfile$name&&+get_header$name|test_cmpexpect-&&+silentgittag-v$name'# listing messages for signed tags:-test_expect_successGPG\-'listing the one-line message of a signed tag should succeed''+test_expect_successGPG'listing the one-line message of a signed tag should succeed''gittag-s-m"A message line signed"stag-one-line&&echo"stag-one-line">expect&&-gittag-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-one-line>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n0-lstag-one-line|test_cmpexpect-&&echo"stag-one-line A message line signed">expect&&-gittag-n1-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-one-line">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-one-line>actual&&-test_cmpexpectactual&&-gittag-n2-lstag-one-line>actual&&-test_cmpexpectactual&&-gittag-n999-lstag-one-line>actual&&-test_cmpexpectactual+gittag-n1-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n-l|grep"^stag-one-line"|test_cmpexpect-&&+gittag-n1-lstag-one-line|test_cmpexpect-&&+gittag-n2-lstag-one-line|test_cmpexpect-&&+gittag-n999-lstag-one-line|test_cmpexpect-'-test_expect_successGPG\-'listing the zero-lines message of a signed tag should succeed''+test_expect_successGPG'listing the zero-lines message of a signed tag should succeed''gittag-s-m""stag-zero-lines&&echo"stag-zero-lines">expect&&-gittag-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-zero-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n0-lstag-zero-lines|test_cmpexpect-&&echo"stag-zero-lines ">expect&&-gittag-n1-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-zero-lines">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n2-lstag-zero-lines>actual&&-test_cmpexpectactual&&-gittag-n999-lstag-zero-lines>actual&&-test_cmpexpectactual-'--echo'stag line one'>sigtagmsg-echo'stag line two'>>sigtagmsg-echo'stag line three'>>sigtagmsg-test_expect_successGPG\-'listing many message lines of a signed tag should succeed''+gittag-n1-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n-l|grep"^stag-zero-lines"|test_cmpexpect-&&+gittag-n1-lstag-zero-lines|test_cmpexpect-&&+gittag-n2-lstag-zero-lines|test_cmpexpect-&&+gittag-n999-lstag-zero-lines|test_cmpexpect-+'++test_expect_successGPG'listing many message lines of a signed tag should succeed''+cat>sigtagmsg<<-EOF&&+staglineone+staglinetwo+staglinethree+EOFgittag-s-Fsigtagmsgstag-lines&&echo"stag-lines">expect&&-gittag-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n0-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n0-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n0-lstag-lines|test_cmpexpect-&&echo"stag-lines stag line one">expect&&-gittag-n1-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n-l|grep"^stag-lines">actual&&-test_cmpexpectactual&&-gittag-n1-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-n1-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n-l|grep"^stag-lines"|test_cmpexpect-&&+gittag-n1-lstag-lines|test_cmpexpect-&&echo" stag line two">>expect&&-gittag-n2-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n2-lstag-lines>actual&&-test_cmpexpectactual&&+gittag-n2-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n2-lstag-lines|test_cmpexpect-&&echo" stag line three">>expect&&-gittag-n3-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n3-lstag-lines>actual&&-test_cmpexpectactual&&-gittag-n4-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n4-lstag-lines>actual&&-test_cmpexpectactual&&-gittag-n99-l|grep"^ *stag.line">actual&&-test_cmpexpectactual&&-gittag-n99-lstag-lines>actual&&-test_cmpexpectactual-'--# tags pointing to objects different from commits:--tree=$(gitrev-parseHEAD^{tree})-blob=$(gitrev-parseHEAD:foo)-tag=$(gitrev-parsesigned-tag2>/dev/null)--get_tag_headertree-signed-tag$treetree$time>expect-echo"A message for a tree">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to a tree should succeed''-gittag-s-m"A message for a tree"tree-signed-tagHEAD^{tree}&&-get_tag_msgtree-signed-tag>actual&&-test_cmpexpectactual+gittag-n3-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n3-lstag-lines|test_cmpexpect-&&+gittag-n4-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n4-lstag-lines|test_cmpexpect-&&+gittag-n99-l|grep"^.*stag.line"|test_cmpexpect-&&+gittag-n99-lstag-lines|test_cmpexpect-+'+++test_expect_successGPG'creating a signed tag pointing to a tree should succeed''+# tags pointing to objects different from commits:+tree=$(gitrev-parseHEAD^{tree})&&+blob=$(gitrev-parseHEAD:foo)&&+tag=$(gitrev-parsesigned-tag)&&+name="tree-signed-tag"&&+msg="A message for a tree"&&+gen_header$name$treetree$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$nameHEAD^{tree}&&+get_header$name|test_cmpexpect-'-get_tag_headerblob-signed-tag$blobblob$time>expect-echo"A message for a blob">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to a blob should succeed''-gittag-s-m"A message for a blob"blob-signed-tagHEAD:foo&&-get_tag_msgblob-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag pointing to a blob should succeed''+msg="A message for a blob"&&+name="blob-signed-tag"&&+gen_header$name$blobblob$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$nameHEAD:foo&&+get_header$name|test_cmpexpect-'-get_tag_headertag-signed-tag$tagtag$time>expect-echo"A message for another tag">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag pointing to another tag should succeed''-gittag-s-m"A message for another tag"tag-signed-tagsigned-tag&&-get_tag_msgtag-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag pointing to another tag should succeed''+msg="A message for another tag"&&+name="tag-signed-tag"&&+gen_header$name$tagtag$time>expect<<-EOF&&+$msg+-----BEGINPGPSIGNATURE-----+EOF+gittag-s-m"$msg"$namesigned-tag&&+get_header$name|test_cmpexpect-'# usage with rfc1991 signatures-echo"rfc1991">gpghome/gpg.conf-get_tag_headerrfc1991-signed-tag$commitcommit$time>expect-echo"RFC1991 signed tag">>expect-echo'-----BEGIN PGP MESSAGE-----'>>expect-test_expect_successGPG\-'creating a signed tag with rfc1991''-gittag-s-m"RFC1991 signed tag"rfc1991-signed-tag$commit&&-get_tag_msgrfc1991-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'creating a signed tag with rfc1991''+echo"rfc1991">gpghome/gpg.conf&&+msg="RFC1991 signed tag"&&+name="rfc1991-signed-tag"+gen_header$name$commitcommit$time>expect<<-EOF&&+$msg+-----BEGINPGPMESSAGE-----+EOF+gittag-s-m"$msg"$name$commit&&+get_header$name|test_cmpexpect-'-cat>fakeeditor<<'EOF'-#!/bin/sh-cp"$1"actual-EOF-chmod+xfakeeditor--test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''+cat<<-\EOF|write_scriptfakeeditor&&+cp"$1"actual+EOFecho"RFC1991 signed tag">expect&&-GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&+GIT_EDITOR=./fakeeditor\+quietgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-test_expect_successGPG\-'verifying rfc1991 signature''-gittag-vrfc1991-signed-tag+test_expect_successGPG'verifying rfc1991 signature''+silentgittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature''+test_expect_successGPG'list tag with rfc1991 signature''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&-gittag-l-n1rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n2rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n999rfc1991-signed-tag>actual&&-test_cmpexpectactual+gittag-l-n1rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n2rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n999rfc1991-signed-tag|test_cmpexpect-'-rm-fgpghome/gpg.conf--test_expect_successGPG\-'verifying rfc1991 signature without --rfc1991''-gittag-vrfc1991-signed-tag+test_expect_successGPG'verifying rfc1991 signature without --rfc1991''+rm-fgpghome/gpg.conf&&+silentgittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature without --rfc1991''-echo"rfc1991-signed-tag RFC1991 signed tag">expect&&-gittag-l-n1rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n2rfc1991-signed-tag>actual&&-test_cmpexpectactual&&-gittag-l-n999rfc1991-signed-tag>actual&&-test_cmpexpectactual+test_expect_successGPG'list tag with rfc1991 signature without --rfc1991''+echo>expect"rfc1991-signed-tag RFC1991 signed tag"&&+gittag-l-n1rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n2rfc1991-signed-tag|test_cmpexpect-&&+gittag-l-n999rfc1991-signed-tag|test_cmpexpect-'-test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&-GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&+GIT_EDITOR=./fakeeditor\+quietgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-# try to sign with bad user.signingkey-gitconfiguser.signingkeyBobTheMouse-test_expect_successGPG\-'git tag -s fails if gpg is misconfigured'\-'test_must_fail git tag -s -m tail tag-gpg-failure'-gitconfig--unsetuser.signingkey--# try to verify without gpg:+test_expect_successGPG'git tag -s fails if gpg is misconfigured''+# try to sign with bad user.signingkey+gitconfiguser.signingkeyBobTheMouse&&+silenttest_must_failgittag-s-mtailtag-gpg-failure&&+gitconfig--unsetuser.signingkey+'-rm-rfgpghome-test_expect_successGPG\-'verify signed tag fails when public key is not present'\-'test_must_fail git tag -v signed-tag'+test_expect_successGPG'verify signed tag fails when public key is not present''+# try to verify without gpg:+rm-rfgpghome&&+silenttest_must_failgittag-vsigned-tag+'-test_expect_success\-'git tag -a fails if tag annotation is empty''-!(GIT_EDITOR=catgittag-ainitial-comment)+test_expect_success'git tag -a fails if tag annotation is empty''+!(GIT_EDITOR=catsilentgittag-ainitial-comment)'-test_expect_success\-'message in editor has initial comment''-!(GIT_EDITOR=catgittag-ainitial-comment>actual)+test_expect_success'message in editor has initial comment''+!(GIT_EDITOR=catgittag-ainitial-comment>actual2>/dev/null)' test_expect_success'message in editor has initial comment: first line''# check the first line --- should be emptyecho>first.expect&&-sed-e1q<actual>first.actual&&+sed-e1qactual>first.actual&&test_i18ncmpfirst.expectfirst.actual'-test_expect_success\-'message in editor has initial comment: remainder''+test_expect_success'message in editor has initial comment: remainder''# remove commented lines from the remainder -- should be empty>rest.expectsed-e1d-e'/^#/d'<actual>rest.actual&&test_cmprest.expectrest.actual'-get_tag_headerreuse$commitcommit$time>expect-echo"An annotation to be reused">>expect-test_expect_success\-'overwriting an annoted tag should use its previous body''-gittag-a-m"An annotation to be reused"reuse&&-GIT_EDITOR=truegittag-f-areuse&&-get_tag_msgreuse>actual&&-test_cmpexpectactual+test_expect_success'overwriting an annoted tag should use its previous body''+name="reuse"&&+msg="An annotation to be reused"&&+gen_header$name$commitcommit$time>expect<<-EOF&&+reuse+EOF+gittag-a-m"$msg"$name&&+GIT_EDITOR=truegittag-f-a-m"reuse"$name&&+get_header$name|test_cmpexpect-' test_expect_success'filename for the message is relative to cwd''
@@ -1144,7 +1059,7 @@ test_expect_success 'filename for the message is relative to cwd' 'cdsubdir&&gittag-a-Fmsgfile-5tag-from-subdir)&&-gitcat-filetagtag-from-subdir|grep"in sub directory"+gitcat-filetagtag-from-subdir|grep-q"in sub directory"' test_expect_success'filename for the message is relative to cwd''
@@ -1153,172 +1068,143 @@ test_expect_success 'filename for the message is relative to cwd' 'cdsubdir&&gittag-a-Fmsgfile-6tag-from-subdir-2)&&-gitcat-filetagtag-from-subdir-2|grep"in sub directory"+gitcat-filetagtag-from-subdir-2|grep-q"in sub directory"'-# create a few more commits to test --contains--hash1=$(gitrev-parseHEAD)- test_expect_success'creating second commit and tag''+# create a few more commits to test --contains+hash1=$(gitrev-parseHEAD)&&echofoo-2.0>foo&&gitaddfoo&&-gitcommit-msecond&&+gitcommit-q-msecond&&+hash2=$(gitrev-parseHEAD)&&gittagv2.0'-hash2=$(gitrev-parseHEAD)- test_expect_success'creating third commit without tag''echofoo-dev>foo&&gitaddfoo&&-gitcommit-mthird+gitcommit-q-mthird&&+hash3=$(gitrev-parseHEAD)+'++test_expect_success'checking that first commit is in all tags (hash)''+# simple linear checks of --contains+cat>expect<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+v2.0+EOF+gittag-l--contains$hash1v*|test_cmpexpect-'-hash3=$(gitrev-parseHEAD)--# 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)'"-gittag-l--contains$hash1v*>actual&&-test_cmpexpectedactual-"--# other ways of specifying the commit-test_expect_success'checking that first commit is in all tags (tag)'"-gittag-l--containsv1.0v*>actual&&-test_cmpexpectedactual-"--test_expect_success'checking that first commit is in all tags (relative)'"-gittag-l--containsHEAD~2v*>actual&&-test_cmpexpectedactual-"--cat>expected<<EOF-v2.0-EOF--test_expect_success'checking that second commit only has one tag'"-gittag-l--contains$hash2v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that first commit is in all tags (tag)''+# other ways of specifying the commit+gittag-l--containsv1.0v*|test_cmpexpect-+'+test_expect_success'checking that first commit is in all tags (relative)''+gittag-l--containsHEAD~2v*|test_cmpexpect-+'-cat>expected<<EOF-EOF+test_expect_success'checking that second commit only has one tag''+cat>expect<<-EOF&&+v2.0+EOF+gittag-l--contains$hash2v*|test_cmpexpect-+'-test_expect_success'checking that third commit has no tags'"-gittag-l--contains$hash3v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that third commit has no tags''+>expect+gittag-l--contains$hash3v*|test_cmpexpect-+'# how about a simple merge? test_expect_success'creating simple branch''gitbranchstablev2.0&&-gitcheckoutstable&&-echofoo-3.0>foo&&-gitcommitfoo-mfourth&&+gitcheckout-qstable&&+echofoo-3.0>foo&&+gitcommit-qfoo-mfourth&&+hash4=$(gitrev-parseHEAD)&&gittagv3.0'-hash4=$(gitrev-parseHEAD)--cat>expected<<EOF-v3.0-EOF--test_expect_success'checking that branch head only has one tag'"-gittag-l--contains$hash4v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that branch head only has one tag''+cat>expect<<-EOF&&+v3.0+EOF+gittag-l--contains$hash4v*|test_cmpexpect-+' test_expect_success'merging original branch into this branch''-gitmerge--strategy=oursmaster&&+gitmerge-q--strategy=oursmaster&&gittagv4.0'-cat>expected<<EOF-v4.0-EOF--test_expect_success'checking that original branch head has one tag now'"-gittag-l--contains$hash3v*>actual&&-test_cmpexpectedactual-"--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'"-gittag-l--contains$hash1v*>actual&&-test_cmpexpectedactual-"+test_expect_success'checking that original branch head has one tag now''+cat>expect<<-EOF&&+v4.0+EOF+gittag-l--contains$hash3v*|test_cmpexpect-+'++test_expect_success'checking that initial commit is in all tags''+cat>expect<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+v2.0+v3.0+v4.0+EOF+gittag-l--contains$hash1v*|test_cmpexpect-+'-# mixing modes and options: test_expect_success'mixing incompatibles modes and options is forbidden''-test_must_failgittag-a&&-test_must_failgittag-l-v&&-test_must_failgittag-n100&&-test_must_failgittag-l-mmsg&&-test_must_failgittag-l-Fsomefile&&-test_must_failgittag-v-s+# mixing modes and options:+silenttest_must_failgittag-a&&+silenttest_must_failgittag-l-v&&+silenttest_must_failgittag-n100&&+silenttest_must_failgittag-l-mmsg&&+silenttest_must_failgittag-l-Fsomefile&&+silenttest_must_failgittag-v-s&&+silenttest_must_failgittag--points-at=v4.0foo'# check points-at-test_expect_success'--points-at cannot be used in non-list mode''-test_must_failgittag--points-at=v4.0foo-'- test_expect_success'--points-at finds lightweight tags''echov4.0>expect&&-gittag--points-atv4.0>actual&&-test_cmpexpectactual+gittag--points-atv4.0|test_cmpexpect-' test_expect_success'--points-at finds annotated tags of commits''gittag-m"v4.0, annotated"annotated-v4.0v4.0&&echoannotated-v4.0>expect&&-gittag-l--points-atv4.0"annotated*">actual&&-test_cmpexpectactual+gittag-l--points-atv4.0"annotated*"|test_cmpexpect-' test_expect_success'--points-at finds annotated tags of tags''gittag-m"describing the v4.0 tag object"\annotated-again-v4.0annotated-v4.0&&-cat>expect<<-\EOF&&-annotated-again-v4.0-annotated-v4.0+cat>expect<<-EOF&&+annotated-again-v4.0+annotated-v4.0EOF-gittag--points-at=annotated-v4.0>actual&&-test_cmpexpectactual+gittag--points-at=annotated-v4.0|test_cmpexpect-' test_expect_success'multiple --points-at are OR-ed together''-cat>expect<<-\EOF&&-v2.0-v3.0+cat>expect<<-EOF&&+v2.0+v3.0EOF-gittag--points-at=v2.0--points-at=v3.0>actual&&-test_cmpexpectactual+gittag--points-at=v2.0--points-at=v3.0|test_cmpexpect-' test_done
DON'T DO THIS. It loses the exit code of the git invocation.
(And it is contrary to my effort to move all test_cmp away from being used
in a pipeline because I want to use a comparator tool that does not
understand '-' as stdin.)
-- Hannes
DON'T DO THIS. It loses the exit code of the git invocation.
(And it is contrary to my effort to move all test_cmp away from being used
in a pipeline because I want to use a comparator tool that does not
understand '-' as stdin.)
OK, with bash, one could get that from PIPESTATUS, but that doesn't help if
you're not using bash or desire a different comparator.
Thanks,
TomG
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:12
I [off-list ref] wrote:
Per request, the following series modernize the style of the respective
test scripts. The common themes are:
- Guard setup with test_expect_success
- Single-quoted, tab prefaced test blocks of < 80 cols
- Redirect unwanted output
- Use a "here" filter for some expect generation
I also used pipelines to validate expected results rather than temporary
files, i.e.
TEST | test_cmp expect -
vs. TEST >actual && test_cmp expect actual
Since the later three patches have a lot of whitespace change, I've included an
alternate, PATCH-w series that filters these for more substantive review.
However, even the filtered series is very large causing me to second guess
whether such style modernization should be pursued; so, I look forward to your
input.
The following series is a much less ambitious modernization of these tests.
This version does NOT:
- Support running with t/TEST.sh vs. (cd t && ./TEST.sh)
- Redirect unwanted output
- Pipeline test_cmp
- Rewrite blocks to be less than 80 columns
This version DOES:
- Guard setup with test_expect_success
(in one case, a shell loop was unwound to facilitate this)
- Single-quoted, tab prefaced test blocks
- >FILE instead of > FILE redirection style
- Use a sed filter to process formatted whitespace test cases
I've also included PATCHv2-w for review alternatives.
Thanks,
Tom Grennan (5):
t7004 (tag): modernize style
t5512 (ls-remote): modernize style
t3200 (branch): modernize style
t0040 (parse-options): modernize style
t6300 (for-each-ref): modernize style
t/t7004-tag.sh | 828 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 447 insertions(+), 381 deletions(-)
--
1.7.8
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:12
- Guard setup with test_expect_success
- Single-quoted, tab prefaced test blocks
- Use >FILE instead of > FILE
- Use a "here" filter for generation of expect files with mixed tabs and
spaces
Signed-off-by: Tom Grennan <redacted>
---
t/t7004-tag.sh | 828 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 447 insertions(+), 381 deletions(-)
@@ -27,8 +27,9 @@ test_expect_success 'listing all tags in an empty tree should output nothing' 'test`gittag|wc-l`-eq0'-test_expect_success'looking for a tag in an empty tree should fail'\-'! (tag_exists mytag)'+test_expect_success'looking for a tag in an empty tree should fail''+!tag_existsmytag+' test_expect_success'creating a tag in an empty tree should fail''test_must_failgittagmynotag&&
@@ -66,27 +67,32 @@ test_expect_success 'listing all tags if one exists should output that tag' '# pattern matching:-test_expect_success'listing a tag using a matching pattern should succeed'\-'git tag -l mytag'+test_expect_success'listing a tag using a matching pattern should succeed''+gittag-lmytag+' test_expect_success\-'listing a tag using a matching pattern should output that tag'\-'test `git tag -l mytag` = mytag'+'listing a tag using a matching pattern should output that tag''+test`gittag-lmytag`=mytag+'# todo: git tag -l now returns always zero, when fixed, change this test test_expect_success\-'listing tags using a non-matching pattern should suceed'\-'git tag -l xxx'+'listing tags using a non-matching pattern should suceed''+gittag-lxxx+' test_expect_success\-'listing tags using a non-matching pattern should output nothing'\-'test `git tag -l xxx | wc -l` -eq 0'+'listing tags using a non-matching pattern should output nothing''+test`gittag-lxxx|wc-l`-eq0+'# special cases for creating tags: test_expect_success\-'trying to create a tag with the name of one existing should fail'\-'test_must_fail git tag mytag'+'trying to create a tag with the name of one existing should fail''+test_must_failgittagmytag+' test_expect_success\'trying to create a tag with a non-valid name should fail''
@@ -111,15 +117,17 @@ test_expect_success 'trying to delete an unknown tag should fail' 'test_must_failgittag-dunknown-tag'-cat>expect<<EOF-myhead-mytag-EOF test_expect_success\'trying to delete tags without params should succeed and do nothing''-gittag-l>actual&&test_cmpexpectactual&&+cat>expect<<-EOF&&+myhead+mytag+EOF+gittag-l>actual&&+test_cmpexpectactual&&gittag-d&&-gittag-l>actual&&test_cmpexpectactual+gittag-l>actual&&+test_cmpexpectactual' test_expect_success\
@@ -147,23 +155,25 @@ test_expect_success \!tag_existsmyhead'-test_expect_success'trying to delete an already deleted tag should fail'\-'test_must_fail git tag -d mytag'+test_expect_success\+'trying to delete an already deleted tag should fail''+test_must_failgittag-dmytag+'# listing various tags with pattern matching:-cat>expect<<EOF-a1-aa1-cba-t210-t211-v0.2.1-v1.0-v1.0.1-v1.1.3-EOF test_expect_success'listing all tags should print them ordered''+cat>expect<<-EOF&&+a1+aa1+cba+t210+t211+v0.2.1+v1.0+v1.0.1+v1.1.3+EOFgittagv1.0.1&&gittagt211&&gittagaa1&&
@@ -173,88 +183,88 @@ test_expect_success 'listing all tags should print them ordered' 'gittaga1&&gittagv1.0&&gittagt210&&-gittag-l>actual&&+gittag-l>actual&&test_cmpexpectactual&&-gittag>actual&&+gittag>actual&&test_cmpexpectactual'-cat>expect<<EOF-a1-aa1-cba-EOF test_expect_success\'listing tags with substring as pattern must print those matching''+cat>expect<<-EOF&&+a1+aa1+cba+EOFrm*a*&&-gittag-l"*a*">current&&+gittag-l"*a*">current&&test_cmpexpectcurrent'-cat>expect<<EOF-v0.2.1-v1.0.1-EOF test_expect_success\'listing tags with a suffix as pattern must print those matching''-gittag-l"*.1">actual&&+cat>expect<<-EOF&&+v0.2.1+v1.0.1+EOF+gittag-l"*.1">actual&&test_cmpexpectactual'-cat>expect<<EOF-t210-t211-EOF test_expect_success\'listing tags with a prefix as pattern must print those matching''-gittag-l"t21*">actual&&+cat>expect<<-EOF&&+t210+t211+EOF+gittag-l"t21*">actual&&test_cmpexpectactual'-cat>expect<<EOF-a1-EOF test_expect_success\'listing tags using a name as pattern must print that one matching''-gittag-la1>actual&&+cat>expect<<-EOF&&+a1+EOF+gittag-la1>actual&&test_cmpexpectactual'-cat>expect<<EOF-v1.0-EOF test_expect_success\'listing tags using a name as pattern must print that one matching''-gittag-lv1.0>actual&&+cat>expect<<-EOF&&+v1.0+EOF+gittag-lv1.0>actual&&test_cmpexpectactual'-cat>expect<<EOF-v1.0.1-v1.1.3-EOF test_expect_success\'listing tags with ? in the pattern should print those matching''-gittag-l"v1.?.?">actual&&+cat>expect<<-EOF&&+v1.0.1+v1.1.3+EOF+gittag-l"v1.?.?">actual&&test_cmpexpectactual'->expect test_expect_success\'listing tags using v.* should print nothing because none have v.''-gittag-l"v.*">actual&&+>expect&&+gittag-l"v.*">actual&&test_cmpexpectactual'-cat>expect<<EOF-v0.2.1-v1.0-v1.0.1-v1.1.3-EOF test_expect_success\'listing tags using v* should print only those having v''-gittag-l"v*">actual&&+cat>expect<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+EOF+gittag-l"v*">actual&&test_cmpexpectactual'
@@ -272,66 +282,73 @@ test_expect_success \test$(gitrev-parsenon-annotated-tag)=$(gitrev-parseHEAD)'-test_expect_success'trying to verify an unknown tag should fail'\-'test_must_fail git tag -v unknown-tag'+test_expect_success'trying to verify an unknown tag should fail''+test_must_failgittag-vunknown-tag+' test_expect_success\-'trying to verify a non-annotated and non-signed tag should fail'\-'test_must_fail git tag -v non-annotated-tag'+'trying to verify a non-annotated and non-signed tag should fail''+test_must_failgittag-vnon-annotated-tag+' test_expect_success\-'trying to verify many non-annotated or unknown tags, should fail'\-'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2'+'trying to verify many non-annotated or unknown tags, should fail''+test_must_failgittag-vunknown-tag1non-annotated-tagunknown-tag2+'# creating annotated tags:+here='s/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'+ get_tag_msg(){gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"}# run test_tick before committing always gives the time in that timezone get_tag_header(){-cat<<EOF-object$2-type$3-tag$1-taggerCOMitter<committer@example.com>$4-0700+# name, object, type, time+cat<<-EOF&&+object$2+type$3+tag$1+taggerCOMitter<committer@example.com>$4-0700-EOF+EOF+sed-e"$here"}-commit=$(gitrev-parseHEAD)-time=$test_tick--get_tag_headerannotated-tag$commitcommit$time>expect-echo"A message">>expect test_expect_success\'creating an annotated tag with -m message should succeed''+commit=$(gitrev-parseHEAD)&&+time=$test_tick&&+get_tag_headerannotated-tag$commitcommit$time\+>expect<<-EOF&&+Amessage+EOFgittag-m"A message"annotated-tag&&get_tag_msgannotated-tag>actual&&test_cmpexpectactual'-cat>msgfile<<EOF-Anothermessage-inafile.-EOF-get_tag_headerfile-annotated-tag$commitcommit$time>expect-catmsgfile>>expect test_expect_success\'creating an annotated tag with -F messagefile should succeed''+cat>msgfile<<-EOF&&+Amessagefromthe+standardinput+EOF+get_tag_headerfile-annotated-tag$commitcommit$time>expect<msgfilegittag-Fmsgfilefile-annotated-tag&&get_tag_msgfile-annotated-tag>actual&&test_cmpexpectactual'-cat>inputmsg<<EOF-Amessagefromthe-standardinput-EOF-get_tag_headerstdin-annotated-tag$commitcommit$time>expect-catinputmsg>>expect test_expect_success'creating an annotated tag with -F - should succeed''+cat>inputmsg<<-EOF&&+Amessagefromthe+standardinput+EOF+get_tag_headerstdin-annotated-tag$commitcommit$time\+>expect<inputmsggittag-F-stdin-annotated-tag<inputmsg&&get_tag_msgstdin-annotated-tag>actual&&test_cmpexpectactual
@@ -361,67 +378,87 @@ test_expect_success \# blank and empty messages:-get_tag_headerempty-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with an empty -m message should succeed''+>emptyfile&&+get_tag_headerempty-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-m""empty-annotated-tag&&get_tag_msgempty-annotated-tag>actual&&test_cmpexpectactual'->emptyfile-get_tag_headeremptyfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with an empty -F messagefile should succeed''+get_tag_headeremptyfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Femptyfileemptyfile-annotated-tag&&get_tag_msgemptyfile-annotated-tag>actual&&test_cmpexpectactual'-printf'\n\n \n\t\nLeading blank lines\n'>blanksfile-printf'\n\t \t \nRepeated blank lines\n'>>blanksfile-printf'\n\n\nTrailing spaces \t \n'>>blanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>blanksfile-get_tag_headerblanks-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF-Leadingblanklines+test_expect_success\+'extra blanks in the message for an annotated tag should be removed''+sed-e"$here">blanksfile<<-\EOF&&-Repeatedblanklines+\s\s+\t+Leadingblanklines-Trailingspaces+\t\s\t\s\s+Repeatedblanklines-Trailingblanklines-EOF-test_expect_success\-'extra blanks in the message for an annotated tag should be removed''+++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+get_tag_headerblanks-annotated-tag$commitcommit$time\+>expect<<-EOF&&+Leadingblanklines++Repeatedblanklines++Trailingspaces++Trailingblanklines+EOFgittag-Fblanksfileblanks-annotated-tag&&get_tag_msgblanks-annotated-tag>actual&&test_cmpexpectactual'-get_tag_headerblank-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with blank -m message with spaces should succeed''+get_tag_headerblank-annotated-tag$commitcommit$time>expect<emptyfile&&gittag-m" "blank-annotated-tag&&get_tag_msgblank-annotated-tag>actual&&test_cmpexpectactual'-echo' '>blankfile-echo''>>blankfile-echo' '>>blankfile-get_tag_headerblankfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with blank -F messagefile with spaces should succeed''+sed-e"$here">blankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+get_tag_headerblankfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fblankfileblankfile-annotated-tag&&get_tag_msgblankfile-annotated-tag>actual&&test_cmpexpectactual'-printf' '>blanknonlfile-get_tag_headerblanknonlfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with -F file of spaces and no newline should succeed''+printf" ">blanknonlfile&&+get_tag_headerblanknonlfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fblanknonlfileblanknonlfile-annotated-tag&&get_tag_msgblanknonlfile-annotated-tag>actual&&test_cmpexpectactual
@@ -429,62 +466,67 @@ test_expect_success \# messages with commented lines:-cat>commentsfile<<EOF-# A comment+test_expect_success\+'creating a tag using a -F messagefile with #comments should succeed''+cat>commentsfile<<-EOF&&+# A comment-############-Themessage.-############-Oneline.+############+Themessage.+############+Oneline.-# commented lines-# commented lines+# commented lines+# commented lines-Anotherline.-# comments+Anotherline.+# comments-Lastline.-EOF-get_tag_headercomments-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF-Themessage.-Oneline.+Lastline.+EOF+get_tag_headercomments-annotated-tag$commitcommit$time\+>expect<<-EOF&&+Themessage.+Oneline.-Anotherline.+Anotherline.-Lastline.-EOF-test_expect_success\-'creating a tag using a -F messagefile with #comments should succeed''+Lastline.+EOFgittag-Fcommentsfilecomments-annotated-tag&&get_tag_msgcomments-annotated-tag>actual&&test_cmpexpectactual'-get_tag_headercomment-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with a #comment in the -m message should succeed''+get_tag_headercomment-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-m"#comment"comment-annotated-tag&&get_tag_msgcomment-annotated-tag>actual&&test_cmpexpectactual'-echo'#comment'>commentfile-echo''>>commentfile-echo'####'>>commentfile-get_tag_headercommentfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with #comments in the -F messagefile should succeed''+cat>commentfile<<-EOF&&+#comment++####+EOF+get_tag_headercommentfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fcommentfilecommentfile-annotated-tag&&get_tag_msgcommentfile-annotated-tag>actual&&test_cmpexpectactual'-printf'#comment'>commentnonlfile-get_tag_headercommentnonlfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with a file of #comment and no newline should succeed''+printf"#comment">commentnonlfile&&+get_tag_headercommentnonlfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fcommentnonlfilecommentnonlfile-annotated-tag&&get_tag_msgcommentnonlfile-annotated-tag>actual&&test_cmpexpectactual
@@ -542,11 +584,13 @@ test_expect_success \test_cmpexpectactual'-echo'tag line one'>annotagmsg-echo'tag line two'>>annotagmsg-echo'tag line three'>>annotagmsg test_expect_success\'listing many message lines of a non-signed tag should succeed''+cat>annotagmsg<<-EOF&&+taglineone+taglinetwo+taglinethree+EOFgittag-Fannotagmsgtag-lines&&echo"tag-lines">expect&&
@@ -588,9 +632,9 @@ test_expect_success \ test_expect_success'annotations for blobs are empty''blob=$(githash-object-w--stdin<<-\EOF-Blobparagraph1.+Blobparagraph1.-Blobparagraph2.+Blobparagraph2.EOF)&&gittagtag-blob$blob&&
@@ -621,20 +665,22 @@ test_expect_success GPG \# creating and verifying signed tags:-get_tag_headersigned-tag$commitcommit$time>expect-echo'A signed tag message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'creating a signed tag with -m message should succeed''+test_expect_successGPG\+'creating a signed tag with -m message should succeed''+get_tag_headersigned-tag$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A signed tag message"signed-tag&&get_tag_msgsigned-tag>actual&&test_cmpexpectactual'-get_tag_headeru-signed-tag$commitcommit$time>expect-echo'Another message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'sign with a given key id''-+get_tag_headeru-signed-tag$commitcommit$time>expect<<-EOF&&+Anothermessage+-----BEGINPGPSIGNATURE-----+EOFgittag-ucommitter@example.com-m"Another message"u-signed-tag&&get_tag_msgu-signed-tag>actual&&test_cmpexpectactual
@@ -654,54 +700,54 @@ test_expect_success GPG 'sign with an unknown id (2)' ''-cat>fakeeditor<<'EOF'-#!/bin/sh-test-n"$1"&&exec>"$1"-echoAsignedtagmessage-echofromafakeeditor.-EOF-chmod+xfakeeditor--get_tag_headerimplied-sign$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-u implies signed tag''+write_scriptfakeeditor<<-\EOF&&+test-n"$1"&&exec>"$1"+echoAsignedtagmessage+echofromafakeeditor.+EOF+get_tag_headerimplied-sign$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOFGIT_EDITOR=./fakeeditorgittag-uCDDE430Dimplied-sign&&get_tag_msgimplied-sign>actual&&test_cmpexpectactual'-cat>sigmsgfile<<EOF-Anothersignedtag-messageinafile.-EOF-get_tag_headerfile-signed-tag$commitcommit$time>expect-catsigmsgfile>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with -F messagefile should succeed''+cat>sigmsgfile<<-EOF+Anothersignedtag+messageinafile.+EOF+get_tag_headerfile-signed-tag$commitcommit$time>expect<sigmsgfile+echo"-----BEGIN PGP SIGNATURE-----">>expectgittag-s-Fsigmsgfilefile-signed-tag&&get_tag_msgfile-signed-tag>actual&&test_cmpexpectactual'-cat>siginputmsg<<EOF-Asignedtagmessagefrom-thestandardinput-EOF-get_tag_headerstdin-signed-tag$commitcommit$time>expect-catsiginputmsg>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'creating a signed tag with -F - should succeed''+cat>siginputmsg<<-EOF+Asignedtagmessagefrom+thestandardinput+EOF+get_tag_headerstdin-signed-tag$commitcommit$time\+>expect<siginputmsg&&+echo"-----BEGIN PGP SIGNATURE-----">>expectgittag-s-F-stdin-signed-tag<siginputmsg&&get_tag_msgstdin-signed-tag>actual&&test_cmpexpectactual'-get_tag_headerimplied-annotate$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-s implies annotated tag''+get_tag_headerimplied-annotate$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOFGIT_EDITOR=./fakeeditorgittag-simplied-annotate&&get_tag_msgimplied-annotate>actual&&test_cmpexpectactual
@@ -715,11 +761,14 @@ test_expect_success GPG \!tag_existsnosigtag'-test_expect_successGPG'verifying a signed tag should succeed'\-'git tag -v signed-tag'+test_expect_successGPG'verifying a signed tag should succeed''+gittag-vsigned-tag+'-test_expect_successGPG'verifying two signed tags in one command should succeed'\-'git tag -v signed-tag file-signed-tag'+test_expect_successGPG\+'verifying two signed tags in one command should succeed''+gittag-vsigned-tagfile-signed-tag+' test_expect_successGPG\'verifying many signed and non-signed tags should fail''
@@ -740,149 +789,181 @@ test_expect_success GPG 'verifying a forged tag should fail' '# blank and empty messages for signed tags:-get_tag_headerempty-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with an empty -m message should succeed''+get_tag_headerempty-signed-tag$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m""empty-signed-tag&&get_tag_msgempty-signed-tag>actual&&test_cmpexpectactual&&gittag-vempty-signed-tag'->sigemptyfile-get_tag_headeremptyfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with an empty -F messagefile should succeed''+>sigemptyfile&&+get_tag_headeremptyfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigemptyfileemptyfile-signed-tag&&get_tag_msgemptyfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vemptyfile-signed-tag'-printf'\n\n \n\t\nLeading blank lines\n'>sigblanksfile-printf'\n\t \t \nRepeated blank lines\n'>>sigblanksfile-printf'\n\n\nTrailing spaces \t \n'>>sigblanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>sigblanksfile-get_tag_headerblanks-signed-tag$commitcommit$time>expect-cat>>expect<<EOF-Leadingblanklines+test_expect_successGPG\+'extra blanks in the message for a signed tag should be removed''+sed-e"$here">sigblanksfile<<-\EOF&&-Repeatedblanklines+\s\s+\t+Leadingblanklines-Trailingspaces+\t\s\t\s\s+Repeatedblanklines-Trailingblanklines-EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'extra blanks in the message for a signed tag should be removed''+++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+get_tag_headerblanks-signed-tag$commitcommit$time\+>expect<<-EOF&&+Leadingblanklines++Repeatedblanklines++Trailingspaces++Trailingblanklines+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigblanksfileblanks-signed-tag&&get_tag_msgblanks-signed-tag>actual&&test_cmpexpectactual&&gittag-vblanks-signed-tag'-get_tag_headerblank-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with a blank -m message should succeed''+get_tag_headerblank-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m" "blank-signed-tag&&get_tag_msgblank-signed-tag>actual&&test_cmpexpectactual&&gittag-vblank-signed-tag'-echo' '>sigblankfile-echo''>>sigblankfile-echo' '>>sigblankfile-get_tag_headerblankfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with blank -F file with spaces should succeed''+sed-e"$here">sigblankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+get_tag_headerblankfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigblankfileblankfile-signed-tag&&get_tag_msgblankfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vblankfile-signed-tag'-printf' '>sigblanknonlfile-get_tag_headerblanknonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with spaces and no newline should succeed''+printf>sigblanknonlfile" "&&+get_tag_headerblanknonlfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigblanknonlfileblanknonlfile-signed-tag&&get_tag_msgblanknonlfile-signed-tag>actual&&test_cmpexpectactual&&-gittag-vsigned-tag+gittag-vblanknonlfile-signed-tag'# messages with commented lines for signed tags:-cat>sigcommentsfile<<EOF-# A comment+test_expect_successGPG\+'creating a signed tag with a -F file with #comments should succeed''+cat>sigcommentsfile<<-EOF&&+# A comment-############-Themessage.-############-Oneline.+############+Themessage.+############+Oneline.-# commented lines-# commented lines+# commented lines+# commented lines-Anotherline.-# comments+Anotherline.+# comments-Lastline.-EOF-get_tag_headercomments-signed-tag$commitcommit$time>expect-cat>>expect<<EOF-Themessage.-Oneline.+Lastline.+EOF+get_tag_headercomments-signed-tag$commitcommit$time\+>expect<<-EOF&&+Themessage.+Oneline.-Anotherline.+Anotherline.-Lastline.-EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a -F file with #comments should succeed''+Lastline.+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigcommentsfilecomments-signed-tag&&get_tag_msgcomments-signed-tag>actual&&test_cmpexpectactual&&gittag-vcomments-signed-tag'-get_tag_headercomment-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with #commented -m message should succeed''+get_tag_headercomment-signed-tag$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"#comment"comment-signed-tag&&get_tag_msgcomment-signed-tag>actual&&test_cmpexpectactual&&gittag-vcomment-signed-tag'-echo'#comment'>sigcommentfile-echo''>>sigcommentfile-echo'####'>>sigcommentfile-get_tag_headercommentfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with #commented -F messagefile should succeed''+cat>sigcommentfile<<-EOF&&+#comment++####+EOF+get_tag_headercommentfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigcommentfilecommentfile-signed-tag&&get_tag_msgcommentfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vcommentfile-signed-tag'-printf'#comment'>sigcommentnonlfile-get_tag_headercommentnonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with a #comment and no newline should succeed''+printf"#comment">sigcommentnonlfile&&+get_tag_headercommentnonlfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigcommentnonlfilecommentnonlfile-signed-tag&&get_tag_msgcommentnonlfile-signed-tag>actual&&test_cmpexpectactual&&
@@ -941,11 +1022,13 @@ test_expect_success GPG \test_cmpexpectactual'-echo'stag line one'>sigtagmsg-echo'stag line two'>>sigtagmsg-echo'stag line three'>>sigtagmsg test_expect_successGPG\'listing many message lines of a signed tag should succeed''+cat>sigtagmsg<<-EOF&&+staglineone+staglinetwo+staglinethree+EOFgittag-s-Fsigtagmsgstag-lines&&echo"stag-lines">expect&&
@@ -987,72 +1070,68 @@ test_expect_success GPG \# tags pointing to objects different from commits:-tree=$(gitrev-parseHEAD^{tree})-blob=$(gitrev-parseHEAD:foo)-tag=$(gitrev-parsesigned-tag2>/dev/null)--get_tag_headertree-signed-tag$treetree$time>expect-echo"A message for a tree">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to a tree should succeed''+tree=$(gitrev-parseHEAD^{tree})&&+blob=$(gitrev-parseHEAD:foo)&&+tag=$(gitrev-parsesigned-tag)&&+get_tag_headertree-signed-tag$treetree$time>expect<<-EOF&&+Amessageforatree+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for a tree"tree-signed-tagHEAD^{tree}&&get_tag_msgtree-signed-tag>actual&&test_cmpexpectactual'-get_tag_headerblob-signed-tag$blobblob$time>expect-echo"A message for a blob">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to a blob should succeed''+get_tag_headerblob-signed-tag$blobblob$time>expect<<-EOF&&+Amessageforablob+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for a blob"blob-signed-tagHEAD:foo&&get_tag_msgblob-signed-tag>actual&&test_cmpexpectactual'-get_tag_headertag-signed-tag$tagtag$time>expect-echo"A message for another tag">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to another tag should succeed''+get_tag_headertag-signed-tag$tagtag$time>expect<<-EOF&&+Amessageforanothertag+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for another tag"tag-signed-tagsigned-tag&&get_tag_msgtag-signed-tag>actual&&test_cmpexpectactual'# usage with rfc1991 signatures-echo"rfc1991">gpghome/gpg.conf-get_tag_headerrfc1991-signed-tag$commitcommit$time>expect-echo"RFC1991 signed tag">>expect-echo'-----BEGIN PGP MESSAGE-----'>>expect-test_expect_successGPG\-'creating a signed tag with rfc1991''+test_expect_successGPG'creating a signed tag with rfc1991''+echo"rfc1991">gpghome/gpg.conf&&+get_tag_headerrfc1991-signed-tag$commitcommit$time>expect<<-EOF&&+RFC1991signedtag+-----BEGINPGPMESSAGE-----+EOFgittag-s-m"RFC1991 signed tag"rfc1991-signed-tag$commit&&get_tag_msgrfc1991-signed-tag>actual&&test_cmpexpectactual'-cat>fakeeditor<<'EOF'-#!/bin/sh-cp"$1"actual-EOF-chmod+xfakeeditor--test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''+write_scriptfakeeditor<<-\EOF&&+cp"$1"actual+EOFecho"RFC1991 signed tag">expect&&GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-test_expect_successGPG\-'verifying rfc1991 signature''+test_expect_successGPG'verifying rfc1991 signature''gittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature''+test_expect_successGPG'list tag with rfc1991 signature''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&gittag-l-n1rfc1991-signed-tag>actual&&test_cmpexpectactual&&
@@ -1062,15 +1141,12 @@ test_expect_success GPG \test_cmpexpectactual'-rm-fgpghome/gpg.conf--test_expect_successGPG\-'verifying rfc1991 signature without --rfc1991''+test_expect_successGPG'verifying rfc1991 signature without --rfc1991''+rm-fgpghome/gpg.conf&&gittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature without --rfc1991''+test_expect_successGPG'list tag with rfc1991 signature without --rfc1991''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&gittag-l-n1rfc1991-signed-tag>actual&&test_cmpexpectactual&&
@@ -1080,26 +1156,26 @@ test_expect_success GPG \test_cmpexpectactual'-test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-# try to sign with bad user.signingkey-gitconfiguser.signingkeyBobTheMouse-test_expect_successGPG\-'git tag -s fails if gpg is misconfigured'\-'test_must_fail git tag -s -m tail tag-gpg-failure'-gitconfig--unsetuser.signingkey+test_expect_successGPG'git tag -s fails if gpg is misconfigured''+# try to sign with bad user.signingkey+gitconfiguser.signingkeyBobTheMouse&&+test_must_failgittag-s-mtailtag-gpg-failure&&+gitconfig--unsetuser.signingkey+'# try to verify without gpg:-rm-rfgpghome test_expect_successGPG\-'verify signed tag fails when public key is not present'\-'test_must_fail git tag -v signed-tag'+'verify signed tag fails when public key is not present''+rm-rfgpghome&&+test_must_failgittag-vsigned-tag+' test_expect_success\'git tag -a fails if tag annotation is empty''
@@ -1108,7 +1184,7 @@ test_expect_success \ test_expect_success\'message in editor has initial comment''-!(GIT_EDITOR=catgittag-ainitial-comment>actual)+!(GIT_EDITOR=catgittag-ainitial-comment>actual)' test_expect_success'message in editor has initial comment: first line''
@@ -1126,12 +1202,13 @@ test_expect_success \test_cmprest.expectrest.actual'-get_tag_headerreuse$commitcommit$time>expect-echo"An annotation to be reused">>expect test_expect_success\'overwriting an annoted tag should use its previous body''+get_tag_headerreuse$commitcommit$time>expect<<-EOF&&+reuse+EOFgittag-a-m"An annotation to be reused"reuse&&-GIT_EDITOR=truegittag-f-areuse&&+GIT_EDITOR=truegittag-f-a-m"reuse"reuse&&get_tag_msgreuse>actual&&test_cmpexpectactual'
@@ -1158,118 +1235,107 @@ test_expect_success 'filename for the message is relative to cwd' '# create a few more commits to test --contains-hash1=$(gitrev-parseHEAD)- test_expect_success'creating second commit and tag''+hash1=$(gitrev-parseHEAD)&&echofoo-2.0>foo&&gitaddfoo&&gitcommit-msecond&&+hash2=$(gitrev-parseHEAD)&&gittagv2.0'-hash2=$(gitrev-parseHEAD)- test_expect_success'creating third commit without tag''echofoo-dev>foo&&gitaddfoo&&-gitcommit-mthird+gitcommit-mthird&&+hash3=$(gitrev-parseHEAD)'-hash3=$(gitrev-parseHEAD)--# simple linear checks of --continue+# simple linear checks of --contains-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)'"+test_expect_success'checking that first commit is in all tags (hash)''+cat>expected<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+v2.0+EOFgittag-l--contains$hash1v*>actual&&test_cmpexpectedactual-"+'# other ways of specifying the commit-test_expect_success'checking that first commit is in all tags (tag)'"+test_expect_success'checking that first commit is in all tags (tag)''gittag-l--containsv1.0v*>actual&&test_cmpexpectedactual-"+'-test_expect_success'checking that first commit is in all tags (relative)'"+test_expect_success'checking that first commit is in all tags (relative)''gittag-l--containsHEAD~2v*>actual&&test_cmpexpectedactual-"--cat>expected<<EOF-v2.0-EOF+'-test_expect_success'checking that second commit only has one tag'"+test_expect_success'checking that second commit only has one tag''+cat>expected<<-EOF&&+v2.0+EOFgittag-l--contains$hash2v*>actual&&test_cmpexpectedactual-"---cat>expected<<EOF-EOF+'-test_expect_success'checking that third commit has no tags'"+test_expect_success'checking that third commit has no tags''+cat>expected<<-EOF&&+EOFgittag-l--contains$hash3v*>actual&&test_cmpexpectedactual-"+'# how about a simple merge? test_expect_success'creating simple branch''gitbranchstablev2.0&&-gitcheckoutstable&&-echofoo-3.0>foo&&+gitcheckoutstable&&+echofoo-3.0>foo&&gitcommitfoo-mfourth&&+hash4=$(gitrev-parseHEAD)&&gittagv3.0'-hash4=$(gitrev-parseHEAD)--cat>expected<<EOF-v3.0-EOF--test_expect_success'checking that branch head only has one tag'"+test_expect_success'checking that branch head only has one tag''+cat>expected<<-EOF&&+v3.0+EOFgittag-l--contains$hash4v*>actual&&test_cmpexpectedactual-"+' test_expect_success'merging original branch into this branch''gitmerge--strategy=oursmaster&&-gittagv4.0+gittagv4.0'-cat>expected<<EOF-v4.0-EOF--test_expect_success'checking that original branch head has one tag now'"+test_expect_success'checking that original branch head has one tag now''+cat>expected<<-EOF&&+v4.0+EOFgittag-l--contains$hash3v*>actual&&test_cmpexpectedactual-"--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'"+'++test_expect_success'checking that initial commit is in all tags''+cat>expected<<-EOF&&+v0.2.1+v1.0+v1.0.1+v1.1.3+v2.0+v3.0+v4.0+EOFgittag-l--contains$hash1v*>actual&&test_cmpexpectedactual-"+'# mixing modes and options:
@@ -1305,8 +1371,8 @@ test_expect_success '--points-at finds annotated tags of tags' 'gittag-m"describing the v4.0 tag object"\annotated-again-v4.0annotated-v4.0&&cat>expect<<-\EOF&&-annotated-again-v4.0-annotated-v4.0+annotated-again-v4.0+annotated-v4.0EOFgittag--points-at=annotated-v4.0>actual&&test_cmpexpectactual
@@ -1314,8 +1380,8 @@ test_expect_success '--points-at finds annotated tags of tags' ' test_expect_success'multiple --points-at are OR-ed together''cat>expect<<-\EOF&&-v2.0-v3.0+v2.0+v3.0EOFgittag--points-at=v2.0--points-at=v3.0>actual&&test_cmpexpectactual
@@ -102,11 +102,13 @@ test_expect_success 'use branch.<name>.remote if possible' ''-cat>exp<<EOF-fatal:'refs*master'doesnotappeartobeagitrepository-fatal:Theremoteendhungupunexpectedly-EOF test_expect_success'confuses pattern as remote when no remote specified''+'"+cat>exp<<-EOF+fatal:'refs*master'doesnotappeartobeagitrepository+fatal:Theremoteendhungupunexpectedly+EOF+"'## Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,# confuses <pattern> for <remote>. Although ugly, this behaviour is akin
@@ -138,12 +138,13 @@ test_expect_success 'Check invalid format specifiers are errors' 'test_must_failgitfor-each-ref--format="%(authordate:INVALID)"refs/heads'-cat>expected<<\EOF+test_expect_success'Check unformatted date fields output''+'"+cat>expected<<-EOF&&'refs/heads/master''Mon Jul 3 17:18:43 2006 +0200''Mon Jul 3 17:18:44 2006 +0200''refs/tags/testtag''Mon Jul 3 17:18:45 2006 +0200' EOF--test_expect_success'Check unformatted date fields output''+"'(gitfor-each-ref--shell--format="%(refname) %(committerdate) %(authordate)"refs/heads&&gitfor-each-ref--shell--format="%(refname) %(taggerdate)"refs/tags)>actual&&test_cmpexpectedactual
@@ -171,84 +172,85 @@ test_expect_success 'Check format "relative" date fields output' 'gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual'-cat>expected<<\EOF+test_expect_success'Check format "short" date fields output''+'"+cat>expected<<-EOF'refs/heads/master''2006-07-03''2006-07-03''refs/tags/testtag''2006-07-03' EOF--test_expect_success'Check format "short" date fields output''+"'f=short&&(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Check format "local" date fields output''+'"+cat>expected<<-EOF'refs/heads/master''Mon Jul 3 15:18:43 2006''Mon Jul 3 15:18:44 2006''refs/tags/testtag''Mon Jul 3 15:18:45 2006' EOF--test_expect_success'Check format "local" date fields output''-f=local&&-(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&-gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&+"'+(gitfor-each-ref--shell--format="%(refname) %(committerdate:local) %(authordate:local)"refs/heads&&+gitfor-each-ref--shell--format="%(refname) %(taggerdate:local)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Check format "iso8601" date fields output''+'"+cat>expected<<-EOF'refs/heads/master''2006-07-03 17:18:43 +0200''2006-07-03 17:18:44 +0200''refs/tags/testtag''2006-07-03 17:18:45 +0200' EOF--test_expect_success'Check format "iso8601" date fields output''+"'f=iso8601&&(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Check format "rfc2822" date fields output''+'"+cat>expected<<-EOF'refs/heads/master''Mon, 3 Jul 2006 17:18:43 +0200''Mon, 3 Jul 2006 17:18:44 +0200''refs/tags/testtag''Mon, 3 Jul 2006 17:18:45 +0200' EOF--test_expect_success'Check format "rfc2822" date fields output''+"'f=rfc2822&&(gitfor-each-ref--shell--format="%(refname) %(committerdate:$f) %(authordate:$f)"refs/heads&&gitfor-each-ref--shell--format="%(refname) %(taggerdate:$f)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Verify ascending sort''+cat>expected<<-EOF refs/heads/master refs/remotes/origin/master refs/tags/testtag EOF--test_expect_success'Verify ascending sort''gitfor-each-ref--format="%(refname)"--sort=refname>actual&&test_cmpexpectedactual'--cat>expected<<\EOF+test_expect_success'Verify descending sort''+cat>expected<<-EOF refs/tags/testtag refs/remotes/origin/master refs/heads/master EOF--test_expect_success'Verify descending sort''gitfor-each-ref--format="%(refname)"--sort=-refname>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Quoting style: shell''+'"+cat>expected<<-EOF'refs/heads/master''refs/remotes/origin/master''refs/tags/testtag' EOF--test_expect_success'Quoting style: shell''+"'gitfor-each-ref--shell--format="%(refname)">actual&&test_cmpexpectedactual'
@@ -263,52 +265,51 @@ test_expect_success 'Quoting style: python' 'test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Quoting style: tcl''+cat>expected<<-EOF"refs/heads/master""refs/remotes/origin/master""refs/tags/testtag" EOF--test_expect_success'Quoting style: tcl''gitfor-each-ref--tcl--format="%(refname)">actual&&test_cmpexpectedactual'-foriin"--perl --shell""-s --python""--python --tcl""--tcl --perl";do-test_expect_success"more than one quoting style: $i""-gitfor-each-ref$i2>&1|(readline&&-case\$linein-\"error:morethanonequotingstyle\"*):happy;;-*)false-esac)-"-done--cat>expected<<\EOF+test_expect_success'more than one quoting styles''+cat>expected<<-EOF+error:morethanonequotingstyle?+EOF+gitfor-each-ref--perl--shell2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref-s--python2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref--python--tcl2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref--tcl--perl2>&1|head-n1>actual&&+test_cmpexpectedactual+'+test_expect_success'Check short refname format''+cat>expected<<-EOF master testtag EOF--test_expect_success'Check short refname format''(gitfor-each-ref--format="%(refname:short)"refs/heads&&gitfor-each-ref--format="%(refname:short)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<EOF+test_expect_success'Check short upstream format''+cat>expected<<-EOF origin/master EOF--test_expect_success'Check short upstream format''gitfor-each-ref--format="%(upstream:short)"refs/heads>actual&&test_cmpexpectedactual'-cat>expected<<EOF+test_expect_success'Check short objectname format''+cat>expected<<-EOF 67a36f1 EOF--test_expect_success'Check short objectname format''gitfor-each-ref--format="%(objectname:short)"refs/heads>actual&&test_cmpexpectedactual'
@@ -317,12 +318,11 @@ test_expect_success 'Check for invalid refname format' 'test_must_failgitfor-each-ref--format="%(refname:INVALID)"'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs (strict)''+cat>expected<<-EOF heads/master tags/master EOF--test_expect_success'Check ambiguous head and tag refs (strict)''gitconfig--boolcore.warnambiguousrefstrue&&gitcheckout-bnewtag&&echo"Using $datestamp">one&&
@@ -334,23 +334,21 @@ test_expect_success 'Check ambiguous head and tag refs (strict)' 'test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs (loose)''+cat>expected<<-EOF heads/master master EOF--test_expect_success'Check ambiguous head and tag refs (loose)''gitconfig--boolcore.warnambiguousrefsfalse&&gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&test_cmpexpectedactual'-cat>expected<<\EOF+test_expect_success'Check ambiguous head and tag refs II (loose)''+cat>expected<<-EOF heads/ambiguous ambiguous EOF--test_expect_success'Check ambiguous head and tag refs II (loose)''gitcheckoutmaster&&gittagambiguoustesttag^0&&gitbranchambiguoustesttag^0&&
@@ -369,7 +367,7 @@ test_expect_success 'an unusual tag with an incomplete line' '' test_expect_success'create tag with subject and body content''-cat>>msg<<-\EOF&&+cat>msg<<-\EOF&&thesubjectlinefirstbodyline
@@ -7,15 +7,15 @@ test_description='git branch assorted tests' ../test-lib.sh-test_expect_success\-'prepare a trivial repository'\-'echoHello>A&&+test_expect_success'prepare a trivial repository''+echoHello>A&&gitupdate-index--addA&&gitcommit-m"Initial commit."&&echoWorld>>A&&gitupdate-index--addA&&gitcommit-m"Second commit."&&-HEAD=$(gitrev-parse--verifyHEAD)'+HEAD=$(gitrev-parse--verifyHEAD)+' test_expect_success\'git branch --help should not have created a bogus branch''
@@ -34,59 +34,59 @@ test_expect_success 'branch -h in broken repository' 'grep"[Uu]sage"broken/usage'-test_expect_success\-'git branch abc should create a branch'\-'git branch abc && test_path_is_file .git/refs/heads/abc'+test_expect_success'git branch abc should create a branch''+gitbranchabc&&test_path_is_file.git/refs/heads/abc+'-test_expect_success\-'git branch a/b/c should create a branch'\-'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'+test_expect_success'git branch a/b/c should create a branch''+gitbrancha/b/c&&test_path_is_file.git/refs/heads/a/b/c+'-cat>expect<<EOF+test_expect_success'git branch -l d/e/f should create a branch and a log''+cat>expect<<-EOF$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster EOF-test_expect_success\-'git branch -l d/e/f should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\+GIT_COMMITTER_DATE="2005-05-26 23:30"\gitbranch-ld/e/f&&test_path_is_file.git/refs/heads/d/e/f&&test_path_is_file.git/logs/refs/heads/d/e/f&&-test_cmpexpect.git/logs/refs/heads/d/e/f'+test_cmpexpect.git/logs/refs/heads/d/e/f+'-test_expect_success\-'git branch -d d/e/f should delete a branch and a log'\-'gitbranch-dd/e/f&&+test_expect_success'git branch -d d/e/f should delete a branch and a log''+gitbranch-dd/e/f&&test_path_is_missing.git/refs/heads/d/e/f&&-test_path_is_missing.git/logs/refs/heads/d/e/f'+test_path_is_missing.git/logs/refs/heads/d/e/f+'-test_expect_success\-'git branch j/k should work after branch j has been deleted'\-'gitbranchj&&+test_expect_success'git branch j/k should work after branch j has been deleted''+gitbranchj&&gitbranch-dj&&-gitbranchj/k'+gitbranchj/k+'-test_expect_success\-'git branch l should work after branch l/m has been deleted'\-'gitbranchl/m&&+test_expect_success'git branch l should work after branch l/m has been deleted''+gitbranchl/m&&gitbranch-dl/m&&-gitbranchl'+gitbranchl+'-test_expect_success\-'git branch -m dumps usage'\-'test_expect_code129gitbranch-m2>err&&-grep"[Uu]sage: git branch"err'+test_expect_success'git branch -m dumps usage''+test_expect_code129gitbranch-m2>err&&+grep"[Uu]sage: git branch"err+'-test_expect_success\-'git branch -m m m/m should work'\-'gitbranch-lm&&+test_expect_success'git branch -m m m/m should work''+gitbranch-lm&&gitbranch-mmm/m&&-test_path_is_file.git/logs/refs/heads/m/m'+test_path_is_file.git/logs/refs/heads/m/m+'-test_expect_success\-'git branch -m n/n n should work'\-'gitbranch-ln/n&&+test_expect_success'git branch -m n/n n should work''+gitbranch-ln/n&&gitbranch-mn/nn&&-test_path_is_file.git/logs/refs/heads/n'+test_path_is_file.git/logs/refs/heads/n+' test_expect_success'git branch -m o/o o should fail when o/p exists''gitbrancho/o&&
@@ -160,33 +160,30 @@ test_expect_success 'git branch --list -d t should fail' 'test_path_is_missing.git/refs/heads/t'-mv.git/config.git/config-saved- test_expect_success'git branch -m q q2 without config should succeed''+mv.git/config.git/config-saved&&+test_when_finishedmv.git/config-saved.git/config&&gitbranch-mqq2&&gitbranch-mq2q'-mv.git/config-saved.git/config-+test_expect_success'git branch -m s/s s should work when s/t is deleted'' gitconfigbranch.s/s.dummyHello--test_expect_success\-'git branch -m s/s s should work when s/t is deleted'\-'gitbranch-ls/s&&+gitbranch-ls/s&&test_path_is_file.git/logs/refs/heads/s/s&&gitbranch-ls/t&&test_path_is_file.git/logs/refs/heads/s/t&&gitbranch-ds/t&&gitbranch-ms/ss&&-test_path_is_file.git/logs/refs/heads/s'--test_expect_success'config information was renamed, too'\-"test $(gitconfigbranch.s.dummy) = Hello &&-test_must_failgitconfigbranch.s/s/dummy"+test_path_is_file.git/logs/refs/heads/s+'-test_expect_success'renaming a symref is not allowed'\+test_expect_success'config information was renamed, too''+test$(gitconfigbranch.s.dummy)=Hello&&+test_must_failgitconfigbranch.s/s/dummy'++test_expect_success'renaming a symref is not allowed''gitsymbolic-refrefs/heads/master2refs/heads/master&&test_must_failgitbranch-mmaster2master3&&gitsymbolic-refrefs/heads/master2&&
@@ -194,115 +191,125 @@ test_expect_success 'renaming a symref is not allowed' \test_path_is_missing.git/refs/heads/master3'-test_expect_successSYMLINKS\-'git branch -m u v should fail when the reflog for u is a symlink''+test_expect_successSYMLINKS'git branch -m u v should fail when the reflog for u is a symlink''gitbranch-lu&&mv.git/logs/refs/heads/ureal-u&&ln-sreal-u.git/logs/refs/heads/u&&test_must_failgitbranch-muv'-test_expect_success'test tracking setup via --track'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup via --track''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranch--trackmy1local/master&&test$(gitconfigbranch.my1.remote)=local&&-test$(gitconfigbranch.my1.merge)=refs/heads/master'+test$(gitconfigbranch.my1.merge)=refs/heads/master+'-test_expect_success'test tracking setup (non-wildcard, matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/master:refs/remotes/local/master&&+test_expect_success'test tracking setup (non-wildcard, matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetch\+refs/heads/master:refs/remotes/local/master&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranch--trackmy4local/master&&test$(gitconfigbranch.my4.remote)=local&&-test$(gitconfigbranch.my4.merge)=refs/heads/master'+test$(gitconfigbranch.my4.merge)=refs/heads/master+'-test_expect_success'test tracking setup (non-wildcard, not matching)'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup (non-wildcard, not matching)''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranch--trackmy5local/master&&!test"$(gitconfigbranch.my5.remote)"=local&&-!test"$(gitconfigbranch.my5.merge)"=refs/heads/master'+!test"$(gitconfigbranch.my5.merge)"=refs/heads/master+'-test_expect_success'test tracking setup via config'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'test tracking setup via config''+gitconfigbranch.autosetupmergetrue&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranchmy3local/master&&test$(gitconfigbranch.my3.remote)=local&&-test$(gitconfigbranch.my3.merge)=refs/heads/master'+test$(gitconfigbranch.my3.merge)=refs/heads/master+'-test_expect_success'test overriding tracking setup via --no-track'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'test overriding tracking setup via --no-track''+gitconfigbranch.autosetupmergetrue&&gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&gitbranch--no-trackmy2local/master&&gitconfigbranch.autosetupmergefalse&&!test"$(gitconfigbranch.my2.remote)"=local&&-!test"$(gitconfigbranch.my2.merge)"=refs/heads/master'+!test"$(gitconfigbranch.my2.merge)"=refs/heads/master+'-test_expect_success'no tracking without .fetch entries'\-'gitconfigbranch.autosetupmergetrue&&+test_expect_success'no tracking without .fetch entries''+gitconfigbranch.autosetupmergetrue&&gitbranchmy6s&&gitconfigbranch.automsetupmergefalse&&test-z"$(gitconfigbranch.my6.remote)"&&-test-z"$(gitconfigbranch.my6.merge)"'+test-z"$(gitconfigbranch.my6.merge)"+'-test_expect_success'test tracking setup via --track but deeper'\-'gitconfigremote.local.url.&&+test_expect_success'test tracking setup via --track but deeper''+gitconfigremote.local.url.&&gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&gitbranch--trackmy7local/o/o&&test"$(gitconfigbranch.my7.remote)"=local&&-test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o'+test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o+'-test_expect_success'test deleting branch deletes branch config'\-'gitbranch-dmy7&&+test_expect_success'test deleting branch deletes branch config''+gitbranch-dmy7&&test-z"$(gitconfigbranch.my7.remote)"&&-test-z"$(gitconfigbranch.my7.merge)"'+test-z"$(gitconfigbranch.my7.merge)"+'-test_expect_success'test deleting branch without config'\-'gitbranchmy7s&&+test_expect_success'test deleting branch without config''+gitbranchmy7s&&sha1=$(gitrev-parsemy7|cut-c1-7)&&echo"Deleted branch my7 (was $sha1).">expect&&gitbranch-dmy7>actual2>&1&&-test_i18ncmpexpectactual'+test_i18ncmpexpectactual+'-test_expect_success'test --track without .fetch entries'\-'gitbranch--trackmy8&&+test_expect_success'test --track without .fetch entries''+gitbranch--trackmy8&&test"$(gitconfigbranch.my8.remote)"&&-test"$(gitconfigbranch.my8.merge)"'+test"$(gitconfigbranch.my8.merge)"+'-test_expect_success\-'branch from non-branch HEAD w/autosetupmerge=always'\-'gitconfigbranch.autosetupmergealways&&+test_expect_success'branch from non-branch HEAD w/autosetupmerge=always''+gitconfigbranch.autosetupmergealways&&gitbranchmy9HEAD^&&-gitconfigbranch.autosetupmergefalse'+gitconfigbranch.autosetupmergefalse+'-test_expect_success\-'branch from non-branch HEAD w/--track causes failure'\-'test_must_fail git branch --track my10 HEAD^'+test_expect_success'branch from non-branch HEAD w/--track causes failure''+test_must_failgitbranch--trackmy10HEAD^+'-test_expect_success\-'branch from tag w/--track causes failure'\-'gittagfoobar&&-test_must_failgitbranch--trackmy11foobar'+test_expect_success'branch from tag w/--track causes failure''+gittagfoobar&&+test_must_failgitbranch--trackmy11foobar+'# Keep this test last, as it changes the current branch-cat>expect<<EOF+test_expect_success'git checkout -b g/h/i -l should create a branch and a log''+cat>expect<<-EOF$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster EOF-test_expect_success\-'git checkout -b g/h/i -l should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\+GIT_COMMITTER_DATE="2005-05-26 23:30"\gitcheckout-bg/h/i-lmaster&&test_path_is_file.git/refs/heads/g/h/i&&test_path_is_file.git/logs/refs/heads/g/h/i&&-test_cmpexpect.git/logs/refs/heads/g/h/i'+test_cmpexpect.git/logs/refs/heads/g/h/i+' test_expect_success'checkout -b makes reflog by default''gitcheckoutmaster&&
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:12
- Guard setup with test_expect_success
- Single-quoted, tab prefaced test blocks
- Use >FILE instead of > FILE
- Use a "here" filter for generation of expect files with mixed tabs and
spaces
Signed-off-by: Tom Grennan <redacted>
---
t/t7004-tag.sh | 590 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 328 insertions(+), 262 deletions(-)
@@ -27,8 +27,9 @@ test_expect_success 'listing all tags in an empty tree should output nothing' 'test`gittag|wc-l`-eq0'-test_expect_success'looking for a tag in an empty tree should fail'\-'! (tag_exists mytag)'+test_expect_success'looking for a tag in an empty tree should fail''+!tag_existsmytag+' test_expect_success'creating a tag in an empty tree should fail''test_must_failgittagmynotag&&
@@ -66,27 +67,32 @@ test_expect_success 'listing all tags if one exists should output that tag' '# pattern matching:-test_expect_success'listing a tag using a matching pattern should succeed'\-'git tag -l mytag'+test_expect_success'listing a tag using a matching pattern should succeed''+gittag-lmytag+' test_expect_success\-'listing a tag using a matching pattern should output that tag'\-'test `git tag -l mytag` = mytag'+'listing a tag using a matching pattern should output that tag''+test`gittag-lmytag`=mytag+'# todo: git tag -l now returns always zero, when fixed, change this test test_expect_success\-'listing tags using a non-matching pattern should suceed'\-'git tag -l xxx'+'listing tags using a non-matching pattern should suceed''+gittag-lxxx+' test_expect_success\-'listing tags using a non-matching pattern should output nothing'\-'test `git tag -l xxx | wc -l` -eq 0'+'listing tags using a non-matching pattern should output nothing''+test`gittag-lxxx|wc-l`-eq0+'# special cases for creating tags: test_expect_success\-'trying to create a tag with the name of one existing should fail'\-'test_must_fail git tag mytag'+'trying to create a tag with the name of one existing should fail''+test_must_failgittagmytag+' test_expect_success\'trying to create a tag with a non-valid name should fail''
@@ -111,15 +117,17 @@ test_expect_success 'trying to delete an unknown tag should fail' 'test_must_failgittag-dunknown-tag'-cat>expect<<EOF+test_expect_success\+'trying to delete tags without params should succeed and do nothing''+cat>expect<<-EOF&& myhead mytag EOF-test_expect_success\-'trying to delete tags without params should succeed and do nothing''-gittag-l>actual&&test_cmpexpectactual&&+gittag-l>actual&&+test_cmpexpectactual&&gittag-d&&-gittag-l>actual&&test_cmpexpectactual+gittag-l>actual&&+test_cmpexpectactual' test_expect_success\
@@ -147,12 +155,15 @@ test_expect_success \!tag_existsmyhead'-test_expect_success'trying to delete an already deleted tag should fail'\-'test_must_fail git tag -d mytag'+test_expect_success\+'trying to delete an already deleted tag should fail''+test_must_failgittag-dmytag+'# listing various tags with pattern matching:-cat>expect<<EOF+test_expect_success'listing all tags should print them ordered''+cat>expect<<-EOF&& a1 aa1 cba
@@ -163,7 +174,6 @@ v1.0 v1.0.1 v1.1.3 EOF-test_expect_success'listing all tags should print them ordered''gittagv1.0.1&&gittagt211&&gittagaa1&&
@@ -179,81 +189,81 @@ test_expect_success 'listing all tags should print them ordered' 'test_cmpexpectactual'-cat>expect<<EOF+test_expect_success\+'listing tags with substring as pattern must print those matching''+cat>expect<<-EOF&& a1 aa1 cba EOF-test_expect_success\-'listing tags with substring as pattern must print those matching''rm*a*&&gittag-l"*a*">current&&test_cmpexpectcurrent'-cat>expect<<EOF+test_expect_success\+'listing tags with a suffix as pattern must print those matching''+cat>expect<<-EOF&& v0.2.1 v1.0.1 EOF-test_expect_success\-'listing tags with a suffix as pattern must print those matching''gittag-l"*.1">actual&&test_cmpexpectactual'-cat>expect<<EOF+test_expect_success\+'listing tags with a prefix as pattern must print those matching''+cat>expect<<-EOF&& t210 t211 EOF-test_expect_success\-'listing tags with a prefix as pattern must print those matching''gittag-l"t21*">actual&&test_cmpexpectactual'-cat>expect<<EOF-a1-EOF test_expect_success\'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&&+a1+EOFgittag-la1>actual&&test_cmpexpectactual'-cat>expect<<EOF-v1.0-EOF test_expect_success\'listing tags using a name as pattern must print that one matching''+cat>expect<<-EOF&&+v1.0+EOFgittag-lv1.0>actual&&test_cmpexpectactual'-cat>expect<<EOF+test_expect_success\+'listing tags with ? in the pattern should print those matching''+cat>expect<<-EOF&& v1.0.1 v1.1.3 EOF-test_expect_success\-'listing tags with ? in the pattern should print those matching''gittag-l"v1.?.?">actual&&test_cmpexpectactual'->expect test_expect_success\'listing tags using v.* should print nothing because none have v.''+>expect&&gittag-l"v.*">actual&&test_cmpexpectactual'-cat>expect<<EOF+test_expect_success\+'listing tags using v* should print only those having v''+cat>expect<<-EOF&& v0.2.1 v1.0 v1.0.1 v1.1.3 EOF-test_expect_success\-'listing tags using v* should print only those having v''gittag-l"v*">actual&&test_cmpexpectactual'
@@ -272,66 +282,73 @@ test_expect_success \test$(gitrev-parsenon-annotated-tag)=$(gitrev-parseHEAD)'-test_expect_success'trying to verify an unknown tag should fail'\-'test_must_fail git tag -v unknown-tag'+test_expect_success'trying to verify an unknown tag should fail''+test_must_failgittag-vunknown-tag+' test_expect_success\-'trying to verify a non-annotated and non-signed tag should fail'\-'test_must_fail git tag -v non-annotated-tag'+'trying to verify a non-annotated and non-signed tag should fail''+test_must_failgittag-vnon-annotated-tag+' test_expect_success\-'trying to verify many non-annotated or unknown tags, should fail'\-'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2'+'trying to verify many non-annotated or unknown tags, should fail''+test_must_failgittag-vunknown-tag1non-annotated-tagunknown-tag2+'# creating annotated tags:+here='s/\\s/ /g; s/\\t/\t/g; s/\\n/\n/g'+ get_tag_msg(){gitcat-filetag"$1"|sed-e"/BEGIN PGP/q"}# run test_tick before committing always gives the time in that timezone get_tag_header(){-cat<<EOF+# name, object, type, time+cat<<-EOF&& object$2type$3 tag$1 taggerCOMitter<committer@example.com>$4-0700 EOF+sed-e"$here"}-commit=$(gitrev-parseHEAD)-time=$test_tick--get_tag_headerannotated-tag$commitcommit$time>expect-echo"A message">>expect test_expect_success\'creating an annotated tag with -m message should succeed''+commit=$(gitrev-parseHEAD)&&+time=$test_tick&&+get_tag_headerannotated-tag$commitcommit$time\+>expect<<-EOF&&+Amessage+EOFgittag-m"A message"annotated-tag&&get_tag_msgannotated-tag>actual&&test_cmpexpectactual'-cat>msgfile<<EOF-Anothermessage-inafile.-EOF-get_tag_headerfile-annotated-tag$commitcommit$time>expect-catmsgfile>>expect test_expect_success\'creating an annotated tag with -F messagefile should succeed''+cat>msgfile<<-EOF&&+Amessagefromthe+standardinput+EOF+get_tag_headerfile-annotated-tag$commitcommit$time>expect<msgfilegittag-Fmsgfilefile-annotated-tag&&get_tag_msgfile-annotated-tag>actual&&test_cmpexpectactual'-cat>inputmsg<<EOF+test_expect_success'creating an annotated tag with -F - should succeed''+cat>inputmsg<<-EOF&& Amessagefromthe standardinput EOF-get_tag_headerstdin-annotated-tag$commitcommit$time>expect-catinputmsg>>expect-test_expect_success'creating an annotated tag with -F - should succeed''+get_tag_headerstdin-annotated-tag$commitcommit$time\+>expect<inputmsggittag-F-stdin-annotated-tag<inputmsg&&get_tag_msgstdin-annotated-tag>actual&&test_cmpexpectactual
@@ -361,29 +378,47 @@ test_expect_success \# blank and empty messages:-get_tag_headerempty-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with an empty -m message should succeed''+>emptyfile&&+get_tag_headerempty-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-m""empty-annotated-tag&&get_tag_msgempty-annotated-tag>actual&&test_cmpexpectactual'->emptyfile-get_tag_headeremptyfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with an empty -F messagefile should succeed''+get_tag_headeremptyfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Femptyfileemptyfile-annotated-tag&&get_tag_msgemptyfile-annotated-tag>actual&&test_cmpexpectactual'-printf'\n\n \n\t\nLeading blank lines\n'>blanksfile-printf'\n\t \t \nRepeated blank lines\n'>>blanksfile-printf'\n\n\nTrailing spaces \t \n'>>blanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>blanksfile-get_tag_headerblanks-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF+test_expect_success\+'extra blanks in the message for an annotated tag should be removed''+sed-e"$here">blanksfile<<-\EOF&&++\s\s+\t+Leadingblanklines++\t\s\t\s\s+Repeatedblanklines++++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+get_tag_headerblanks-annotated-tag$commitcommit$time\+>expect<<-EOF&& Leadingblanklines Repeatedblanklines
@@ -392,36 +427,38 @@ Trailing spaces Trailingblanklines EOF-test_expect_success\-'extra blanks in the message for an annotated tag should be removed''gittag-Fblanksfileblanks-annotated-tag&&get_tag_msgblanks-annotated-tag>actual&&test_cmpexpectactual'-get_tag_headerblank-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with blank -m message with spaces should succeed''+get_tag_headerblank-annotated-tag$commitcommit$time>expect<emptyfile&&gittag-m" "blank-annotated-tag&&get_tag_msgblank-annotated-tag>actual&&test_cmpexpectactual'-echo' '>blankfile-echo''>>blankfile-echo' '>>blankfile-get_tag_headerblankfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with blank -F messagefile with spaces should succeed''+sed-e"$here">blankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+get_tag_headerblankfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fblankfileblankfile-annotated-tag&&get_tag_msgblankfile-annotated-tag>actual&&test_cmpexpectactual'-printf' '>blanknonlfile-get_tag_headerblanknonlfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with -F file of spaces and no newline should succeed''+printf" ">blanknonlfile&&+get_tag_headerblanknonlfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fblanknonlfileblanknonlfile-annotated-tag&&get_tag_msgblanknonlfile-annotated-tag>actual&&test_cmpexpectactual
@@ -429,7 +466,9 @@ test_expect_success \# messages with commented lines:-cat>commentsfile<<EOF+test_expect_success\+'creating a tag using a -F messagefile with #comments should succeed''+cat>commentsfile<<-EOF&&# A comment############
@@ -446,8 +485,8 @@ Another line. Lastline. EOF-get_tag_headercomments-annotated-tag$commitcommit$time>expect-cat>>expect<<EOF+get_tag_headercomments-annotated-tag$commitcommit$time\+>expect<<-EOF&& Themessage. Oneline.
@@ -455,36 +494,39 @@ Another line. Lastline. EOF-test_expect_success\-'creating a tag using a -F messagefile with #comments should succeed''gittag-Fcommentsfilecomments-annotated-tag&&get_tag_msgcomments-annotated-tag>actual&&test_cmpexpectactual'-get_tag_headercomment-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with a #comment in the -m message should succeed''+get_tag_headercomment-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-m"#comment"comment-annotated-tag&&get_tag_msgcomment-annotated-tag>actual&&test_cmpexpectactual'-echo'#comment'>commentfile-echo''>>commentfile-echo'####'>>commentfile-get_tag_headercommentfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with #comments in the -F messagefile should succeed''+cat>commentfile<<-EOF&&+#comment++####+EOF+get_tag_headercommentfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fcommentfilecommentfile-annotated-tag&&get_tag_msgcommentfile-annotated-tag>actual&&test_cmpexpectactual'-printf'#comment'>commentnonlfile-get_tag_headercommentnonlfile-annotated-tag$commitcommit$time>expect test_expect_success\'creating a tag with a file of #comment and no newline should succeed''+printf"#comment">commentnonlfile&&+get_tag_headercommentnonlfile-annotated-tag$commitcommit$time\+>expect<emptyfile&&gittag-Fcommentnonlfilecommentnonlfile-annotated-tag&&get_tag_msgcommentnonlfile-annotated-tag>actual&&test_cmpexpectactual
@@ -542,11 +584,13 @@ test_expect_success \test_cmpexpectactual'-echo'tag line one'>annotagmsg-echo'tag line two'>>annotagmsg-echo'tag line three'>>annotagmsg test_expect_success\'listing many message lines of a non-signed tag should succeed''+cat>annotagmsg<<-EOF&&+taglineone+taglinetwo+taglinethree+EOFgittag-Fannotagmsgtag-lines&&echo"tag-lines">expect&&
@@ -621,20 +665,22 @@ test_expect_success GPG \# creating and verifying signed tags:-get_tag_headersigned-tag$commitcommit$time>expect-echo'A signed tag message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'creating a signed tag with -m message should succeed''+test_expect_successGPG\+'creating a signed tag with -m message should succeed''+get_tag_headersigned-tag$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A signed tag message"signed-tag&&get_tag_msgsigned-tag>actual&&test_cmpexpectactual'-get_tag_headeru-signed-tag$commitcommit$time>expect-echo'Another message'>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'sign with a given key id''-+get_tag_headeru-signed-tag$commitcommit$time>expect<<-EOF&&+Anothermessage+-----BEGINPGPSIGNATURE-----+EOFgittag-ucommitter@example.com-m"Another message"u-signed-tag&&get_tag_msgu-signed-tag>actual&&test_cmpexpectactual
@@ -654,54 +700,54 @@ test_expect_success GPG 'sign with an unknown id (2)' ''-cat>fakeeditor<<'EOF'-#!/bin/sh+test_expect_successGPG'-u implies signed tag''+write_scriptfakeeditor<<-\EOF&&test-n"$1"&&exec>"$1"echoAsignedtagmessageechofromafakeeditor. EOF-chmod+xfakeeditor--get_tag_headerimplied-sign$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'-u implies signed tag''+get_tag_headerimplied-sign$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOFGIT_EDITOR=./fakeeditorgittag-uCDDE430Dimplied-sign&&get_tag_msgimplied-sign>actual&&test_cmpexpectactual'-cat>sigmsgfile<<EOF+test_expect_successGPG\+'creating a signed tag with -F messagefile should succeed''+cat>sigmsgfile<<-EOF Anothersignedtag messageinafile. EOF-get_tag_headerfile-signed-tag$commitcommit$time>expect-catsigmsgfile>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with -F messagefile should succeed''+get_tag_headerfile-signed-tag$commitcommit$time>expect<sigmsgfile+echo"-----BEGIN PGP SIGNATURE-----">>expectgittag-s-Fsigmsgfilefile-signed-tag&&get_tag_msgfile-signed-tag>actual&&test_cmpexpectactual'-cat>siginputmsg<<EOF+test_expect_successGPG'creating a signed tag with -F - should succeed''+cat>siginputmsg<<-EOF Asignedtagmessagefrom thestandardinput EOF-get_tag_headerstdin-signed-tag$commitcommit$time>expect-catsiginputmsg>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG'creating a signed tag with -F - should succeed''+get_tag_headerstdin-signed-tag$commitcommit$time\+>expect<siginputmsg&&+echo"-----BEGIN PGP SIGNATURE-----">>expectgittag-s-F-stdin-signed-tag<siginputmsg&&get_tag_msgstdin-signed-tag>actual&&test_cmpexpectactual'-get_tag_headerimplied-annotate$commitcommit$time>expect-./fakeeditor>>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG'-s implies annotated tag''+get_tag_headerimplied-annotate$commitcommit$time>expect<<-EOF&&+Asignedtagmessage+fromafakeeditor.+-----BEGINPGPSIGNATURE-----+EOFGIT_EDITOR=./fakeeditorgittag-simplied-annotate&&get_tag_msgimplied-annotate>actual&&test_cmpexpectactual
@@ -715,11 +761,14 @@ test_expect_success GPG \!tag_existsnosigtag'-test_expect_successGPG'verifying a signed tag should succeed'\-'git tag -v signed-tag'+test_expect_successGPG'verifying a signed tag should succeed''+gittag-vsigned-tag+'-test_expect_successGPG'verifying two signed tags in one command should succeed'\-'git tag -v signed-tag file-signed-tag'+test_expect_successGPG\+'verifying two signed tags in one command should succeed''+gittag-vsigned-tagfile-signed-tag+' test_expect_successGPG\'verifying many signed and non-signed tags should fail''
@@ -740,33 +789,52 @@ test_expect_success GPG 'verifying a forged tag should fail' '# blank and empty messages for signed tags:-get_tag_headerempty-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with an empty -m message should succeed''+get_tag_headerempty-signed-tag$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m""empty-signed-tag&&get_tag_msgempty-signed-tag>actual&&test_cmpexpectactual&&gittag-vempty-signed-tag'->sigemptyfile-get_tag_headeremptyfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with an empty -F messagefile should succeed''+>sigemptyfile&&+get_tag_headeremptyfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigemptyfileemptyfile-signed-tag&&get_tag_msgemptyfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vemptyfile-signed-tag'-printf'\n\n \n\t\nLeading blank lines\n'>sigblanksfile-printf'\n\t \t \nRepeated blank lines\n'>>sigblanksfile-printf'\n\n\nTrailing spaces \t \n'>>sigblanksfile-printf'\nTrailing blank lines\n\n\t \n\n'>>sigblanksfile-get_tag_headerblanks-signed-tag$commitcommit$time>expect-cat>>expect<<EOF+test_expect_successGPG\+'extra blanks in the message for a signed tag should be removed''+sed-e"$here">sigblanksfile<<-\EOF&&++\s\s+\t+Leadingblanklines++\t\s\t\s\s+Repeatedblanklines++++Trailingspaces\s\s\s\s\s\s\t\s\s++Trailingblanklines++\t\s++EOF+get_tag_headerblanks-signed-tag$commitcommit$time\+>expect<<-EOF&& Leadingblanklines Repeatedblanklines
@@ -774,53 +842,61 @@ Repeated blank lines Trailingspaces Trailingblanklines+-----BEGINPGPSIGNATURE----- EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'extra blanks in the message for a signed tag should be removed''gittag-s-Fsigblanksfileblanks-signed-tag&&get_tag_msgblanks-signed-tag>actual&&test_cmpexpectactual&&gittag-vblanks-signed-tag'-get_tag_headerblank-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with a blank -m message should succeed''+get_tag_headerblank-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m" "blank-signed-tag&&get_tag_msgblank-signed-tag>actual&&test_cmpexpectactual&&gittag-vblank-signed-tag'-echo' '>sigblankfile-echo''>>sigblankfile-echo' '>>sigblankfile-get_tag_headerblankfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with blank -F file with spaces should succeed''+sed-e"$here">sigblankfile<<-\EOF&&+\s\s\s\s\s++\s\s+EOF+get_tag_headerblankfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigblankfileblankfile-signed-tag&&get_tag_msgblankfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vblankfile-signed-tag'-printf' '>sigblanknonlfile-get_tag_headerblanknonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with spaces and no newline should succeed''+printf>sigblanknonlfile" "&&+get_tag_headerblanknonlfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigblanknonlfileblanknonlfile-signed-tag&&get_tag_msgblanknonlfile-signed-tag>actual&&test_cmpexpectactual&&-gittag-vsigned-tag+gittag-vblanknonlfile-signed-tag'# messages with commented lines for signed tags:-cat>sigcommentsfile<<EOF+test_expect_successGPG\+'creating a signed tag with a -F file with #comments should succeed''+cat>sigcommentsfile<<-EOF&&# A comment############
@@ -837,52 +913,57 @@ Another line. Lastline. EOF-get_tag_headercomments-signed-tag$commitcommit$time>expect-cat>>expect<<EOF+get_tag_headercomments-signed-tag$commitcommit$time\+>expect<<-EOF&& Themessage. Oneline. Anotherline. Lastline.+-----BEGINPGPSIGNATURE----- EOF-echo'-----BEGIN PGP SIGNATURE-----'>>expect-test_expect_successGPG\-'creating a signed tag with a -F file with #comments should succeed''gittag-s-Fsigcommentsfilecomments-signed-tag&&get_tag_msgcomments-signed-tag>actual&&test_cmpexpectactual&&gittag-vcomments-signed-tag'-get_tag_headercomment-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with #commented -m message should succeed''+get_tag_headercomment-signed-tag$commitcommit$time>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"#comment"comment-signed-tag&&get_tag_msgcomment-signed-tag>actual&&test_cmpexpectactual&&gittag-vcomment-signed-tag'-echo'#comment'>sigcommentfile-echo''>>sigcommentfile-echo'####'>>sigcommentfile-get_tag_headercommentfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with #commented -F messagefile should succeed''+cat>sigcommentfile<<-EOF&&+#comment++####+EOF+get_tag_headercommentfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigcommentfilecommentfile-signed-tag&&get_tag_msgcommentfile-signed-tag>actual&&test_cmpexpectactual&&gittag-vcommentfile-signed-tag'-printf'#comment'>sigcommentnonlfile-get_tag_headercommentnonlfile-signed-tag$commitcommit$time>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag with a #comment and no newline should succeed''+printf"#comment">sigcommentnonlfile&&+get_tag_headercommentnonlfile-signed-tag$commitcommit$time\+>expect<<-EOF&&+-----BEGINPGPSIGNATURE-----+EOFgittag-s-Fsigcommentnonlfilecommentnonlfile-signed-tag&&get_tag_msgcommentnonlfile-signed-tag>actual&&test_cmpexpectactual&&
@@ -941,11 +1022,13 @@ test_expect_success GPG \test_cmpexpectactual'-echo'stag line one'>sigtagmsg-echo'stag line two'>>sigtagmsg-echo'stag line three'>>sigtagmsg test_expect_successGPG\'listing many message lines of a signed tag should succeed''+cat>sigtagmsg<<-EOF&&+staglineone+staglinetwo+staglinethree+EOFgittag-s-Fsigtagmsgstag-lines&&echo"stag-lines">expect&&
@@ -987,72 +1070,68 @@ test_expect_success GPG \# tags pointing to objects different from commits:-tree=$(gitrev-parseHEAD^{tree})-blob=$(gitrev-parseHEAD:foo)-tag=$(gitrev-parsesigned-tag2>/dev/null)--get_tag_headertree-signed-tag$treetree$time>expect-echo"A message for a tree">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to a tree should succeed''+tree=$(gitrev-parseHEAD^{tree})&&+blob=$(gitrev-parseHEAD:foo)&&+tag=$(gitrev-parsesigned-tag)&&+get_tag_headertree-signed-tag$treetree$time>expect<<-EOF&&+Amessageforatree+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for a tree"tree-signed-tagHEAD^{tree}&&get_tag_msgtree-signed-tag>actual&&test_cmpexpectactual'-get_tag_headerblob-signed-tag$blobblob$time>expect-echo"A message for a blob">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to a blob should succeed''+get_tag_headerblob-signed-tag$blobblob$time>expect<<-EOF&&+Amessageforablob+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for a blob"blob-signed-tagHEAD:foo&&get_tag_msgblob-signed-tag>actual&&test_cmpexpectactual'-get_tag_headertag-signed-tag$tagtag$time>expect-echo"A message for another tag">>expect-echo'-----BEGIN PGP SIGNATURE-----'>>expect test_expect_successGPG\'creating a signed tag pointing to another tag should succeed''+get_tag_headertag-signed-tag$tagtag$time>expect<<-EOF&&+Amessageforanothertag+-----BEGINPGPSIGNATURE-----+EOFgittag-s-m"A message for another tag"tag-signed-tagsigned-tag&&get_tag_msgtag-signed-tag>actual&&test_cmpexpectactual'# usage with rfc1991 signatures-echo"rfc1991">gpghome/gpg.conf-get_tag_headerrfc1991-signed-tag$commitcommit$time>expect-echo"RFC1991 signed tag">>expect-echo'-----BEGIN PGP MESSAGE-----'>>expect-test_expect_successGPG\-'creating a signed tag with rfc1991''+test_expect_successGPG'creating a signed tag with rfc1991''+echo"rfc1991">gpghome/gpg.conf&&+get_tag_headerrfc1991-signed-tag$commitcommit$time>expect<<-EOF&&+RFC1991signedtag+-----BEGINPGPMESSAGE-----+EOFgittag-s-m"RFC1991 signed tag"rfc1991-signed-tag$commit&&get_tag_msgrfc1991-signed-tag>actual&&test_cmpexpectactual'-cat>fakeeditor<<'EOF'-#!/bin/sh+test_expect_successGPG'reediting a signed tag body omits signature''+write_scriptfakeeditor<<-\EOF&& cp"$1"actual EOF-chmod+xfakeeditor--test_expect_successGPG\-'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'-test_expect_successGPG\-'verifying rfc1991 signature''+test_expect_successGPG'verifying rfc1991 signature''gittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature''+test_expect_successGPG'list tag with rfc1991 signature''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&gittag-l-n1rfc1991-signed-tag>actual&&test_cmpexpectactual&&
@@ -1062,15 +1141,12 @@ test_expect_success GPG \test_cmpexpectactual'-rm-fgpghome/gpg.conf--test_expect_successGPG\-'verifying rfc1991 signature without --rfc1991''+test_expect_successGPG'verifying rfc1991 signature without --rfc1991''+rm-fgpghome/gpg.conf&&gittag-vrfc1991-signed-tag'-test_expect_successGPG\-'list tag with rfc1991 signature without --rfc1991''+test_expect_successGPG'list tag with rfc1991 signature without --rfc1991''echo"rfc1991-signed-tag RFC1991 signed tag">expect&&gittag-l-n1rfc1991-signed-tag>actual&&test_cmpexpectactual&&
@@ -1080,26 +1156,26 @@ test_expect_success GPG \test_cmpexpectactual'-test_expect_successGPG\-'reediting a signed tag body omits signature''+test_expect_successGPG'reediting a signed tag body omits signature''echo"RFC1991 signed tag">expect&&GIT_EDITOR=./fakeeditorgittag-f-srfc1991-signed-tag$commit&&test_cmpexpectactual'+test_expect_successGPG'git tag -s fails if gpg is misconfigured''# try to sign with bad user.signingkey-gitconfiguser.signingkeyBobTheMouse-test_expect_successGPG\-'git tag -s fails if gpg is misconfigured'\-'test_must_fail git tag -s -m tail tag-gpg-failure'+gitconfiguser.signingkeyBobTheMouse&&+test_must_failgittag-s-mtailtag-gpg-failure&& gitconfig--unsetuser.signingkey+'# try to verify without gpg:-rm-rfgpghome test_expect_successGPG\-'verify signed tag fails when public key is not present'\-'test_must_fail git tag -v signed-tag'+'verify signed tag fails when public key is not present''+rm-rfgpghome&&+test_must_failgittag-vsigned-tag+' test_expect_success\'git tag -a fails if tag annotation is empty''
@@ -1126,12 +1202,13 @@ test_expect_success \test_cmprest.expectrest.actual'-get_tag_headerreuse$commitcommit$time>expect-echo"An annotation to be reused">>expect test_expect_success\'overwriting an annoted tag should use its previous body''+get_tag_headerreuse$commitcommit$time>expect<<-EOF&&+reuse+EOFgittag-a-m"An annotation to be reused"reuse&&-GIT_EDITOR=truegittag-f-areuse&&+GIT_EDITOR=truegittag-f-a-m"reuse"reuse&&get_tag_msgreuse>actual&&test_cmpexpectactual'
@@ -1158,68 +1235,61 @@ test_expect_success 'filename for the message is relative to cwd' '# create a few more commits to test --contains-hash1=$(gitrev-parseHEAD)- test_expect_success'creating second commit and tag''+hash1=$(gitrev-parseHEAD)&&echofoo-2.0>foo&&gitaddfoo&&gitcommit-msecond&&+hash2=$(gitrev-parseHEAD)&&gittagv2.0'-hash2=$(gitrev-parseHEAD)- test_expect_success'creating third commit without tag''echofoo-dev>foo&&gitaddfoo&&-gitcommit-mthird-'-+gitcommit-mthird&&hash3=$(gitrev-parseHEAD)+'-# simple linear checks of --continue+# simple linear checks of --contains-cat>expected<<EOF+test_expect_success'checking that first commit is in all tags (hash)''+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)'"gittag-l--contains$hash1v*>actual&&test_cmpexpectedactual-"+'# other ways of specifying the commit-test_expect_success'checking that first commit is in all tags (tag)'"+test_expect_success'checking that first commit is in all tags (tag)''gittag-l--containsv1.0v*>actual&&test_cmpexpectedactual-"+'-test_expect_success'checking that first commit is in all tags (relative)'"+test_expect_success'checking that first commit is in all tags (relative)''gittag-l--containsHEAD~2v*>actual&&test_cmpexpectedactual-"+'-cat>expected<<EOF+test_expect_success'checking that second commit only has one tag''+cat>expected<<-EOF&& v2.0 EOF--test_expect_success'checking that second commit only has one tag'"gittag-l--contains$hash2v*>actual&&test_cmpexpectedactual-"-+'-cat>expected<<EOF+test_expect_success'checking that third commit has no tags''+cat>expected<<-EOF&& EOF--test_expect_success'checking that third commit has no tags'"gittag-l--contains$hash3v*>actual&&test_cmpexpectedactual-"+'# how about a simple merge?
@@ -1228,35 +1298,33 @@ test_expect_success 'creating simple branch' 'gitcheckoutstable&&echofoo-3.0>foo&&gitcommitfoo-mfourth&&+hash4=$(gitrev-parseHEAD)&&gittagv3.0'-hash4=$(gitrev-parseHEAD)--cat>expected<<EOF+test_expect_success'checking that branch head only has one tag''+cat>expected<<-EOF&& v3.0 EOF--test_expect_success'checking that branch head only has one tag'"gittag-l--contains$hash4v*>actual&&test_cmpexpectedactual-"+' test_expect_success'merging original branch into this branch''gitmerge--strategy=oursmaster&&gittagv4.0'-cat>expected<<EOF+test_expect_success'checking that original branch head has one tag now''+cat>expected<<-EOF&& v4.0 EOF--test_expect_success'checking that original branch head has one tag now'"gittag-l--contains$hash3v*>actual&&test_cmpexpectedactual-"+'-cat>expected<<EOF+test_expect_success'checking that initial commit is in all tags''+cat>expected<<-EOF&& v0.2.1 v1.0 v1.0.1
@@ -1265,11 +1333,9 @@ v2.0 v3.0 v4.0 EOF--test_expect_success'checking that initial commit is in all tags'"gittag-l--contains$hash1v*>actual&&test_cmpexpectedactual-"+'# mixing modes and options:
@@ -152,7 +146,8 @@ test_expect_success 'ambiguously abbreviated option' 'test$?=129'-cat>expect<<EOF+test_expect_success'non ambiguous option (after two options it abbreviates)''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -163,24 +158,23 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'non ambiguous option (after two options it abbreviates)''test-parse-options--st123>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>typo.err<<EOF-error:didyoumean\`--boolean\`(withtwodashes?)-EOF- test_expect_success'detect possible typos''+cat>typo.err<<-\EOF&&+error:didyoumean`--boolean`(withtwodashes?)+EOF+>expecttest_must_failtest-parse-options-boolean>output2>output.err&&-test!-soutput&&-test_cmptypo.erroutput.err+test_cmptypo.erroutput.err&&+test_cmpexpectoutput'-cat>expect<<EOF+test_expect_success'keep some options as arguments''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -192,14 +186,13 @@ dry run: no file:(notset) arg00:--quux EOF--test_expect_success'keep some options as arguments''test-parse-options--quux>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF+test_expect_success'OPT_DATE() and OPT_SET_PTR() work''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:1
@@ -211,15 +204,14 @@ dry run: no file:(notset) arg00:foo EOF--test_expect_success'OPT_DATE() and OPT_SET_PTR() work''-test-parse-options-t"1970-01-01 00:00:01 +0000"--default-string\-foo-q>output2>output.err&&+test-parse-options-t"1970-01-01 00:00:01 +0000"\+--default-stringfoo-q>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF+test_expect_success'OPT_CALLBACK() and OPT_BIT() work''+cat>expect<<-\EOF&& Callback:"four",0 boolean:5 integer:4
@@ -231,24 +223,22 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_CALLBACK() and OPT_BIT() work''test-parse-options--length=four-b-4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF+test_expect_success'OPT_CALLBACK() and callback errors work''+cat>expect<<-\EOF&& Callback:"not set",1 EOF--test_expect_success'OPT_CALLBACK() and callback errors work''test_must_failtest-parse-options--no-length>output2>output.err&&test_cmpexpectoutput&&test_cmpexpect.erroutput.err'-cat>expect<<EOF+test_expect_success'OPT_BIT() and OPT_SET_INT() work''+cat>expect<<-\EOF&& boolean:1 integer:23 timestamp:0
@@ -259,8 +249,6 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_BIT() and OPT_SET_INT() work''test-parse-options--set23-bbbbb--no-or4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput
@@ -313,14 +302,13 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'OPT_NUMBER_CALLBACK() works''test-parse-options-12345>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF+test_expect_success'negation of OPT_NONEG flags is not ambiguous''+cat>expect<<-\EOF&& boolean:0 integer:0 timestamp:0
@@ -331,19 +319,17 @@ quiet: no dryrun:no file:(notset) EOF--test_expect_success'negation of OPT_NONEG flags is not ambiguous''test-parse-options--no-ambig>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>>expect<<'EOF'+test_expect_success'--list keeps list of strings''+cat>>expect<<-\EOF&& list:foo list:bar list:baz EOF-test_expect_success'--list keeps list of strings''test-parse-options--listfoo--list=bar--list=baz>output&&test_cmpexpectoutput'
@@ -7,20 +7,20 @@ test_description='git branch assorted tests' ../test-lib.sh-test_expect_success\-'prepare a trivial repository'\-'echoHello>A&&-gitupdate-index--addA&&-gitcommit-m"Initial commit."&&-echoWorld>>A&&-gitupdate-index--addA&&-gitcommit-m"Second commit."&&-HEAD=$(gitrev-parse--verifyHEAD)'+test_expect_success'prepare a trivial repository''+echoHello>A&&+gitupdate-index--addA&&+gitcommit-m"Initial commit."&&+echoWorld>>A&&+gitupdate-index--addA&&+gitcommit-m"Second commit."&&+HEAD=$(gitrev-parse--verifyHEAD)+' test_expect_success\-'git branch --help should not have created a bogus branch''-test_might_failgitbranch--help</dev/null>/dev/null2>/dev/null&&-test_path_is_missing.git/refs/heads/--help+'git branch --help should not have created a bogus branch''+test_might_failgitbranch--help</dev/null>/dev/null2>/dev/null&&+test_path_is_missing.git/refs/heads/--help' test_expect_success'branch -h in broken repository''
@@ -34,63 +34,63 @@ test_expect_success 'branch -h in broken repository' 'grep"[Uu]sage"broken/usage'-test_expect_success\-'git branch abc should create a branch'\-'git branch abc && test_path_is_file .git/refs/heads/abc'+test_expect_success'git branch abc should create a branch''+gitbranchabc&&test_path_is_file.git/refs/heads/abc+'-test_expect_success\-'git branch a/b/c should create a branch'\-'git branch a/b/c && test_path_is_file .git/refs/heads/a/b/c'+test_expect_success'git branch a/b/c should create a branch''+gitbrancha/b/c&&test_path_is_file.git/refs/heads/a/b/c+'-cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster-EOF-test_expect_success\-'git branch -l d/e/f should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitbranch-ld/e/f&&-test_path_is_file.git/refs/heads/d/e/f&&-test_path_is_file.git/logs/refs/heads/d/e/f&&-test_cmpexpect.git/logs/refs/heads/d/e/f'+test_expect_success'git branch -l d/e/f should create a branch and a log''+cat>expect<<-EOF+$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster+EOF+GIT_COMMITTER_DATE="2005-05-26 23:30"\+gitbranch-ld/e/f&&+test_path_is_file.git/refs/heads/d/e/f&&+test_path_is_file.git/logs/refs/heads/d/e/f&&+test_cmpexpect.git/logs/refs/heads/d/e/f+'-test_expect_success\-'git branch -d d/e/f should delete a branch and a log'\-'gitbranch-dd/e/f&&-test_path_is_missing.git/refs/heads/d/e/f&&-test_path_is_missing.git/logs/refs/heads/d/e/f'+test_expect_success'git branch -d d/e/f should delete a branch and a log''+gitbranch-dd/e/f&&+test_path_is_missing.git/refs/heads/d/e/f&&+test_path_is_missing.git/logs/refs/heads/d/e/f+'-test_expect_success\-'git branch j/k should work after branch j has been deleted'\-'gitbranchj&&-gitbranch-dj&&-gitbranchj/k'+test_expect_success'git branch j/k should work after branch j has been deleted''+gitbranchj&&+gitbranch-dj&&+gitbranchj/k+'-test_expect_success\-'git branch l should work after branch l/m has been deleted'\-'gitbranchl/m&&-gitbranch-dl/m&&-gitbranchl'+test_expect_success'git branch l should work after branch l/m has been deleted''+gitbranchl/m&&+gitbranch-dl/m&&+gitbranchl+'-test_expect_success\-'git branch -m dumps usage'\-'test_expect_code129gitbranch-m2>err&&-grep"[Uu]sage: git branch"err'+test_expect_success'git branch -m dumps usage''+test_expect_code129gitbranch-m2>err&&+grep"[Uu]sage: git branch"err+'-test_expect_success\-'git branch -m m m/m should work'\-'gitbranch-lm&&-gitbranch-mmm/m&&-test_path_is_file.git/logs/refs/heads/m/m'+test_expect_success'git branch -m m m/m should work''+gitbranch-lm&&+gitbranch-mmm/m&&+test_path_is_file.git/logs/refs/heads/m/m+'-test_expect_success\-'git branch -m n/n n should work'\-'gitbranch-ln/n&&+test_expect_success'git branch -m n/n n should work''+gitbranch-ln/n&&gitbranch-mn/nn&&-test_path_is_file.git/logs/refs/heads/n'+test_path_is_file.git/logs/refs/heads/n+' test_expect_success'git branch -m o/o o should fail when o/p exists''gitbrancho/o&&-gitbrancho/p&&+gitbrancho/p&&test_must_failgitbranch-mo/oo'
@@ -160,33 +160,30 @@ test_expect_success 'git branch --list -d t should fail' 'test_path_is_missing.git/refs/heads/t'-mv.git/config.git/config-saved- test_expect_success'git branch -m q q2 without config should succeed''+mv.git/config.git/config-saved&&+test_when_finishedmv.git/config-saved.git/config&&gitbranch-mqq2&&gitbranch-mq2q'-mv.git/config-saved.git/config--gitconfigbranch.s/s.dummyHello--test_expect_success\-'git branch -m s/s s should work when s/t is deleted'\-'gitbranch-ls/s&&+test_expect_success'git branch -m s/s s should work when s/t is deleted''+gitconfigbranch.s/s.dummyHello+gitbranch-ls/s&&test_path_is_file.git/logs/refs/heads/s/s&&-gitbranch-ls/t&&+gitbranch-ls/t&&test_path_is_file.git/logs/refs/heads/s/t&&-gitbranch-ds/t&&-gitbranch-ms/ss&&-test_path_is_file.git/logs/refs/heads/s'--test_expect_success'config information was renamed, too'\-"test $(gitconfigbranch.s.dummy) = Hello &&-test_must_failgitconfigbranch.s/s/dummy"+gitbranch-ds/t&&+gitbranch-ms/ss&&+test_path_is_file.git/logs/refs/heads/s+'-test_expect_success'renaming a symref is not allowed'\+test_expect_success'config information was renamed, too''+test$(gitconfigbranch.s.dummy)=Hello&&+test_must_failgitconfigbranch.s/s/dummy'++test_expect_success'renaming a symref is not allowed''gitsymbolic-refrefs/heads/master2refs/heads/master&&test_must_failgitbranch-mmaster2master3&&gitsymbolic-refrefs/heads/master2&&
@@ -194,115 +191,125 @@ test_expect_success 'renaming a symref is not allowed' \test_path_is_missing.git/refs/heads/master3'-test_expect_successSYMLINKS\-'git branch -m u v should fail when the reflog for u is a symlink''-gitbranch-lu&&-mv.git/logs/refs/heads/ureal-u&&-ln-sreal-u.git/logs/refs/heads/u&&-test_must_failgitbranch-muv-'--test_expect_success'test tracking setup via --track'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy1local/master&&-test$(gitconfigbranch.my1.remote)=local&&-test$(gitconfigbranch.my1.merge)=refs/heads/master'--test_expect_success'test tracking setup (non-wildcard, matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/master:refs/remotes/local/master&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy4local/master&&-test$(gitconfigbranch.my4.remote)=local&&-test$(gitconfigbranch.my4.merge)=refs/heads/master'--test_expect_success'test tracking setup (non-wildcard, not matching)'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--trackmy5local/master&&-!test"$(gitconfigbranch.my5.remote)"=local&&-!test"$(gitconfigbranch.my5.merge)"=refs/heads/master'--test_expect_success'test tracking setup via config'\-'gitconfigbranch.autosetupmergetrue&&-gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranchmy3local/master&&-test$(gitconfigbranch.my3.remote)=local&&-test$(gitconfigbranch.my3.merge)=refs/heads/master'--test_expect_success'test overriding tracking setup via --no-track'\-'gitconfigbranch.autosetupmergetrue&&-gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&-gitbranch--no-trackmy2local/master&&-gitconfigbranch.autosetupmergefalse&&-!test"$(gitconfigbranch.my2.remote)"=local&&-!test"$(gitconfigbranch.my2.merge)"=refs/heads/master'--test_expect_success'no tracking without .fetch entries'\-'gitconfigbranch.autosetupmergetrue&&-gitbranchmy6s&&-gitconfigbranch.automsetupmergefalse&&-test-z"$(gitconfigbranch.my6.remote)"&&-test-z"$(gitconfigbranch.my6.merge)"'--test_expect_success'test tracking setup via --track but deeper'\-'gitconfigremote.local.url.&&-gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&-(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&-gitbranch--trackmy7local/o/o&&-test"$(gitconfigbranch.my7.remote)"=local&&-test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o'--test_expect_success'test deleting branch deletes branch config'\-'gitbranch-dmy7&&-test-z"$(gitconfigbranch.my7.remote)"&&-test-z"$(gitconfigbranch.my7.merge)"'--test_expect_success'test deleting branch without config'\-'gitbranchmy7s&&-sha1=$(gitrev-parsemy7|cut-c1-7)&&-echo"Deleted branch my7 (was $sha1).">expect&&-gitbranch-dmy7>actual2>&1&&-test_i18ncmpexpectactual'--test_expect_success'test --track without .fetch entries'\-'gitbranch--trackmy8&&-test"$(gitconfigbranch.my8.remote)"&&-test"$(gitconfigbranch.my8.merge)"'+test_expect_successSYMLINKS'git branch -m u v should fail when the reflog for u is a symlink''+gitbranch-lu&&+mv.git/logs/refs/heads/ureal-u&&+ln-sreal-u.git/logs/refs/heads/u&&+test_must_failgitbranch-muv+'-test_expect_success\-'branch from non-branch HEAD w/autosetupmerge=always'\-'gitconfigbranch.autosetupmergealways&&-gitbranchmy9HEAD^&&-gitconfigbranch.autosetupmergefalse'+test_expect_success'test tracking setup via --track''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranch--trackmy1local/master&&+test$(gitconfigbranch.my1.remote)=local&&+test$(gitconfigbranch.my1.merge)=refs/heads/master+'-test_expect_success\-'branch from non-branch HEAD w/--track causes failure'\-'test_must_fail git branch --track my10 HEAD^'+test_expect_success'test tracking setup (non-wildcard, matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetch\+refs/heads/master:refs/remotes/local/master&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranch--trackmy4local/master&&+test$(gitconfigbranch.my4.remote)=local&&+test$(gitconfigbranch.my4.merge)=refs/heads/master+'-test_expect_success\-'branch from tag w/--track causes failure'\-'gittagfoobar&&-test_must_failgitbranch--trackmy11foobar'+test_expect_success'test tracking setup (non-wildcard, not matching)''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/s:refs/remotes/local/s&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranch--trackmy5local/master&&+!test"$(gitconfigbranch.my5.remote)"=local&&+!test"$(gitconfigbranch.my5.merge)"=refs/heads/master+'++test_expect_success'test tracking setup via config''+gitconfigbranch.autosetupmergetrue&&+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranchmy3local/master&&+test$(gitconfigbranch.my3.remote)=local&&+test$(gitconfigbranch.my3.merge)=refs/heads/master+'++test_expect_success'test overriding tracking setup via --no-track''+gitconfigbranch.autosetupmergetrue&&+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/master||gitfetchlocal)&&+gitbranch--no-trackmy2local/master&&+gitconfigbranch.autosetupmergefalse&&+!test"$(gitconfigbranch.my2.remote)"=local&&+!test"$(gitconfigbranch.my2.merge)"=refs/heads/master+'++test_expect_success'no tracking without .fetch entries''+gitconfigbranch.autosetupmergetrue&&+gitbranchmy6s&&+gitconfigbranch.automsetupmergefalse&&+test-z"$(gitconfigbranch.my6.remote)"&&+test-z"$(gitconfigbranch.my6.merge)"+'++test_expect_success'test tracking setup via --track but deeper''+gitconfigremote.local.url.&&+gitconfigremote.local.fetchrefs/heads/*:refs/remotes/local/*&&+(gitshow-ref-qrefs/remotes/local/o/o||gitfetchlocal)&&+gitbranch--trackmy7local/o/o&&+test"$(gitconfigbranch.my7.remote)"=local&&+test"$(gitconfigbranch.my7.merge)"=refs/heads/o/o+'++test_expect_success'test deleting branch deletes branch config''+gitbranch-dmy7&&+test-z"$(gitconfigbranch.my7.remote)"&&+test-z"$(gitconfigbranch.my7.merge)"+'++test_expect_success'test deleting branch without config''+gitbranchmy7s&&+sha1=$(gitrev-parsemy7|cut-c1-7)&&+echo"Deleted branch my7 (was $sha1).">expect&&+gitbranch-dmy7>actual2>&1&&+test_i18ncmpexpectactual+'++test_expect_success'test --track without .fetch entries''+gitbranch--trackmy8&&+test"$(gitconfigbranch.my8.remote)"&&+test"$(gitconfigbranch.my8.merge)"+'++test_expect_success'branch from non-branch HEAD w/autosetupmerge=always''+gitconfigbranch.autosetupmergealways&&+gitbranchmy9HEAD^&&+gitconfigbranch.autosetupmergefalse+'++test_expect_success'branch from non-branch HEAD w/--track causes failure''+test_must_failgitbranch--trackmy10HEAD^+'++test_expect_success'branch from tag w/--track causes failure''+gittagfoobar&&+test_must_failgitbranch--trackmy11foobar+'# Keep this test last, as it changes the current branch-cat>expect<<EOF-$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster-EOF-test_expect_success\-'git checkout -b g/h/i -l should create a branch and a log'\-'GIT_COMMITTER_DATE="2005-05-26 23:30"\-gitcheckout-bg/h/i-lmaster&&-test_path_is_file.git/refs/heads/g/h/i&&-test_path_is_file.git/logs/refs/heads/g/h/i&&-test_cmpexpect.git/logs/refs/heads/g/h/i'+test_expect_success'git checkout -b g/h/i -l should create a branch and a log''+cat>expect<<-EOF+$_z40$HEAD$GIT_COMMITTER_NAME<$GIT_COMMITTER_EMAIL>1117150200+0000branch:Createdfrommaster+EOF+GIT_COMMITTER_DATE="2005-05-26 23:30"\+gitcheckout-bg/h/i-lmaster&&+test_path_is_file.git/refs/heads/g/h/i&&+test_path_is_file.git/logs/refs/heads/g/h/i&&+test_cmpexpect.git/logs/refs/heads/g/h/i+' test_expect_success'checkout -b makes reflog by default''gitcheckoutmaster&&
@@ -152,198 +146,190 @@ test_expect_success 'ambiguously abbreviated option' 'test$?=129'-cat>expect<<EOF-boolean:0-integer:0-timestamp:0-string:123-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF- test_expect_success'non ambiguous option (after two options it abbreviates)''-test-parse-options--st123>output2>output.err&&+cat>expect<<-\EOF&&+boolean:0+integer:0+timestamp:0+string:123+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOF+test-parse-options--st123>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>typo.err<<EOF-error:didyoumean\`--boolean\`(withtwodashes?)-EOF- test_expect_success'detect possible typos''-test_must_failtest-parse-options-boolean>output2>output.err&&-test!-soutput&&-test_cmptypo.erroutput.err+cat>typo.err<<-\EOF&&+error:didyoumean`--boolean`(withtwodashes?)+EOF+>expect+test_must_failtest-parse-options-boolean>output2>output.err&&+test_cmptypo.erroutput.err&&+test_cmpexpectoutput'-cat>expect<<EOF-boolean:0-integer:0-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-arg00:--quux-EOF- test_expect_success'keep some options as arguments''-test-parse-options--quux>output2>output.err&&-test!-soutput.err&&-test_cmpexpectoutput+cat>expect<<-\EOF&&+boolean:0+integer:0+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+arg00:--quux+EOF+test-parse-options--quux>output2>output.err&&+test!-soutput.err&&+test_cmpexpectoutput'-cat>expect<<EOF-boolean:0-integer:0-timestamp:1-string:default-abbrev:7-verbose:0-quiet:yes-dryrun:no-file:(notset)-arg00:foo-EOF- test_expect_success'OPT_DATE() and OPT_SET_PTR() work''-test-parse-options-t"1970-01-01 00:00:01 +0000"--default-string\-foo-q>output2>output.err&&+cat>expect<<-\EOF&&+boolean:0+integer:0+timestamp:1+string:default+abbrev:7+verbose:0+quiet:yes+dryrun:no+file:(notset)+arg00:foo+EOF+test-parse-options-t"1970-01-01 00:00:01 +0000"\+--default-stringfoo-q>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF-Callback:"four",0-boolean:5-integer:4-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF- test_expect_success'OPT_CALLBACK() and OPT_BIT() work''-test-parse-options--length=four-b-4>output2>output.err&&+cat>expect<<-\EOF&&+Callback:"four",0+boolean:5+integer:4+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOF+test-parse-options--length=four-b-4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF-Callback:"not set",1-EOF- test_expect_success'OPT_CALLBACK() and callback errors work''-test_must_failtest-parse-options--no-length>output2>output.err&&+cat>expect<<-\EOF&&+Callback:"not set",1+EOF+test_must_failtest-parse-options--no-length>output2>output.err&&test_cmpexpectoutput&&test_cmpexpect.erroutput.err'-cat>expect<<EOF-boolean:1-integer:23-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF- test_expect_success'OPT_BIT() and OPT_SET_INT() work''-test-parse-options--set23-bbbbb--no-or4>output2>output.err&&+cat>expect<<-\EOF&&+boolean:1+integer:23+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOF+test-parse-options--set23-bbbbb--no-or4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput' test_expect_success'OPT_NEGBIT() and OPT_SET_INT() work''-test-parse-options--set23-bbbbb--neg-or4>output2>output.err&&+test-parse-options--set23-bbbbb--neg-or4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF-boolean:6-integer:0-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF- test_expect_success'OPT_BIT() works''-test-parse-options-bb--or4>output2>output.err&&+cat>expect<<-\EOF&&+boolean:6+integer:0+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOF+test-parse-options-bb--or4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput' test_expect_success'OPT_NEGBIT() works''-test-parse-options-bb--no-neg-or4>output2>output.err&&+test-parse-options-bb--no-neg-or4>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput' test_expect_success'OPT_BOOLEAN() with PARSE_OPT_NODASH works''-test-parse-options++++++>output2>output.err&&+test-parse-options++++++>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF-boolean:0-integer:12345-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF test_expect_success'OPT_NUMBER_CALLBACK() works''-test-parse-options-12345>output2>output.err&&+cat>expect<<-\EOF&&+boolean:0+integer:12345+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOF+test-parse-options-12345>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>expect<<EOF-boolean:0-integer:0-timestamp:0-string:(notset)-abbrev:7-verbose:0-quiet:no-dryrun:no-file:(notset)-EOF- test_expect_success'negation of OPT_NONEG flags is not ambiguous''+cat>expect<<-\EOF&&+boolean:0+integer:0+timestamp:0+string:(notset)+abbrev:7+verbose:0+quiet:no+dryrun:no+file:(notset)+EOFtest-parse-options--no-ambig>output2>output.err&&test!-soutput.err&&test_cmpexpectoutput'-cat>>expect<<'EOF'-list:foo-list:bar-list:baz-EOF test_expect_success'--list keeps list of strings''+cat>>expect<<-\EOF&&+list:foo+list:bar+list:baz+EOFtest-parse-options--listfoo--list=bar--list=baz>output&&test_cmpexpectoutput'
@@ -263,52 +265,51 @@ test_expect_success 'Quoting style: python' 'test_cmpexpectedactual'-cat>expected<<\EOF-"refs/heads/master"-"refs/remotes/origin/master"-"refs/tags/testtag"-EOF- test_expect_success'Quoting style: tcl''+cat>expected<<-EOF+"refs/heads/master"+"refs/remotes/origin/master"+"refs/tags/testtag"+EOFgitfor-each-ref--tcl--format="%(refname)">actual&&test_cmpexpectedactual'-foriin"--perl --shell""-s --python""--python --tcl""--tcl --perl";do-test_expect_success"more than one quoting style: $i""-gitfor-each-ref$i2>&1|(readline&&-case\$linein-\"error:morethanonequotingstyle\"*):happy;;-*)false-esac)-"-done--cat>expected<<\EOF-master-testtag-EOF-+test_expect_success'more than one quoting styles''+cat>expected<<-EOF+error:morethanonequotingstyle?+EOF+gitfor-each-ref--perl--shell2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref-s--python2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref--python--tcl2>&1|head-n1>actual&&+test_cmpexpectedactual&&+gitfor-each-ref--tcl--perl2>&1|head-n1>actual&&+test_cmpexpectedactual+' test_expect_success'Check short refname format''+cat>expected<<-EOF+master+testtag+EOF(gitfor-each-ref--format="%(refname:short)"refs/heads&&gitfor-each-ref--format="%(refname:short)"refs/tags)>actual&&test_cmpexpectedactual'-cat>expected<<EOF-origin/master-EOF- test_expect_success'Check short upstream format''+cat>expected<<-EOF+origin/master+EOFgitfor-each-ref--format="%(upstream:short)"refs/heads>actual&&test_cmpexpectedactual'-cat>expected<<EOF-67a36f1-EOF- test_expect_success'Check short objectname format''+cat>expected<<-EOF+67a36f1+EOFgitfor-each-ref--format="%(objectname:short)"refs/heads>actual&&test_cmpexpectedactual'
@@ -317,12 +318,11 @@ test_expect_success 'Check for invalid refname format' 'test_must_failgitfor-each-ref--format="%(refname:INVALID)"'-cat>expected<<\EOF-heads/master-tags/master-EOF- test_expect_success'Check ambiguous head and tag refs (strict)''+cat>expected<<-EOF+heads/master+tags/master+EOFgitconfig--boolcore.warnambiguousrefstrue&&gitcheckout-bnewtag&&echo"Using $datestamp">one&&
@@ -334,23 +334,21 @@ test_expect_success 'Check ambiguous head and tag refs (strict)' 'test_cmpexpectedactual'-cat>expected<<\EOF-heads/master-master-EOF- test_expect_success'Check ambiguous head and tag refs (loose)''+cat>expected<<-EOF+heads/master+master+EOFgitconfig--boolcore.warnambiguousrefsfalse&&gitfor-each-ref--format"%(refname:short)"refs/heads/masterrefs/tags/master>actual&&test_cmpexpectedactual'-cat>expected<<\EOF-heads/ambiguous-ambiguous-EOF- test_expect_success'Check ambiguous head and tag refs II (loose)''+cat>expected<<-EOF+heads/ambiguous+ambiguous+EOFgitcheckoutmaster&&gittagambiguoustesttag^0&&gitbranchambiguoustesttag^0&&
@@ -369,7 +367,7 @@ test_expect_success 'an unusual tag with an incomplete line' '' test_expect_success'create tag with subject and body content''-cat>>msg<<-\EOF&&+cat>msg<<-\EOF&&thesubjectlinefirstbodyline
@@ -102,11 +102,13 @@ test_expect_success 'use branch.<name>.remote if possible' ''-cat>exp<<EOF+test_expect_success'confuses pattern as remote when no remote specified''+'"+cat>exp<<-EOF fatal:'refs*master'doesnotappeartobeagitrepository fatal:Theremoteendhungupunexpectedly EOF-test_expect_success'confuses pattern as remote when no remote specified''+"'## Do not expect "git ls-remote <pattern>" to work; ls-remote, correctly,# confuses <pattern> for <remote>. Although ugly, this behaviour is akin
Hmph.
We would want to keep/make the codebase uniformly conform to our style
guide for longer term maintainability (this is not limited to the test
scripts) but at the same time we would strongly want to avoid churning
patches from interfering other patches that are still in flight that do
"real work".
There are only two appropriate occasions for file-wide clean-up patches
like these:
(1) The file has not been touched for quite some time, and it is not
expected to be touched for some time to come; or
(2) You are going to do extensive work on the file for reasons other than
clean-up, and nobody else is working or expected to work in the same
area for some time to come (in other words, you _own_ the file), and
your real work will be easier to review if it is done _after_ such a
clean-up patch.
Let's see how active these five files are:
$ git diff --stat v1.7.9..pu -- t/t{7004,5512,3200,0040,6300}-*.sh
t/t0040-parse-options.sh | 60 ++++++++++++++++++++++-
t/t3200-branch.sh | 122 ++++++++++++++++++++++++++++++++++++++++++++--
t/t7004-tag.sh | 96 ++++++++++++++++++++++++++++++++++++
3 files changed, 272 insertions(+), 6 deletions(-)
Given this, I do not want to take three of your 5 patches that touch these
files at this point. Please hold onto them and wait until topics that
touch these test scripts graduate to 'master', and then wait a bit more
until some time passes without anybody touching them, before redoing the
clean-up patches.
On the other hand, we can see that 5512 has been dormant for quite a
while. Note that the latter diff is against 3 cycles ago:
$ git diff --stat v1.7.6..pu -- t/t{7004,5512,3200,0040,6300}-*.sh
t/t0040-parse-options.sh | 79 +++++++++++++++-
t/t3200-branch.sh | 236 +++++++++++++++++++++++++++++++++++++++++-----
t/t6300-for-each-ref.sh | 101 +++++++++++++++++++-
t/t7004-tag.sh | 128 +++++++++++++++++++------
4 files changed, 490 insertions(+), 54 deletions(-)
so 5512 and possibly 6300 may be worth reviewing.
Thanks.
From: Junio C Hamano <hidden> Date: 2016-06-15 22:53:12
Tom Grennan [off-list ref] writes:
test_expect_success 'confuses pattern as remote when no remote specified' '
+ '"
+ cat >exp <<-EOF
+ fatal: 'refs*master' does not appear to be a git repository
+ fatal: The remote end hung up unexpectedly
+ EOF
+ "'
Please make it a habit to make your test script a cascade of &&, i.e.
... remote specified' '
cat >exp <<-\EOF &&
fatal: '\''refs*master'\'' does not ...
...
EOF
No need to resend; I'll fix it up locally.
Thanks.
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:12
On Sat, Mar 03, 2012 at 12:05:05AM -0800, Junio C Hamano wrote:
Tom Grennan [off-list ref] writes:
quoted
test_expect_success 'confuses pattern as remote when no remote specified' '
+ '"
+ cat >exp <<-EOF
+ fatal: 'refs*master' does not appear to be a git repository
+ fatal: The remote end hung up unexpectedly
+ EOF
+ "'
Please make it a habit to make your test script a cascade of &&, i.e.
... remote specified' '
cat >exp <<-\EOF &&
fatal: '\''refs*master'\'' does not ...
...
EOF
No need to resend; I'll fix it up locally.
Oops, I missed the && on that one.
What about the quoting of t6300's,
cat >expected <<\EOF
'refs/heads/master' 'Mon Jul 3 17:18:43 2006 +0200' 'Mon Jul 3 17:18:44 2006 +0200'
'refs/tags/testtag' 'Mon Jul 3 17:18:45 2006 +0200'
EOF
Do you want it like this,
cat >expected <<-EOF &&
'\''refs/heads/master'\'' '\''Mon Jul 3 17:18:43 2006 +0200'\'' '\''Mon Jul 3 17:18:44 2006 +0200'\''
'\''refs/tags/testtag'\'' '\''Mon Jul 3 17:18:45 2006 +0200'\''
EOF
or,
cat >expected <<-EOF &&
'"'refs/heads/master' 'Mon Jul 3 17:18:43 2006 +0200' 'Mon Jul 3 17:18:44 2006 +0200'"'
'"'refs/tags/testtag' 'Mon Jul 3 17:18:45 2006 +0200'"'
EOF
or something else?
Thanks,
TomG
From: Tom Grennan <hidden> Date: 2016-06-15 22:53:12
On Sat, Mar 03, 2012 at 12:04:54AM -0800, Junio C Hamano wrote:
On the other hand, we can see that 5512 has been dormant for quite a
while. Note that the latter diff is against 3 cycles ago:
$ git diff --stat v1.7.6..pu -- t/t{7004,5512,3200,0040,6300}-*.sh
t/t0040-parse-options.sh | 79 +++++++++++++++-
t/t3200-branch.sh | 236 +++++++++++++++++++++++++++++++++++++++++-----
t/t6300-for-each-ref.sh | 101 +++++++++++++++++++-
t/t7004-tag.sh | 128 +++++++++++++++++++------
4 files changed, 490 insertions(+), 54 deletions(-)
so 5512 and possibly 6300 may be worth reviewing.
Ack, I'll hold the others until each are quiescent for a few cycles.
Thanks.
TomG
From: Johannes Sixt <hidden> Date: 2016-06-15 22:53:12
Am 03.03.2012 03:15, schrieb Tom Grennan:
-test_expect_success 'trying to delete an already deleted tag should fail' \
- 'test_must_fail git tag -d mytag'
+test_expect_success \
+ 'trying to delete an already deleted tag should fail' '
+ test_must_fail git tag -d mytag
+'
Personally, I prefer lines with 80+ chars over lines broken with a
backslash. So, while I can understand that you do not always remove a
backslash to avoid churn, I think it is not warranted to *introduce* one
to shorten a line below 80 chars. But that's really just a matter of taste.
test_expect_success GPG \
'creating a signed tag with -F messagefile should succeed' '
+ cat >sigmsgfile <<-EOF
+ Another signed tag
+ message in a file.
+ EOF
+ get_tag_header file-signed-tag $commit commit $time >expect <sigmsgfile
+ echo "-----BEGIN PGP SIGNATURE-----" >>expect
Several && missing here and later in the file.
I stopped reading here. This is too much to read in one go. This should
really be broken into several parts. For example, you changed
get_tag_header and added several <emptyfile redirections (which should
be /dev/null IMO); that has not a lot to do with "modernize style".
git tag -s -F sigmsgfile file-signed-tag &&
get_tag_msg file-signed-tag >actual &&
test_cmp expect actual
'