git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Cc: Git List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH (Apple Git) 03/13] t0500: New regression test for git add of a path that contains a .git directory
Date: Wed, 30 Jan 2019 06:47:41 -0500	[thread overview]
Message-ID: <CAPig+cR_p9ybUjfSqY_Kod39Ztxt9Y7Js=QvFU-WDJh58sb5Yg@mail.gmail.com> (raw)
In-Reply-To: <20190129193818.8645-4-jeremyhu@apple.com>

On Tue, Jan 29, 2019 at 4:19 PM Jeremy Huddleston Sequoia
<jeremyhu@apple.com> wrote:
> Subject: t0500: New regression test for git add of a path that contains a .git directory

Please describe the actual problem here in the commit message so
readers of this change can understand what this is all about.

> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
> ---
> diff --git a/t/t0500-apple.sh b/t/t0500-apple.sh
> @@ -0,0 +1,40 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2012-2016 Apple Inc.
> +#
> +# Tests for regressions found by Apple Inc. for issues that upstream does not
> +# want to fix or accept tests for.

This is an odd comment for a patch which is intended to be upstreamed.

> +test_description='Apple Inc. specific tests'

Is this script actually specific to Apple? If not, a better
description is likely warranted. Alternatively, place this new test in
an appropriate existing test script.

> +# <rdar://problem/10238070>

Inaccessible private bug report. Please describe the actual regression here.

> +# This test case addresses a regression introduced between v1.7.3 and v1.7.5
> +# git bisect good v1.7.3
> +# git bisect bad v1.7.5
> +# ...
> +# found 18e051a3981f38db08521bb61ccf7e4571335353

This commentary isn't very useful going forward, thus not worth having
in the script itself, although it may make useful information for the
commit message (though more likely not). Usually, such commentary
would be placed below the "---" line just under your sign-off.

> +test_expect_success '<rdar://problem/10238070> -- git add of a path that contains a .git directory' '

As above, a better title would be welcome, one which actually means
something to people without access to the private bug report.

> +       rm -rf .git &&
> +       mkdir -p orig/sub/dir/otherdir &&
> +       cd orig/sub &&

We don't 'cd' around inside tests without ensuring that the 'cd' is
undone automatically even if the test fails. (See below.)

> +       echo "1" > dir/file &&
> +       echo "2" > dir/otherdir/file &&
> +       git init --quiet &&

Why --quiet? Output generated by commands is already suppressed by
default when the test is run normally, but it is useful to have when
something goes wrong, so we don't usually want to suppress it
manually. Same comment applies to >/dev/null redirects.

> +       git add -A &&
> +       git commit -m "Initial Commit" --quiet &&
> +       cd - > /dev/null &&

If something fails above this point, then this "cd -" will never
execute, so any tests which get added below this one in the script
will operate in the wrong directory. The normal way to 'cd' within a
test is within a subshell so the 'cd' is undone automatically whether
the test fails or not:

    (
        cd orig/sub
        ...
    )

> +       git init --bare --quiet "${TESTROOT}/git_dir.git" &&
> +       git --git-dir="${TESTROOT}/git_dir.git" --work-tree=/ add -f -- "${TESTROOT}/orig/sub/" &&
> +       git --git-dir="${TESTROOT}/git_dir.git" --work-tree=/ add -f -- "${TESTROOT}/orig/" &&
> +       git --git-dir="${TESTROOT}/git_dir.git" --work-tree=/ commit -m "Commit." |
> +               grep -q "2 files changed, 2 insertions"
> +'

We don't normally place a Git command upstream of a pipe since its
exit status will get swallowed by the pipe, thus potentially losing
important information. Instead, redirect the command output to a file
and 'grep' on the file.

Also, the string you're grepping is likely to be localized, so use
test_i18ngrep() instead.

  reply	other threads:[~2019-01-30 11:47 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 19:38 [PATCH (Apple Git) 00/13] Differences between git-2.20.1 and Apple Git-116 Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 01/13] .gitignore: Remove *.s as it matches *.S on case insensitive filesystem Jeremy Huddleston Sequoia
