git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] t3700-add: added test for --exclude option

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Mar 15, 2015, 18:18 UTC
Message-ID
<CAPig+cRA9YqysB3Wakhu_a9hFnY189=4=Em2thY_rrFU552Nwg@mail.gmail.com>
In-Reply-To
<1426427437-23370-1-git-send-email-kuleshovmail@gmail.com>

On Sun, Mar 15, 2015 at 9:50 AM, Alexander Kuleshov <kuleshovmail@gmail.com> wrote:

> t3700-add: added test for --exclude option
Write in imperative mood: s/added/add/
Show 13 quoted lines
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
> ---
> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
> index f7ff1f5..c52a5d0 100755
> --- a/t/t3700-add.sh
> +++ b/t/t3700-add.sh
> @@ -81,6 +81,13 @@ test_expect_success '.gitignore is honored' '
>         ! (git ls-files | grep "\\.ig")
>  '
>
> +test_expect_success 'Test that "git add --exclude" works' '
> +       touch foo &&
> +       touch bar &&

Expanding slightly on what Torsten said: Use 'touch' when the timestamp of the file is significant to the test; otherwise, just use ">foo".

> +       git add --exclude="bar" . &&
> +       ! (git ls-files | grep bar)

For completeness, don't you also want to test that "foo" _does_ appear in the git-ls-files output?

Show 7 quoted lines
> +'
> +
>  test_expect_success 'error out when attempting to add ignored ones without -f' '
>         test_must_fail git add a.?? &&
>         ! (git ls-files | grep "\\.ig")
> --
> 2.3.3.472.g20ceeac
Previous: Torsten BögershausenNext: Philip Oakley
Message 6 of 16 in “add: add new --exclude option to git add”
  1. 1/3 add: add new --exclude option to git addAlexander Kuleshov, Mar 15, 2015
  2. 2/3 Documentation/git-add.txt: describe --exclude optionAlexander Kuleshov, Mar 15, 2015
  3. Eric SunshineMar 15, 2015
  4. 3/3 t3700-add: added test for --exclude optionAlexander Kuleshov, Mar 15, 2015
  5. Torsten BögershausenMar 15, 2015
  6. Eric SunshineMar 15, 2015
  7. Philip OakleyMar 15, 2015
  8. Torsten BögershausenMar 15, 2015
  9. Alexander KuleshovMar 15, 2015
  10. Torsten BögershausenMar 16, 2015
  11. Torsten BögershausenMar 15, 2015
  12. Eric SunshineMar 15, 2015
  13. Junio C HamanoMar 15, 2015
  14. Philip OakleyMar 15, 2015
  15. Junio C HamanoMar 15, 2015
  16. Alexander KuleshovMar 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.