git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add -p: skip conflicted paths
@ 2012-03-28 19:18 Erik Faye-Lund
  2012-03-28 19:28 ` Junio C Hamano
  0 siblings, 1 reply; 16+ messages in thread
From: Erik Faye-Lund @ 2012-03-28 19:18 UTC (permalink / raw)
  To: git; +Cc: gitster, matthieu.moy, hellmuth

When performing "git add -p" on a file in a conflicted state, we
currently spew the diff and terminate the process.

This is not very helpful to the user. Change the behaviour to
skipping the file, while outputting a warning.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---

OK, here's a quick stab at fixing the "add -p" issue. Note that
I'm not very fluent in Perl, so apologies if this is not up to
standards.

 git-add--interactive.perl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 8f0839d..a52507f 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1259,6 +1259,13 @@ sub patch_update_file {
 	my $quit = 0;
 	my ($ix, $num);
 	my $path = shift;
+
+	# skip conflicted paths
+	if (run_cmd_pipe(qw(git ls-files -u --), $path)) {
+		print colored $error_color, "Warning: $path is in conflicted state, skipping.\n";
+		return 0;
+	}
+
 	my ($head, @hunk) = parse_diff($path);
 	($head, my $mode, my $deletion) = parse_diff_header($head);
 	for (@{$head->{DISPLAY}}) {
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-04-05 12:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 19:18 [PATCH] add -p: skip conflicted paths Erik Faye-Lund
2012-03-28 19:28 ` Junio C Hamano
2012-03-28 20:20   ` Erik Faye-Lund
2012-03-28 21:39     ` Junio C Hamano
2012-03-28 21:58       ` Junio C Hamano
2012-03-28 22:14         ` Junio C Hamano
2012-03-29  5:45           ` Jeff King
2012-04-02 17:20             ` Erik Faye-Lund
2012-04-02 18:25               ` Junio C Hamano
2012-04-04  9:46                 ` Jeff King
2012-04-04 12:50                   ` Tay Ray Chuan
2012-04-04 15:36                   ` Junio C Hamano
2012-04-04 18:29                     ` Junio C Hamano
2012-04-04 20:25                       ` Jeff King
2012-04-04 21:31                         ` Junio C Hamano
2012-04-05 12:30                           ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).