Git development
 help / color / mirror / Atom feed
From: Yann Dirson <ydirson@altern.org>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT RFC PATCH] Activate rename detection by default.
Date: Sat, 05 May 2007 01:54:33 +0200	[thread overview]
Message-ID: <20070504235413.29479.13640.stgit@gandelf.nowhere.earth> (raw)


This patch uses -M when generating diffs, which then looks fine, just
like any other git-generated diff.

While I was at it, I also added -M when calling "stg files" or "stg
status".  While we need that for completeness, we currently just
display the raw git-diff-tree output, and it may break some scripts.
We may also want to make it more human-readable (not sure how, esp. if
we want to remain machine-parsable).

It also raises the issue of whether to activate this by default or not
(mostly in status and files), and how to select this behaviour -
something which will possibly be needed to be decided before
introducing -C and --find-copies-harder, which would be useful as
well, the latter being definitely a candidate to be off by default.

That gives:

$ ./stg status
? contrib/stg-push-force
R100 README     README2
M stgit/git.py

$ ./stg files sink 
R056 Documentation/stg-bury.txt Documentation/stg-sink.txt
M Documentation/stg.txt
M contrib/stgit-completion.bash
R093 stgit/commands/bury.py     stgit/commands/sink.py
M stgit/main.py

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 README2      |    0 
 stgit/git.py |   12 ++++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README2
similarity index 100%
rename from README
rename to README2
diff --git a/stgit/git.py b/stgit/git.py
index d7eb48e..ed09eca 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -255,7 +255,7 @@ def __tree_status(files = None, tree_id = 'HEAD', unknown = False,
     cache_files += [('C', filename) for filename in conflicts]
 
     # the rest
-    for line in _output_lines(['git-diff-index', tree_id, '--'] + files):
+    for line in _output_lines(['git-diff-index', '-M', tree_id, '--'] + files):
         fs = tuple(line.rstrip().split(' ',4)[-1].split('\t',1))
         if fs[1] not in conflicts:
             cache_files.append(fs)
@@ -774,13 +774,13 @@ def diff(files = None, rev1 = 'HEAD', rev2 = None, out_fd = None):
         files = []
 
     if rev1 and rev2:
-        diff_str = _output(['git-diff-tree', '-p', rev1, rev2, '--'] + files)
+        diff_str = _output(['git-diff-tree', '-M', '-p', rev1, rev2, '--'] + files)
     elif rev1 or rev2:
         refresh_index()
         if rev2:
-            diff_str = _output(['git-diff-index', '-p', '-R', rev2, '--'] + files)
+            diff_str = _output(['git-diff-index', '-M', '-p', '-R', rev2, '--'] + files)
         else:
-            diff_str = _output(['git-diff-index', '-p', rev1, '--'] + files)
+            diff_str = _output(['git-diff-index', '-M', '-p', rev1, '--'] + files)
     else:
         diff_str = ''
 
@@ -808,7 +808,7 @@ def files(rev1, rev2):
     """
 
     result = ''
-    for line in _output_lines('git-diff-tree -r %s %s' % (rev1, rev2)):
+    for line in _output_lines('git-diff-tree -M -r %s %s' % (rev1, rev2)):
         result += '%s %s\n' % tuple(line.rstrip().split(' ',4)[-1].split('\t',1))
 
     return result.rstrip()
@@ -826,7 +826,7 @@ def barefiles(rev1, rev2):
 def pretty_commit(commit_id = 'HEAD'):
     """Return a given commit (log + diff)
     """
-    return _output(['git-diff-tree', '--cc', '--always', '--pretty', '-r',
+    return _output(['git-diff-tree', '-M', '--cc', '--always', '--pretty', '-r',
                     commit_id])
 
 def checkout(files = None, tree_id = None, force = False):

             reply	other threads:[~2007-05-04 23:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04 23:54 Yann Dirson [this message]
2007-05-15 15:41 ` [StGIT RFC PATCH] Activate rename detection by default Catalin Marinas
2007-05-15 18:47   ` Karl Hasselström
2007-05-15 21:37     ` Yann Dirson

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=20070504235413.29479.13640.stgit@gandelf.nowhere.earth \
    --to=ydirson@altern.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox