Merge branch 'master' into next

* master:
  t/{t5541,lib-httpd}: replace problematic '!()' notation with test_must_fail
  t/t3700: convert two uses of negation operator '!' to use test_must_fail
  t/README: clarify test_must_fail description
  Check size of path buffer before writing into it
This commit is contained in:
Junio C Hamano
2010-07-20 17:00:01 -07:00
5 changed files with 10 additions and 6 deletions

View File

@@ -170,6 +170,8 @@ static int is_git_directory(const char *suspect)
char path[PATH_MAX];
size_t len = strlen(suspect);
if (PATH_MAX <= len + strlen("/objects"))
die("Too long path: %.*s", 60, suspect);
strcpy(path, suspect);
if (getenv(DB_ENVIRONMENT)) {
if (access(getenv(DB_ENVIRONMENT), X_OK))

View File

@@ -451,8 +451,10 @@ library for your script to use.
- test_must_fail <git-command>
Run a git command and ensure it fails in a controlled way. Use
this instead of "! <git-command>" to fail when git commands
segfault.
this instead of "! <git-command>". When git-command dies due to a
segfault, test_must_fail diagnoses it as an error; "! <git-command>"
treats it as just another expected failure, which would let such a
bug go unnoticed.
- test_might_fail <git-command>

View File

@@ -145,7 +145,7 @@ test_http_push_nonff() {
echo "changed" > path2 &&
git commit -a -m path2 --amend &&
!(git push -v origin >output 2>&1) &&
test_must_fail git push -v origin >output 2>&1 &&
(cd "$REMOTE_REPO" &&
test $HEAD = $(git rev-parse --verify HEAD))
'

View File

@@ -268,7 +268,7 @@ test_expect_success 'git add --dry-run of existing changed file' "
test_expect_success 'git add --dry-run of non-existing file' "
echo ignored-file >>.gitignore &&
! (git add --dry-run track-this ignored-file >actual 2>&1) &&
test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 &&
echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
"
@@ -281,7 +281,7 @@ add 'track-this'
EOF
test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
!(git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1) &&
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 &&
test_cmp expect actual
'

View File

@@ -128,7 +128,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
# push master too; this ensures there is at least one '"'push'"' command to
# the remote helper and triggers interaction with the helper.
!(git push -v origin +master master:retsam >output 2>&1) &&
test_must_fail git push -v origin +master master:retsam >output 2>&1 &&
grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&