Re: [PATCH 9/9] subtree: fix split after annotated tag was squashed merged
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 21, 2022, 16:37 UTC
- Message-ID
- <221021.86mt9pdtcw.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <86a842d50345f6d4d0b16c78d565474be6f8068a.1666365220.git.gitgitgadget@gmail.com>
On Fri, Oct 21 2022, Philippe Blain via GitGitGadget wrote:
Show 40 quoted lines
> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> The previous commit fixed a failure in 'git subtree merge --squash' when
> the previous squash-merge merged an annotated tag of the subtree
> repository which is missing locally.
>
> The same failure happens in 'git subtree split', either directly or when
> called by 'git subtree push', under the same circumstances: 'cmd_split'
> invokes 'find_existing_splits', which loops through previous commits and
> invokes 'git rev-parse' (via 'process_subtree_split_trailer') on the
> value of any 'git subtree-split' trailer it finds. This fails if this
> value is the hash of an annotated tag which is missing locally.
>
> Add a new optional argument 'repository' to 'cmd_split' and
> 'find_existing_splits', and invoke 'cmd_split' with that argument from
> 'cmd_push'. This allows 'process_subtree_split_trailer' to try to fetch
> the missing tag from the 'repository' if it's not available locally,
> mirroring the new behaviour of 'git subtree pull' and 'git subtree
> merge'.
>
> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> ---
> contrib/subtree/git-subtree.sh | 26 ++++++++++++++++++--------
> contrib/subtree/git-subtree.txt | 7 ++++++-
> contrib/subtree/t/t7900-subtree.sh | 12 ++++++++++++
> 3 files changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 2c67989fe8a..10c9c87839a 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -453,14 +453,19 @@ find_latest_squash () {
> done || exit $?
> }
>
> -# Usage: find_existing_splits DIR REV
> +# Usage: find_existing_splits DIR REV [REPOSITORY]
> find_existing_splits () {
> - assert test $# = 2
> + assert test $# = 2 -o $# = 3This "test" syntax is considered unportable, I'm too lazy to dig up the reference, but we've removed it in the past. Maybe it's OK with git-subtree.sh", but anyway, it's esay enough to change...
...but looking at "master" I see one instance of it in git-subtree.sh already, so maybe nobody cares...