Re: [PATCH 27/30] subtree: allow --squash to be used with --rejoin

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

 



On Fri, Apr 23, 2021 at 3:43 PM Luke Shumaker <lukeshu@xxxxxxxxxxx> wrote:
> Besides being a genuinely useful thing to do, this also just makes sense
> and harmonizes which flags may be used when.  `git subtree split
> --rejoin` amounts to "automatically go ahead and do a `git subtree
> merge` after doing the main `git subtree split`", so it's weird and
> arbitrary that you can't pass `--squash` to `git subtree split --rejoin`
> like you can `git subtree merge`.  It's weird that `git subtree split
> --rejoin` inherits `git subtree merge`'s `--message` but not `--squash`.
>
> Reconcile the situation by just having `split --rejoin` actually just
> call `merge` internally (or call `add` instead, as appropriate), so it
> can get access to the full `merge` behavior, including `--squash`.
>
> Signed-off-by: Luke Shumaker <lukeshu@xxxxxxxxxxx>
> ---
> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh
> @@ -324,6 +324,41 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
> +test_expect_success 'split "sub dir"/ with --rejoin and --squash' '
> +       [...]
> +               SPLIT=$(git subtree split --prefix="sub dir" --annotate="*" --rejoin --squash) &&
> +
> +               ! git merge-base --is-ancestor $SUB HEAD &&
> +               ! git merge-base --is-ancestor $SPLIT HEAD &&

It's preferable to use `test_must_fail` rather than `!` for Git
commands (but not for non-Git commands) since `test_must_fail`
correctly distinguishes between an expected failure and an unexpected
one such as a crash, whereas `!` can't make that distinction and would
even consider a crashed Git invocation to be successful.

Existing tests in this script already employ `test_must_fail` rather
than `!`, so using `test_must_fail` would also match precedent.



[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]

  Powered by Linux