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

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> 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.

That is, something like this on top of your patch.

 git-add--interactive.perl |   25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 28d36f7..28c28b7 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -318,7 +318,9 @@ sub list_modified {
 		}
 	}
 
-	for (run_cmd_pipe(qw(git diff-files --numstat --summary --), @tracked)) {
+	for (run_cmd_pipe(qw(git diff-files --numstat --summary),
+			  ($note_unmerged ? ("--raw") : ()),
+			  "--", @tracked)) {
 		if (($add, $del, $file) =
 		    /^([-\d]+)	([-\d]+)	(.*)/) {
 			$file = unquote_path($file);
@@ -340,26 +342,17 @@ sub list_modified {
 			if ($bin) {
 				$data{$file}{BINARY} = 1;
 			}
-		}
-		elsif (($adddel, $file) =
-		       /^ (create|delete) mode [0-7]+ (.*)$/) {
+		} elsif (/^:[0-7]+ [0-7]+ [0-9a-f]+ [0-9a-f]+ (.)	(.*)$/) {
+			if ($1 eq 'U') {
+				$file = unquote_path($2);
+				$data{$file}{UNMERGED} = 1;
+			}
+		} elsif (($adddel, $file) = /^ (create|delete) mode [0-7]+ (.*)$/) {
 			$file = unquote_path($file);
 			$data{$file}{FILE_ADDDEL} = $adddel;
 		}
 	}
 
-	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{$_};
 
--
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]