Re: [PATCH] add -p: skip conflicted paths

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

 



Jeff King <peff@xxxxxxxx> writes:

> I do still think it would be nicer to pass the information out to the
> caller instead of just filtering.

Indeed.

> So combining the two patches, we have
> something like:

Hrm.  I kind of liked the idea of doing this with a single plumbing call
to diff-files (the entries that come from --raw will be mostly discarded
except for the ones that are marked with "U"), though.

> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index 2ee0908..0a83f56 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -292,7 +292,7 @@ sub get_empty_tree {
>  # FILE_ADDDEL:	is it add/delete between index and file?
>  
>  sub list_modified {
> -	my ($only) = @_;
> +	my ($only, $note_unmerged) = @_;
>  	my (%data, @return);
>  	my ($add, $del, $adddel, $file);
>  	my @tracked = ();
> @@ -370,6 +370,18 @@ sub list_modified {
>  		}
>  	}
>  
> +	if ($note_unmerged) {
> +		for (run_cmd_pipe(qw(git ls-files -u --), @ARGV)) {
> +			chomp $_;
> +			if (/^[0-7]+ [0-9a-f]{40} [0-3]	(.*)/) {
> +				my $path = unquote_path($1);
> +				if (exists($data{$path})) {
> +					$data{$path}{UNMERGED} = 1;
> +				}
> +			}
> +		}
> +	}
> +
>  	for (sort keys %data) {
>  		my $it = $data{$_};
>  
> @@ -1211,10 +1223,14 @@ sub apply_patch_for_checkout_commit {
>  }
>  
>  sub patch_update_cmd {
> -	my @all_mods = list_modified($patch_mode_flavour{FILTER});
> +	my @all_mods = list_modified($patch_mode_flavour{FILTER}, 'note-unmerged');
>  	my @mods = grep { !($_->{BINARY}) } @all_mods;
>  	my @them;
>  
> +	print colored $error_color, "ignoring unmerged: $_->{VALUE}\n"
> +		for grep { $_->{UNMERGED} } @mods;
> +	@mods = grep { !$_->{UNMERGED} } @mods;
> +
>  	if (!@mods) {
>  		if (@all_mods) {
>  			print STDERR "Only binary files changed.\n";
--
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]