aboutsummaryrefslogtreecommitdiff
path: root/t/t7004-tag.sh
Commit message (Collapse)AuthorAge
* t7004: Use prerequisite tags to skip tests that need gpgJohannes Sixt2009-03-22
| | | | | | | | | | The tests are skipped if no gpg was found or if gpg is version 1.0.6. Previously, the latter condition was checked a bit later in the test file so that the tag verification tests would be exercised. These are now skipped as well, but only because we would need a facility to revoke a test prerequisite, which we do not have. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
* t2200, t7004: Avoid glob pattern that also matches filesJohannes Sixt2009-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, there is an unfortunate interaction between the MSYS bash and git's command line processing: - Since Windows's CMD does not do the wildcard expansion, but passes arguments like path* through to the programs, the programs must do the expansion themselves. This happens in the startup code before main() is entered. - bash, however, passes the argument "path*" to git, assuming that git will see the unquoted word unchanged as a single argument. But actually git expands the unquoted word before main() is entered. In t2200, not all names that the test case is interested in exist as files at the time when 'git ls-files' is invoked. git expands "path?" to only the subset of files the exist, and only that subset was listed, so that the test failed. We now list all interesting paths explicitly. In t7004, git exanded the pattern "*a*" to "actual" (the file that stdout was redirected to), which is not what the was tested for. We fix it by renaming the output file (and removing any existing files matching *a*). This was originally fixed by Johannes Schindelin. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
* test suite: Use 'say' to say something instead of 'test_expect_success'Johannes Sixt2009-03-19
| | | | | | | | | | | Some tests report that some tests will be skipped. They used 'test_expect_success' with a trivially successful test. Nowadays we have the helper function 'say' for this purpose. In on case, 'say_color skip' is replaced by 'say' because the former is not intended as a public API. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
* git-tag: Add --contains optionJake Goulding2009-01-28
| | | | | | | | | | This functions similarly to "git branch --contains"; it will show all tags that contain the specified commit, by sharing the same logic. The patch also adds documentation and tests for the new option. Signed-off-by: Jake Goulding <goulding@vivisimo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'st/tag'Junio C Hamano2008-11-12
|\ | | | | | | | | | | * st/tag: tag: Add more tests about mixing incompatible modes and options tag: Check that options are only allowed in the appropriate mode
| * tag: Add more tests about mixing incompatible modes and optionsSamuel Tardieu2008-11-04
| | | | | | | | | | Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2008-09-03
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: Start 1.6.0.2 maintenance cycle tests: use "git xyzzy" form (t7200 - t9001) tests: use "git xyzzy" form (t7000 - t7199) Fix passwd(5) ref and reflect that commit doens't use commit-tree improve handling of sideband message display tests: use "git xyzzy" form (t3600 - t6999) tests: use "git xyzzy" form (t0000 - t3599) checkout: fix message when leaving detached HEAD clone: fix creation of explicitly named target directory 'git foo' program identifies itself without dash in die() messages setup_git_directory(): fix move to worktree toplevel directory update-index: fix worktree setup Start conforming code to "git subcmd" style read-tree: setup worktree if merge is required grep: fix worktree setup diff*: fix worktree setup Conflicts: RelNotes t/t3900-i18n-commit.sh t/t7003-filter-branch.sh
| * tests: use "git xyzzy" form (t7000 - t7199)Nanako Shiraishi2008-09-03
| | | | | | | | | | | | | | Converts tests between t7001-t7103. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | tests: use $TEST_DIRECTORY to refer to the t/ directoryJunio C Hamano2008-08-17
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many test scripts assumed that they will start in a 'trash' subdirectory that is a single level down from the t/ directory, and referred to their test vector files by asking for files like "../t9999/expect". This will break if we move the 'trash' subdirectory elsewhere. To solve this, we earlier introduced "$TEST_DIRECTORY" so that they can refer to t/ directory reliably. This finally makes all the tests use it to refer to the outside environment. With this patch, and a one-liner not included here (because it would contradict with what Dscho really wants to do): | diff --git a/t/test-lib.sh b/t/test-lib.sh | index 70ea7e0..60e69e4 100644 | --- a/t/test-lib.sh | +++ b/t/test-lib.sh | @@ -485,7 +485,7 @@ fi | . ../GIT-BUILD-OPTIONS | | # Test repository | -test="trash directory" | +test="trash directory/another level/yet another" | rm -fr "$test" || { | trap - exit | echo >&5 "FATAL: Cannot prepare test area" all the tests still pass, but we would want extra sets of eyeballs on this type of change to really make sure. [jc: with help from Stephan Beyer on http-push tests I do not run myself; credits for locating silly quoting errors go to Olivier Marin.] Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Sync with 1.5.6.5Junio C Hamano2008-08-06
|\
| * Files given on the command line are relative to $cwdJunio C Hamano2008-08-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running "git commit -F file" and "git tag -F file" from a subdirectory, we should take it as relative to the directory we started from, not relative to the top-level directory. This adds a helper function "parse_options_fix_filename()" to make it more convenient to fix this class of issues. Ideally, parse_options() should support a new type of option, "OPT_FILENAME", to do this uniformly, but this patch is meant to go to 'maint' to fix it minimally. One thing to note is that value for "commit template file" that comes from the command line is taken as relative to $cwd just like other parameters, but when it comes from the configuration varilable 'commit.template', it is taken as relative to the working tree root as before. I think this difference actually is sensible (not that I particularly think commit.template itself is sensible). Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t/: Use "test_must_fail git" instead of "! git"Stephan Beyer2008-07-13
|/ | | | | | | | | | | | | | | This patch changes every occurrence of "! git" -- with the meaning that a git call has to gracefully fail -- into "test_must_fail git". This is useful to - make sure the test does not fail because of a signal, e.g. SIGSEGV, and - advertise the use of "test_must_fail" for new tests. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tests: do not use implicit "git diff --no-index"Junio C Hamano2008-05-24
| | | | | | | | | | | As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Don't use the 'export NAME=value' in the test scripts.Bryan Donlan2008-05-05
| | | | | | | | | | | | | | This form is not portable across all shells, so replace instances of: export FOO=bar with: FOO=bar export FOO Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t7004-tag: Skip more tests if gpg is not available.Johannes Sixt2008-04-02
| | | | | | | | | This test was already careful enough to skip signed tag tests if gpg is not available, but it must also skip all verify tests, even those that are about non-signed tags, because they also invoke gpg. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Sane use of test_expect_failureJunio C Hamano2008-02-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, test_expect_failure was designed to be the opposite of test_expect_success, but this was a bad decision. Most tests run a series of commands that leads to the single command that needs to be tested, like this: test_expect_{success,failure} 'test title' ' setup1 && setup2 && setup3 && what is to be tested ' And expecting a failure exit from the whole sequence misses the point of writing tests. Your setup$N that are supposed to succeed may have failed without even reaching what you are trying to test. The only valid use of test_expect_failure is to check a trivial single command that is expected to fail, which is a minority in tests of Porcelain-ish commands. This large-ish patch rewrites all uses of test_expect_failure to use test_expect_success and rewrites the condition of what is tested, like this: test_expect_success 'test title' ' setup1 && setup2 && setup3 && ! this command should fail ' test_expect_failure is redefined to serve as a reminder that that test *should* succeed but due to a known breakage in git it currently does not pass. So if git-foo command should create a file 'bar' but you discovered a bug that it doesn't, you can write a test like this: test_expect_failure 'git-foo should create bar' ' rm -f bar && git foo && test -f bar ' This construct acts similar to test_expect_success, but instead of reporting "ok/FAIL" like test_expect_success does, the outcome is reported as "FIXED/still broken". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Force the sticked form for options with optional arguments.Pierre Habouzit2007-12-22
| | | | | | | This forbids "git tag -n <number> -l" we allowed earlier, so adjust t7004 while at it. Signed-off-by: Pierre Habouzit <madcoder@debian.org>
* git-tag: fix -l switch handling regression.Pierre Habouzit2007-12-22
| | | | | | | | | | | | | | The command itself takes an optional <pattern> argument that limits the shown tags to the ones that match when in listing mode that is triggered with '-l' option. The <pattern> is not an optional option-argument to '-l'. With this fix, "git tag -l -n 4 v0.99" works as expected. It also removes a few bogus tests in t7004. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* "git tag -u keyname" brokenLinus Torvalds2007-12-11
| | | | | | | | | | | | | | | | | Commit 396865859918e9c7bf8ce74aae137c57da134610 broke signed tags using the "-u" flag when it made builtin-tag.c use parse_options() to parse its arguments (but it quite possibly was broken even before that, by the builtin rewrite). It used to be that passing the signing ID with the -u parameter also (obviously!) implied that you wanted to sign and annotate the tag, but that logic got dropped. It also totally ignored the actual key ID that was passed in. This reinstates it all. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-tag: test that -s implies an annotated tagJeff King2007-11-25
| | | | | | | | This detects a regression introduced while moving git-tag to a C builtin. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make builtin-tag.c use parse_options.Carlos Rica2007-11-18
| | | | | | | | | | Also, this removes those tests ensuring that repeated -m options don't allocate memory more than once, because now this is done after parsing options, using the last one when more are given. The same for -F. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix and improve t7004 (git-tag tests)Mike Hommey2007-11-17
| | | | | | | | | | | | | | | | | | | | | | | | Brown paper bag fix to avoid using non portable sed syntax. The test by itself didn't catch what it was supposed to, anyways. The new test first checks if git-tag correctly errors out when the user exited the editor without editing the file. Then it checks if what the user was presented in the editor was any useful, which we define as the following: * It begins with a single blank line, where the invoked editor would typically place the editing curser at, so that the user can immediately start typing; * It has some instruction but that comes after that initial blank line, all lines prefixed with "#". We specifically do not check for the wording of this instruction. * And it has nothing else, as the expected behaviour is "Hey you did not leave any message". Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add tests for git tagMike Hommey2007-11-05
| | | | | | | | | These tests check whether git-tag properly sends a comment into the editor, and whether it reuses previous annotation when overwriting an existing tag. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-tag -s must fail if gpg cannot sign the tag.Carlos Rica2007-09-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of this patch code and message was written by Shawn O. Pearce. I made some tests to know what the problem was, and then I changed the code related with the SIGPIPE signal. If the user has misconfigured `user.signingkey` in their .git/config or just doesn't have any secret keys on their keyring and they ask for a signed tag with `git tag -s` we better make sure the resulting tag was actually signed by gpg. Prior versions of builtin git-tag allowed this failure to slip by without error as they were not checking the return value of the finish_command() so they did not notice when gpg exited with an error exit status. They also did not fail if gpg produced an empty output or if read_in_full received an error from the read system call while trying to read the pipe back from gpg. Finally, we did not actually honor any return value from the do_sign function as it returns ssize_t but was being stored into an unsigned long. This caused the compiler to optimize out the die condition, allowing git-tag to continue along and create the tag object. However, when gpg gets a wrong username, it exits before any read was done and then the writing process receives SIGPIPE and program is terminated. By ignoring this signal, anyway, the function write_or_die gets EPIPE from write_in_full and exits returning 0 to the system without a message. Here we better call to write_in_full directly so we can fail printing a message and return safely to the caller. With these issues fixed `git-tag -s` will now fail to create the tag and will report a non-zero exit status to its caller, thereby allowing automated helper scripts to detect (and recover from) failure if gpg is not working properly. Proposed-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-tag: Fix -l option to use better shell style globs.Carlos Rica2007-08-31
| | | | | | | | | | | | | | | | | | | | | | | | This patch removes certain behaviour of "git tag -l foo", currently listing every tag name having "foo" as a substring. The same thing now could be achieved doing "git tag -l '*foo*'". This feature was added recently when git-tag.sh got the -n option for showing tag annotations, because that commit also replaced the old "grep pattern" behaviour with a more preferable "shell pattern" behaviour (although slightly modified as you can see). Thus, the following builtin-tag.c implemented it in order to ensure that tests were passing unchanged with both programs. Since common "shell patterns" match names with a given substring _only_ when * is inserted before and after (as in "*substring*"), and the "plain" behaviour cannot be achieved easily with the current implementation, this is mostly the right thing to do, in order to make it more flexible and consistent. Tests for "git tag" were also changed to reflect this. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-tag.c: Fix two memory leaks and minor notation changes.Carlos Rica2007-07-21
| | | | | | | | | | | | | | | | | | | A repeated call to read_sha1_file was not freing memory when the buffer was allocated but returned size was zero. Also, now the program does not allow many -F or -m options, which was a bug too because it was not freing the memory allocated for any previous -F or -m options. Tests are provided for ensuring that only one option -F or -m is given. Also, another test is shipped here, to check that "git tag" fails when a non-existing file is passed to the -F option, something that git-tag.sh allowed creating the tag with an empty message. Signed-off-by: Carlos Rica <jasampler@gmail.com> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make git tag a builtin.Carlos Rica2007-07-20
| | | | | | | | | | | | | | | | | | | | This replaces the script "git-tag.sh" with "builtin-tag.c". The existing test suite for "git tag" guarantees the compatibility with the features provided by the script version. There are some minor changes in the behaviour of "git tag" here: "git tag -v" now can get more than one tag to verify, like "git tag -d" does, "git tag" with no arguments prints all tags, more like "git branch" does, and "git tag -n" also prints all tags with annotations (without needing -l). Tests and documentation were also updated to reflect these changes. The program is currently calling the script "git verify-tag" for verify. This can be changed porting it to C and calling its functions directly from builtin-tag.c. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t7004: Add tests for the git tag -n option.Carlos Rica2007-07-11
| | | | | | | | | | | | These tests check the syntax for the git tag -n option and its output when one, none or many lines of the message are requested. Also this commit adds a missing && in the test that checks the sorted output of git tag -l. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t7004: Skip tests for signed tags in an old version of gpg.Carlos Rica2007-07-08
| | | | | | | | | | As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 the gpg version 1.0.6 didn't parse trust packets correctly, so for that version, creation of signed tags using the generated key fails. Signed-off-by: Carlos Rica <jasampler@gmail.com> Acked-by: Sven Verdoolaege <skimo@kotnet.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rewrite "git-frotz" to "git frotz"Junio C Hamano2007-07-02
| | | | | | This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add test-script for git-tagCarlos Rica2007-06-28
These tests are useful to develop the C version for git-tag.sh, ensuring that the future builtin-tag.c will not break previous behaviour. The tests are focused on listing, verifying, deleting and creating tags, checking always that the correct status value is returned and everything remains as expected. In order to verify and create signed tags, a PGP key was also added, being created this way: gpg --homedir t/t7004 --gen-key Type DSA and Elgamal, size 2048 bits, no expiration date. Name and email: C O Mitter <committer@example.com> No password given, to enable non-interactive operation. Signed-off-by: Carlos Rica <jasampler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>