All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomash Brechko <tomash.brechko@gmail.com>
To: catalin.marinas@gmail.com, git@vger.kernel.org
Subject: [PATCH (resend)] Pass -C1 to git-apply in StGIT's apply_diff() and apply_patch().
Date: Mon, 9 Apr 2007 15:24:22 +0400	[thread overview]
Message-ID: <20070409112422.GE11593@moonlight.home> (raw)

Running git-apply without -C is too restrictive: when the patch has
some fuzz (it could have been applied upstream with the fuzz, or
different local branches have slightly different context), StGIT would
start manual merge because of the conflict in the context.  Passing
-C1 makes git-apply behave close to default mode of diff/patch: 'diff'
generates 3 lines of context, and 'patch' allows 2 line mismatch,
i.e. it requires the match of at least one context line.

Fix in apply_diff() relaxes the restriction in 'push --merged' and
'rebase --merged' for detection of upstream merges, fix in
apply_patch() does relaxation 'import', 'fold' and 'sync' commands.

This patch is a quick hack, better solution would be to have a control
over the value to -C option, or to have the option similar to
git-cvsexportcommit -p (pedantic mode).
---
 stgit/git.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stgit/git.py b/stgit/git.py
index f6d6b43..bbb41fe 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -660,7 +660,7 @@ def apply_diff(rev1, rev2, check_index = True, files = None):
     diff_str = diff(files, rev1, rev2)
     if diff_str:
         try:
-            _input_str('git-apply %s' % index_opt, diff_str)
+            _input_str('git-apply -C1 %s' % index_opt, diff_str)
         except GitException:
             return False
 
@@ -930,7 +930,7 @@ def apply_patch(filename = None, diff = None, base = None,
         refresh_index()
 
     try:
-        _input_str('git-apply --index', diff)
+        _input_str('git-apply -C1 --index', diff)
     except GitException:
         if base:
             switch(orig_head)
-- 
1.5.1.82.g46af1-dirty

             reply	other threads:[~2007-04-09 11:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-09 11:24 Tomash Brechko [this message]
2007-04-10 16:48 ` [PATCH (resend)] Pass -C1 to git-apply in StGIT's apply_diff() and apply_patch() Catalin Marinas
2007-04-10 19:21   ` Tomash Brechko
2007-04-10 19:32     ` Tomash Brechko
2007-04-10 22:38       ` Catalin Marinas
2007-04-11  7:51         ` Tomash Brechko

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=20070409112422.GE11593@moonlight.home \
    --to=tomash.brechko@gmail.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.