Re: [PATCH v2 1/2] mergetool: don't skip modify/remove conflicts

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

 



Martin von Zweigbergk <martin.von.zweigbergk@xxxxxxxxx> writes:

> diff --git a/builtin/rerere.c b/builtin/rerere.c
> index 081fccc..7b9fe18 100644
> --- a/builtin/rerere.c
> +++ b/builtin/rerere.c
> @@ -147,8 +147,6 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
>  	if (!strcmp(argv[0], "clear")) {
>  		for (i = 0; i < merge_rr.nr; i++) {
>  			const char *name = (const char *)merge_rr.items[i].util;
> -			if (!name)
> -				continue;
>  			if (!has_rerere_resolution(name))
>  				unlink_rr_item(name);
>  		}
> @@ -157,19 +155,22 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
>  		garbage_collect(&merge_rr);
>  	else if (!strcmp(argv[0], "status"))
>  		for (i = 0; i < merge_rr.nr; i++) {
> -			if (!merge_rr.items[i].util)
> -				continue;
>  			printf("%s\n", merge_rr.items[i].string);
>  		}
> -	else if (!strcmp(argv[0], "remaining"))
> -		for (i = 0; i < merge_rr.nr; i++)
> -			printf("%s\n", merge_rr.items[i].string);
> -	else if (!strcmp(argv[0], "diff"))
> +	else if (!strcmp(argv[0], "remaining")) {
> +		rerere_remaining(&merge_rr);
> +		for (i = 0; i < merge_rr.nr; i++) {
> +			if (merge_rr.items[i].util != RERERE_RESOLVED)
> +				printf("%s\n", merge_rr.items[i].string);
> +			else
> +				/* prepare for later call to
> +				 * string_list_clear() */
> +				merge_rr.items[i].util = NULL;
> +		}
> +	} else if (!strcmp(argv[0], "diff"))
>  		for (i = 0; i < merge_rr.nr; i++) {
>  			const char *path = merge_rr.items[i].string;
>  			const char *name = (const char *)merge_rr.items[i].util;
> -			if (!name)
> -				continue;
>  			diff_two(rerere_path(name, "preimage"), path, path, path);
>  		}
>  	else

By looking at the diff between the parent of f322b35 (my earlier "rerere
remaining" patch) and the result of applying this patch on top of the
patch, I think the basic idea of this is to correct my stupid mistake of
contaminating merge_rr unconditionally, and instead adding the "remaining"
entries only when handling the "rerere remaining" command (hence many
removal of special cases "if (!name) continue" introduced by my patch.
The result looks _much_ cleaner than the above patch shows and I am happy
with it.

But shouldn't you also revert the parts of my patch to do_plain_rerere()
and rerere_forget() that have similar special cases?
--
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]