Re: [RFC/PATCH 01/18] Remove duplicate code

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

 



Elijah Newren <newren@xxxxxxxxx> writes:

> Subject: Re: [RFC/PATCH 01/18] Remove duplicate code

Subject: [RFC/PATCH 01/18] merge-recursive: remove duplicate code

> In commit 51931bf (merge-recursive: Improve handling of rename target vs.
> directory addition, 2011-08-11) I apparently added two lines of code that
> were immediately duplicated a few lines later.  No idea why, other than
> it seems pretty clear this was a mistake: there is no need to remove the
> same file twice; removing it once is sufficient...especially since the
> intervening line was working with a different file entirely.


Interesting.

I briefly wondered if the update_files() in the middle may be
prevented by D/F conflict if you didn't remove the path beforehand,
but path and new_path are both in the same directory, so that would
not be the reason.  Checking out 51931bf and running two tests (6022
and 6042) that were modified to protect the fix after applying this
partial revert does not seem to break, either, so...

Reviewed-by: Junio C Hamano <gitster@xxxxxxxxx>

>
> Signed-off-by: Elijah Newren <newren@xxxxxxxxx>
> ---
>  merge-recursive.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/merge-recursive.c b/merge-recursive.c
> index b880ae5..d4292de 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -1773,8 +1773,6 @@ static int process_entry(struct merge_options *o,
>  			output(o, 1, _("CONFLICT (%s): There is a directory with name %s in %s. "
>  			       "Adding %s as %s"),
>  			       conf, path, other_branch, path, new_path);
> -			if (o->call_depth)
> -				remove_file_from_cache(path);
>  			update_file(o, 0, sha, mode, new_path);
>  			if (o->call_depth)
>  				remove_file_from_cache(path);
--
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]