Re: [PATCH v8 07/14] merge-one-file: rewrite in C

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

 



Hi Alban,

what an incredible amount of careful work. Thank you for doing this.

A few minor comments:

On Tue, 9 Aug 2022, Alban Gruin wrote:

> diff --git a/builtin/merge-one-file.c b/builtin/merge-one-file.c
> new file mode 100644
> index 0000000000..ec718cc1c9
> --- /dev/null
> +++ b/builtin/merge-one-file.c
> @@ -0,0 +1,92 @@
> +/*
> + * Builtin "git merge-one-file"
> + *
> + * Copyright (c) 2020 Alban Gruin

There have been claims that it is still March 2020 (see e.g.
https://ismarchoveryet.com/), but I believe that those are jokes and that
we're really in the year 2022 now. It should be safe to adjust the text
accordingly.

:-)

> [...]
> +int merge_three_way(struct index_state *istate,
> +		    const struct object_id *orig_blob,
> +		    const struct object_id *our_blob,
> +		    const struct object_id *their_blob, const char *path,
> +		    unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode)
> +{
> [...]
> +}
> +
> +int merge_one_file_func(struct index_state *istate,
> +			const struct object_id *orig_blob,
> +			const struct object_id *our_blob,
> +			const struct object_id *their_blob, const char *path,
> +			unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode,
> +			void *data)
> +{
> +	return merge_three_way(istate,
> +			       orig_blob, our_blob, their_blob, path,
> +			       orig_mode, our_mode, their_mode);
> +}

I have only read the patch series until this point (and plan on continuing
with the remaining patches tomorrow), so I might be wrong, but... is there
any other user of `merge_three_way()` left? If not (and I suspect this is
the case), then the `merge_three_way()` code could be moved into
`merge_one_file_func()`.

> [...]
> diff --git a/t/t6060-merge-index.sh b/t/t6060-merge-index.sh
> index 3845a9d3cc..9976996c80 100755
> --- a/t/t6060-merge-index.sh
> +++ b/t/t6060-merge-index.sh
> @@ -70,7 +70,7 @@ test_expect_success 'merge-one-file fails without a work tree' '
>  	(cd bare.git &&
>  	 GIT_INDEX_FILE=$PWD/merge.index &&
>  	 export GIT_INDEX_FILE &&
> -	 test_must_fail git merge-index git-merge-one-file -a
> +	 test_must_fail git merge-index --use=merge-one-file -a

This hunk probably wanted to live in [PATCH v8 05/14] merge-index: add a
new way to invoke `git-merge-one-file', but as I pointed out in my reply
to that patch: I do not think that we have to introduce that `--use=<...>`
option at all.

>  	)
>  '
>
> diff --git a/t/t6415-merge-dir-to-symlink.sh b/t/t6415-merge-dir-to-symlink.sh
> index 2655e295f5..10bc5eb8c4 100755
> --- a/t/t6415-merge-dir-to-symlink.sh
> +++ b/t/t6415-merge-dir-to-symlink.sh
> @@ -99,7 +99,7 @@ test_expect_success SYMLINKS 'a/b was resolved as symlink' '
>  	test -h a/b
>  '
>
> -test_expect_failure 'do not lose untracked in merge (resolve)' '
> +test_expect_success 'do not lose untracked in merge (resolve)' '

Very, very nice.

Thank you!
Dscho

>  	git reset --hard &&
>  	git checkout baseline^0 &&
>  	>a/b/c/e &&
> --
> 2.37.1.412.gcfdce49ffd
>
>




[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