From: Erik Faye-Lund <kusmabite@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, matthieu.moy@grenoble-inp.fr, hellmuth@ira.uka.de
Subject: [PATCH] add -p: skip conflicted paths
Date: Wed, 28 Mar 2012 21:18:02 +0200 [thread overview]
Message-ID: <1332962282-4040-1-git-send-email-kusmabite@gmail.com> (raw)
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
next reply other threads:[~2012-03-28 19:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 19:18 Erik Faye-Lund [this message]
2012-03-28 19:28 ` [PATCH] add -p: skip conflicted paths 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332962282-4040-1-git-send-email-kusmabite@gmail.com \
--to=kusmabite@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hellmuth@ira.uka.de \
--cc=matthieu.moy@grenoble-inp.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).