Re: [PATCH/RFCv2 2/2] git rebase -i: warn about removed commits

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

 



On Mon, Jun 1, 2015 at 7:52 AM, Galan Rémi
<remi.galan-alfonso@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Check if commits were removed (i.e. a line was deleted) and print
> warnings or abort git rebase according to the value of the
> configuration variable rebase.checkLevel.
>
> Add the configuration variable rebase.checkLevel.
>     - When unset or set to "ignore", no checking is done.
>     - When set to "warn", the commits are checked, warnings are
>       displayed but git rebase still proceeds.
>     - When set to "error", the commits are checked, warnings are
>       displayed and the rebase is aborted.
>
> rebase.checkLevel defaults to "ignore".
>
> Signed-off-by: Galan Rémi <remi.galan-alfonso@xxxxxxxxxxxxxxxxxxxxxxx>
> ---
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 5f76e8c..e2e5554 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2160,6 +2160,15 @@ rebase.autoStash::
>         successful rebase might result in non-trivial conflicts.
>         Defaults to false.
>
> +rebase.checkLevel::
> +       If set to "warn", git rebase -i will print a warning if some
> +       commits are removed (i.e. a line was deleted) or if some
> +       commits appear more than one time (e.g. the same commit is
> +       picked twice), however the rebase will still proceed. If set

The cover letter says that v2 no longer checks for a duplicate,
however, this documentation still mentions it.

> +       to "error", it will print the previous warnings and abort the
> +       rebase. If set to "ignore", no checking is done.  Defaults to
> +       "ignore".
> +
>  receive.advertiseAtomic::
>         By default, git-receive-pack will advertise the atomic push
>         capability to its clients. If you don't want to this capability
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 9cf3760..d348ca2 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -213,6 +213,12 @@ rebase.autoSquash::
>  rebase.autoStash::
>         If set to true enable '--autostash' option by default.
>
> +rebase.checkLevel::
> +       If set to "warn" print warnings about removed commits and
> +       duplicated commits in interactive mode. If set to "error"

Same here.

> +       print the warnings and abort the rebase. If set to "ignore" no
> +       checking is done. "ignore" by default.
> +
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 1bad068..d3a9ed5 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1103,7 +1103,6 @@ test_expect_success 'rebase -i commits that overwrite untracked files (no ff)' '
>  '
>
>  test_expect_success 'drop' '
> -       git checkout master &&
>         test_when_finished "git checkout master" &&
>         git checkout -b dropBranchTest master &&

This "cleanup" change might deserve its own test (or at least a
mention in the commit message).

>         set_fake_editor &&
> @@ -1113,4 +1112,13 @@ test_expect_success 'drop' '
>         test A = $(git cat-file commit HEAD^^ | sed -ne \$p)
>  '
>
> +test_expect_success 'rebase -i respects rebase.checkLevel' '
> +       test_config rebase.checkLevel error &&
> +       test_when_finished "git checkout master" &&
> +       git checkout -b tmp2 master &&
> +       set_fake_editor &&
> +       test_must_fail env FAKE_LINES="1 2 3 4" git rebase -i --root &&
> +       test E = $(git cat-file commit HEAD | sed -ne \$p)
> +'

Shouldn't you also explicitly test "warn" and "ignore" modes?
--
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]