Git development
 help / color / mirror / Atom feed
* [PATCH (resend)] Pass -C1 to git-apply in StGIT's apply_diff() and apply_patch().
@ 2007-04-09 11:24 Tomash Brechko
  2007-04-10 16:48 ` Catalin Marinas
  0 siblings, 1 reply; 6+ messages in thread
From: Tomash Brechko @ 2007-04-09 11:24 UTC (permalink / raw)
  To: catalin.marinas, git

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

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

end of thread, other threads:[~2007-04-11  7:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-09 11:24 [PATCH (resend)] Pass -C1 to git-apply in StGIT's apply_diff() and apply_patch() Tomash Brechko
2007-04-10 16:48 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox