Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-07-27t7502: test early quit from commit with bad identJeff King
In commit f20f387, "git commit" notices and dies much earlier when we have a bogus commit identity. That commit did not add a test because we cannot do so reliably (namely, we can only trigger the behavior on a system where the automatically generated identity is bogus). However, now that we have a prerequisite check for this feature, we can add a test that will at least run on systems that produce such a bogus identity. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-27t7502: handle systems where auto-identity is brokenJeff King
Test t7502.21 checks whether we write the committer name into COMMIT_EDITMSG when it has been automatically determined. However, not all systems can produce valid automatic identities. Prior to f20f387 (commit: check committer identity more strictly), this test worked even when we did not have a valid automatic identity, since it did not run the strict test until after we had generated the template. That commit tightened the check to fail early (since we would fail later, anyway), meaning that systems without a valid GECOS name or hostname would fail the test. We cannot just work around this, because it depends on configuration outside the control of the test script. Therefore we introduce a new test_prerequisite to run this test only on systems where automatic ident works at all. As a result, we can drop the confusing test_must_fail bit from the test. The intent was that by giving "git commit" invalid input (namely, nothing to commit), that it would stop at a predictable point, whether we had a valid identity or not, from which we could view the contents of COMMIT_EDITMSG. Since that assumption no longer holds, and we can only run the test when we have a valid identity, there is no reason not to let commit run to completion. That lets us be more robust to other unforeseen failures. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-27t7502: drop confusing test_might_fail callJeff King
In t7502.20, we run "git commit" and check that it warns us that the author and committer identity are not the same (this is always the case in the test environment, since we set up the idents differently). Instead of actually making a commit, we have a clean index, so the "git commit" we run will fail. This is marked as might_fail, which is not really correct; it will always fail since there is nothing to commit. However, the only reason not to do a complete commit would be to see the intermediate state of the COMMIT_EDITMSG file when the commit is not completed. We don't need to care about this, though; even a complete commit will leave COMMIT_EDITMSG for us to view. By doing a real commit and dropping the might_fail, we are more robust against other unforeseen failures of "git commit" that might influence our test result. It might seem less robust to depend on the fact that "git commit" leaves COMMIT_EDITMSG in place after a successful commit. However, that brings this test in line with others parts of the script, which make the same assumption. Furthermore, if that ever does change, the right solution is not to prevent commit from completing, but to set EDITOR to a script that will record the contents we see. After all, the point of these tests is to check what the user sees in their EDITOR, so that would be the most direct test. For now, though, we can continue to use the "shortcut" that COMMIT_EDITMSG is left intact. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-27t7502: narrow checks for author/committer name in templateJeff King
t7502.20 and t7502.21 check that the author and committer name are mentioned in the commit message template under certain circumstances. However, they end up checking a much larger and unnecessary portion of the template. Let's narrow their checks to the specific lines. While we're at it, let's give these tests more descriptive names, so their purposes are more obvious. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-27t7502: properly quote GIT_EDITORJeff King
One of the tests tries to ensure that editor is not run due to an early failure. However, it needs to quote the pathname of the trash directory used in $GIT_EDITOR, since git will pass it along to the shell. In other words, the test would pass whether the code was correct or not, since the unquoted editor specification would never run. We never noticed the problem because the code is indeed correct, so git-commit never even tried to run the editor. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-27t7502: clean up fake_editor testsJeff King
Using write_script saves us a few lines of code, and means we consistently use $SHELL_PATH. We can also drop the setting of the $pwd variable from $(pwd). In the first instance, there is no reason to use it (we can just use $(pwd) directly two lines later, since we are interpolating the here-document). In the second instance, it is totally pointless and probably just a cut-and-paste from the first instance. Finally, we can use a non-interpolating here document for the final script, which saves some quoting. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11tests: modernise style: more uses of test_line_countStefano Lattarini
Prefer: test_line_count <OP> COUNT FILE over: test $(wc -l <FILE) <OP> COUNT (or similar usages) in several tests. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-14i18n: use test_i18ngrep and test_i18ncmp in t7502Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-status "Changes to be committed" messageÆvar Arnfjörð Bjarmason
Gettextize the "# Changes to be committed:" messages. Several tests explicitly checked for this message. Change them to skip under GETTEXT_POISON=YesPlease. Since these tests didn't check for the rest of the git-status(1) output this change has been split up from the "git-status basic messages" patch. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-commit "enter the commit message" messageÆvar Arnfjörð Bjarmason
Gettextize the "# Please enter the commit message for your changes." message. Several tests in t7500-commit.sh and t7502-commit.sh assume that this message starts with a newline. Change the tests to to skip under GETTEXT_POISON=YesPlease. These fail under GETTEXT_POISON=YesPlease because the poison editor message doesn't do the right thing with comments and line breaks, so these messages will be incorrectly broken up across lines. This test should not be skipped under a hypothetical future testing mode that tests Git under language locales, since those messages should all start with a newline like the original. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-commit print_summary messagesÆvar Arnfjörð Bjarmason
Gettextize the "(root-commit)" and "detached HEAD" fragments that appear when you commit either the root commit, or a commit in a detached head translatable. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-commit formatting messagesÆvar Arnfjörð Bjarmason
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-10tests: add missing &&, batch 2Jonathan Nieder
Same rules as before: this patch only adds " &&" to the end of some lines in the test suite. Intended to be applied on top of or squashed with the last batch if they look okay. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-07Introduce sane_unset and use it to ensure proper && chainingElijah Newren
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-21Merge branch 'tc/commit-abbrev-fix'Junio C Hamano
* tc/commit-abbrev-fix: commit::print_summary(): don't use format_commit_message() t7502-commit: add summary output tests for empty and merge commits t7502-commit: add tests for summary output
2010-06-13commit::print_summary(): don't use format_commit_message()Tay Ray Chuan
This attempts to fix a regression in git-commit, where non-abbreviated SHA-1s were printed in the summary. One possible fix would be to set ctx.abbrev to DEFAULT_ABBREV in the `if` block, where format_commit_message() is used. Instead, we do away with the format_commit_message() codeblock altogether, replacing it with a re-run of log_tree_commit(). We re-run log_tree_commit() with rev.always_show_header set, to force the invocation of show_log(). The effect of this flag can be seen from this excerpt from log-tree.c:560, the only area that rev.always_show_header is checked: shown = log_tree_diff(opt, commit, &log); if (!shown && opt->loginfo && opt->always_show_header) { log.parent = NULL; show_log(opt); shown = 1; } We also set rev.use_terminator, so that a newline is appended at the end of the log message. Note that callers in builtin/log.c that also set rev.always_show_header don't have to set rev.use_terminator, but still get a newline, because they are wrapped in a pager. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-29t7502-commit: add summary output tests for empty and merge commitsTay Ray Chuan
After c197702 (pretty: Respect --abbrev option), non-abbreviated hashes began to appear, leading to failures for these tests. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-29t7502-commit: add tests for summary outputTay Ray Chuan
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-25t7502-commit: fix spellingTay Ray Chuan
s/subdirecotry/subdirectory/ Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-13t7502: test commit.status, --status and --no-statusJunio C Hamano
Make sure that the status information: - is shown as before without configuration nor command line option; - is shown if commit.status is set to true and no command line option is given, or --status is explicitly given; - is not shown if commit.status is set to false and no command line option is given, or --no-status is explicitly given. Also make sure that the way lines taken from the custom --template appear in the log message editor is not changed at all. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-07builtin-commit.c: fix logic to omit empty line before existing footersJunio C Hamano
"commit -s" used to add an empty line before adding S-o-b line only when the last line of the existing log message is not another S-o-b line, but c1e01b0 (commit: More generous accepting of RFC-2822 footer lines., 2009-10-28) introduced logic to omit this empty line when the message ends with a run of "footer" lines, to cover S-o-b's friends, e.g. Acked-by. However, the logic was overzealous and missed one corner case. A message that consists of a single line that begins with Token + colon, it can be mistaken as a S-o-b's friend. We do want an empty line in such a case. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-25t7502-commit: Skip SIGTERM test on WindowsJohannes Sixt
The implementation of exec on Windows is just a rough approximation of the POSIX behavior. In particular, no real process "overlay" happens (a new process is spawned instead and the parent process waits until the child terminates). In particular, the process ID cannot be taken by the exec'd process. But there is one test in t7502-commit.sh that depends on this. We have to skip it on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2008-10-27wt-status: load diff ui configJeff King
When "git status -v" shows a diff, we did not respect the user's usual diff preferences at all. Loading just git_diff_basic_config would give us things like rename limits and diff drivers. But it makes even more sense to load git_diff_ui_config, which gives us colorization if the user has requested it. Note that we need to take special care to cancel colorization when writing to the commit template file, as described in the code comments. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-31Compact commit template messageJeff King
We recently let the user know explicitly that an empty commit message will abort the commit. However, this adds yet another line to the template; let's rephrase and re-wrap so that this fits back on two lines. This patch also makes the "fatal: empty commit message?" warning a bit less scary, since this is now a "feature" instead of an error. However, we retain the non-zero exit status to indicate to callers that nothing was committed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30Advertise the ability to abort a commitAnders Melchiorsen
This treats aborting a commit more like a feature. Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23t7502-commit.sh: rearrange test to make more portableBrandon Casey
Some shells have problems with one-shot environment variable export and function calls. The sequence is rearranged to avoid the one-shot and to allow the test script to be linked together with '&&'. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-20t7502-commit.sh: test_must_fail doesn't work with inline environment variablesBrandon Casey
When the arguments to test_must_fail() begin with a variable assignment, test_must_fail() attempts to execute the variable assignment as a command. This fails, and so test_must_fail returns with a successful status value without running the command it was intended to test. For example, the following script: #!/bin/sh test_must_fail () { "$@" test $? -gt 0 -a $? -le 129 } foo='wo adrian' test_must_fail foo='yo adrian' sh -c 'echo foo: $foo' always exits zero and prints the message: test.sh: line 3: foo=yo adrian: command not found Test 16 calls test_must_fail in such a way and therefore has not been testing whether git 'do[es] not fire editor in the presence of conflicts'. A workaround is to set and export the variable in a normal way, not using one-shot notation. Because this would affect the remainder of the process, the test is done inside a subshell. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-04t7502: honor SHELL_PATHJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-04t7502: tighten loosely written test sequenceJunio C Hamano
We would like to catch breakage at any step in the sequence. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-04t7502: do not globally unset GIT_COMMITTER_* environment variablesJunio C Hamano
One particular test wants to check the behaviour of the command when these variables are not set, but the later tests should have the reliable committer identity for repeatable tests. Move the "unset" of the variables inside a subshell in the test that wants to unset them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-03commit: drop duplicated parentsJunio C Hamano
The scripted version of git-commit internally used git-commit-tree which omitted duplicated parents given from the command line. This prevented a nonsensical octopus merge from getting created even when you said "git merge A B" while you are already on branch A. However, when git-commit was rewritten in C, this sanity check was lost. This resurrects it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01rollback lock files on more signals than just SIGINTPaolo Bonzini
Other signals are also common, for example SIGTERM and SIGHUP. This patch modifies the lock file mechanism to catch more signals. It also modifies http-push.c which was missing SIGTERM. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-17Replace in-place sed in t7502-commitMarcel Koeppen
The in-place mode of sed used in t7502-commit is a non-POSIX extension. That call of sed is replaced by a more portable version using a temporary file. Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-07commit: Show committer if automaticSanti Béjar
To warn the user in case he/she might be using an unintended committer identity. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-07commit: Show author if different from committerSanti Béjar
That would help reassure anybody while committing other's changes. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13add test_cmp function for test scriptsJeff King
Many scripts compare actual and expected output using "diff -u". This is nicer than "cmp" because the output shows how the two differ. However, not all versions of diff understand -u, leading to unnecessary test failure. This adds a test_cmp function to the test scripts and switches all "diff -u" invocations to use it. The function uses the contents of "$GIT_TEST_CMP" to compare its arguments; the default is "diff -u". On systems with a less-capable diff, you can do: GIT_TEST_CMP=cmp make test Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-06git-commit: Refactor creation of log message.Paolo Bonzini
This patch moves the code of run_commit, up to writing the trees, editing the message and running the commit-msg hook to prepare_log_message. It also renames the latter to prepare_to_commit. This simplifies a little the code for the next patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-23Allow selection of different cleanup modes for commit messagesAlex Riesen
Although we traditionally stripped away excess blank lines, trailing whitespaces and lines that begin with "#" from the commit log message, sometimes the message just has to be the way user wants it. For instance, a commit message template can contain lines that begin with "#", the message must be kept as close to its original source as possible if you are converting from a foreign SCM, or maybe the message has a shell script including its comments for future reference. The cleanup modes are default, verbatim, whitespace and strip. The default mode depends on if the message is being edited and will either strip whitespace and comments (if editor active) or just strip the whitespace (for where the message is given explicitely). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-23Add a few more tests for git-commitJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>