Re: [PATCH] merge-file: correctly find files when called in subdir

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

 



On Sat, Oct 16, 2010 at 13:33, Thomas Rast <trast@xxxxxxxxxxxxxxx> wrote:
> Since b541248 (merge.conflictstyle: choose between "merge" and "diff3
> -m" styles, 2008-08-29), git-merge-file uses setup_directory_gently(),
> thus cd'ing around to find any possible config files to use.
>
> This broke merge-file when it is called from within a subdirectory of
> a repository, and the arguments are all relative paths.
>
> Fix by prepending the prefix, as passed down from the main git
> executable, if there is any.
>
> Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx>
> ---
> Âbuiltin/merge-file.c Â| Â 11 ++++++++++-
> Ât/t6023-merge-file.sh | Â Â8 ++++++++
> Â2 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/builtin/merge-file.c b/builtin/merge-file.c
> index b6664d4..b873fee 100644
> --- a/builtin/merge-file.c
> +++ b/builtin/merge-file.c
> @@ -65,10 +66,18 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "%s\n", strerror(errno));
> Â Â Â Â}
>
> + Â Â Â if (prefix)
> + Â Â Â Â Â Â Â prefixlen = strlen(prefix);
> +
> Â Â Â Âfor (i = 0; i < 3; i++) {
> + Â Â Â Â Â Â Â const char *name;
> + Â Â Â Â Â Â Â if (prefix)
> + Â Â Â Â Â Â Â Â Â Â Â name = prefix_filename(prefix, prefixlen, argv[i]);
> + Â Â Â Â Â Â Â else
> + Â Â Â Â Â Â Â Â Â Â Â name = argv[i];

I think you can safe this condition, if you set prefixlen to 0.

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