2019-01-30 11:33   ` Eric Sunshine
2019-01-30 11:37     ` Jeremy Huddleston Sequoia
2019-01-30 12:29       ` Eric Sunshine
2019-01-30 12:32         ` Eric Sunshine
2019-01-30 12:42       ` Johannes Schindelin
2019-01-30 19:13         ` Jeremy Huddleston Sequoia
2019-01-31 17:57           ` Junio C Hamano
2019-01-31 18:17             ` Jeremy Sequoia
2019-01-31 19:48               ` Eric Sunshine
2019-01-30 16:47   ` Junio C Hamano
2019-01-29 19:38 ` [PATCH (Apple Git) 02/13] test-lib: Export PERL5LIB for testing git-svn Jeremy Huddleston Sequoia
2019-01-29 22:47   ` Junio C Hamano
2019-01-29 23:46     ` Jeremy Huddleston Sequoia
2019-01-29 23:59       ` SZEDER Gábor
2019-01-30  0:01         ` Jeremy Sequoia
2019-01-30 18:59           ` Junio C Hamano
2019-01-30  0:07         ` Carlo Arenas
2019-01-30 12:51       ` Johannes Schindelin
2019-01-30 18:45         ` Jeremy Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 03/13] t0500: New regression test for git add of a path that contains a .git directory Jeremy Huddleston Sequoia
2019-01-30 11:47   ` Eric Sunshine [this message]
2019-01-30 13:12   ` Johannes Schindelin
2019-01-30 19:04     ` Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 04/13] t4014: git --version can have SP in it Jeremy Huddleston Sequoia
2019-01-29 22:58   ` Junio C Hamano
2019-01-30 13:30   ` Johannes Schindelin
2019-01-29 19:38 ` [PATCH (Apple Git) 05/13] t5701: " Jeremy Huddleston Sequoia
2019-01-30 13:36   ` Johannes Schindelin
2019-01-30 19:35     ` Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 06/13] Set Apple Git version during build Jeremy Huddleston Sequoia
2019-01-30 13:43   ` Johannes Schindelin
2019-01-30 19:45     ` Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 07/13] HTML documentation is not provided with Apple's git. Make the error message more on point Jeremy Huddleston Sequoia
2019-01-29 23:01   ` Junio C Hamano
2019-01-30 13:45     ` Johannes Schindelin
2019-01-30 16:50       ` Junio C Hamano
2019-01-30 19:34         ` Johannes Schindelin
2019-01-29 19:38 ` [PATCH (Apple Git) 08/13] git mergetool/difftool doesn't list 'opendiff' as an available tool on 10.8 Jeremy Huddleston Sequoia
2019-01-30 19:07   ` Johannes Schindelin
2019-01-29 19:38 ` [PATCH (Apple Git) 09/13] Use symbolic links rather than hard links for files in libexec Jeremy Huddleston Sequoia
2019-01-30  9:50   ` brian m. carlson
2019-01-30 11:41     ` Jeremy Huddleston Sequoia
2019-01-30 19:15       ` Johannes Schindelin
2019-01-30 20:52         ` Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 10/13] Support for Xcode.app co-exestince and relocation Jeremy Huddleston Sequoia
2019-01-30 19:26   ` Johannes Schindelin
2019-01-30 21:07     ` Jeremy Huddleston Sequoia
2019-01-29 19:38 ` [PATCH (Apple Git) 11/13] Fix problem found from running the test suite Jeremy Huddleston Sequoia
2019-01-29 23:12   ` Junio C Hamano
2019-01-29 23:30   ` Eric Wong
2019-01-29 19:38 ` [PATCH (Apple Git) 12/13] Enable support for Xcode.app-bundled gitconfig Jeremy Huddleston Sequoia
2019-01-29 23:10   ` Junio C Hamano
2019-01-29 23:51     ` Jeremy Huddleston Sequoia
2019-01-30 19:32       ` Johannes Schindelin
2019-01-30 21:09         ` Jeremy Huddleston Sequoia
2019-01-30 22:01           ` Jeremy Huddleston Sequoia
2019-01-31  0:01             ` Jonathan Nieder
2019-01-31  8:29               ` Jeremy Huddleston Sequoia
2019-01-31 18:06           ` Junio C Hamano
2019-01-30  9:44     ` brian m. carlson
2019-01-29 19:38 ` [PATCH (Apple Git) 13/13] Enable support for Xcode.app-bundled gitattributes Jeremy Huddleston Sequoia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPig+cR_p9ybUjfSqY_Kod39Ztxt9Y7Js=QvFU-WDJh58sb5Yg@mail.gmail.com' \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=jeremyhu@apple.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).