Re: [PATCH v5 1/2] add: add --ignore-submodules[=<when>] parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 22, 2014 at 5:12 PM, Ronald Weiss <weiss.ronald@xxxxxxxxx> wrote:
> Allow ignoring submodules (or not) by command line switch, like diff
> and status do.
>
> This commit is also a prerequisite for the next one in series, which
> adds the --ignore-submodules switch to git commit. That's why a new
> argument is added to public function add_files_to_cache(), and it's

s/it's/its/

> call sites are updated to pass NULL.
>
> Signed-off-by: Ronald Weiss <weiss.ronald@xxxxxxxxx>
> ---
> diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
> index 9631526..b2c936f 100644
> --- a/Documentation/git-add.txt
> +++ b/Documentation/git-add.txt
> @@ -11,7 +11,7 @@ SYNOPSIS
>  'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
>           [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
>           [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing]
> -         [--] [<pathspec>...]
> +         [--ignore-submodules[=<when>]] [--] [<pathspec>...]
>
>  DESCRIPTION
>  -----------
> @@ -164,6 +164,11 @@ for "git add --no-all <pathspec>...", i.e. ignored removed files.
>         be ignored, no matter if they are already present in the work
>         tree or not.
>
> +--ignore-submodules[=<when>]::
> +       Can be used to override any settings of the 'submodule.*.ignore'
> +       option in linkgit:git-config[1] or linkgit:gitmodules[5].
> +       <when> can be either "none" or "all", which is the default.

The "which is the default" clause reads ambiguously. It's not clear
whether you mean "none" is the default or "all" is the default.

>  \--::
>         This option can be used to separate command-line options from
>         the list of files, (useful when filenames might be mistaken
> diff --git a/t/t3704-add-ignore-submodules.sh b/t/t3704-add-ignore-submodules.sh
> new file mode 100755
> index 0000000..db58f0c
> --- /dev/null
> +++ b/t/t3704-add-ignore-submodules.sh
> @@ -0,0 +1,45 @@
> +#!/bin/sh
> +#
> +# Copyright (c) 2014 Ronald Weiss
> +#
> +
> +test_description='Test of git add with ignoring submodules'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'create dirty submodule' '
> +       test_create_repo sm && (

It's conventional for the opening '(' to be placed on a line by itself.

> +               cd sm &&
> +               >foo &&
> +               git add foo &&
> +               git commit -m "Add foo"
> +       ) &&
> +       git submodule add ./sm &&
> +       git commit -m "Add sm" && (
> +               cd sm &&
> +               echo bar >> foo &&

s/>> />>/

> +               git add foo &&
> +               git commit -m "Update foo"
> +       )
> +'
> +
> +test_expect_success 'add --ignore-submodules ignores submodule' '
> +       git reset &&
> +       git add -u --ignore-submodules &&
> +       git diff --cached --exit-code --ignore-submodules=none
> +'
> +
> +test_expect_success 'add --ignore-submodules=all ignores submodule' '
> +       git reset &&
> +       git add -u --ignore-submodules=all &&
> +       git diff --cached --exit-code --ignore-submodules=none
> +'
> +
> +test_expect_success 'add --ignore-submodules=none overrides ignore=all from config' '
> +       git reset &&
> +       git config submodule.sm.ignore all &&
> +       git add -u --ignore-submodules=none &&
> +       test_must_fail git diff --cached --exit-code --ignore-submodules=none
> +'
> +
> +test_done
> --
> 1.9.1.3.g7790cde.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]