{"thread":{"id":"7978","subject":"[StGIT RFC PATCH] Activate rename detection by default.","startedAt":"2007-05-04T23:54:33Z","lastAt":"2007-05-15T21:37:17Z","messageCount":4,"participants":["Yann Dirson","Catalin Marinas","Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"41105","messageId":"20070504235413.29479.13640.stgit@gandelf.nowhere.earth","threadId":"7978","inReplyTo":null,"subject":"[StGIT RFC PATCH] Activate rename detection by default.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-05-04T23:54:33Z","receivedAt":"2007-05-04T23:54:33Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nThis patch uses -M when generating diffs, which then looks fine, just\nlike any other git-generated diff.\n\nWhile I was at it, I also added -M when calling \"stg files\" or \"stg\nstatus\".  While we need that for completeness, we currently just\ndisplay the raw git-diff-tree output, and it may break some scripts.\nWe may also want to make it more human-readable (not sure how, esp. if\nwe want to remain machine-parsable).\n\nIt also raises the issue of whether to activate this by default or not\n(mostly in status and files), and how to select this behaviour -\nsomething which will possibly be needed to be decided before\nintroducing -C and --find-copies-harder, which would be useful as\nwell, the latter being definitely a candidate to be off by default.\n\nThat gives:\n\n$ ./stg status\n? contrib/stg-push-force\nR100 README     README2\nM stgit/git.py\n\n$ ./stg files sink \nR056 Documentation/stg-bury.txt Documentation/stg-sink.txt\nM Documentation/stg.txt\nM contrib/stgit-completion.bash\nR093 stgit/commands/bury.py     stgit/commands/sink.py\nM stgit/main.py\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n README2      |    0 \n stgit/git.py |   12 ++++++------\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/README b/README2\nsimilarity index 100%\nrename from README\nrename to README2\ndiff --git a/stgit/git.py b/stgit/git.py\nindex d7eb48e..ed09eca 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -255,7 +255,7 @@ def __tree_status(files = None, tree_id = 'HEAD', unknown = False,\n     cache_files += [('C', filename) for filename in conflicts]\n \n     # the rest\n-    for line in _output_lines(['git-diff-index', tree_id, '--'] + files):\n+    for line in _output_lines(['git-diff-index', '-M', tree_id, '--'] + files):\n         fs = tuple(line.rstrip().split(' ',4)[-1].split('\\t',1))\n         if fs[1] not in conflicts:\n             cache_files.append(fs)\n@@ -774,13 +774,13 @@ def diff(files = None, rev1 = 'HEAD', rev2 = None, out_fd = None):\n         files = []\n \n     if rev1 and rev2:\n-        diff_str = _output(['git-diff-tree', '-p', rev1, rev2, '--'] + files)\n+        diff_str = _output(['git-diff-tree', '-M', '-p', rev1, rev2, '--'] + files)\n     elif rev1 or rev2:\n         refresh_index()\n         if rev2:\n-            diff_str = _output(['git-diff-index', '-p', '-R', rev2, '--'] + files)\n+            diff_str = _output(['git-diff-index', '-M', '-p', '-R', rev2, '--'] + files)\n         else:\n-            diff_str = _output(['git-diff-index', '-p', rev1, '--'] + files)\n+            diff_str = _output(['git-diff-index', '-M', '-p', rev1, '--'] + files)\n     else:\n         diff_str = ''\n \n@@ -808,7 +808,7 @@ def files(rev1, rev2):\n     \"\"\"\n \n     result = ''\n-    for line in _output_lines('git-diff-tree -r %s %s' % (rev1, rev2)):\n+    for line in _output_lines('git-diff-tree -M -r %s %s' % (rev1, rev2)):\n         result += '%s %s\\n' % tuple(line.rstrip().split(' ',4)[-1].split('\\t',1))\n \n     return result.rstrip()\n@@ -826,7 +826,7 @@ def barefiles(rev1, rev2):\n def pretty_commit(commit_id = 'HEAD'):\n     \"\"\"Return a given commit (log + diff)\n     \"\"\"\n-    return _output(['git-diff-tree', '--cc', '--always', '--pretty', '-r',\n+    return _output(['git-diff-tree', '-M', '--cc', '--always', '--pretty', '-r',\n                     commit_id])\n \n def checkout(files = None, tree_id = None, force = False):\n"},{"id":"42226","messageId":"b0943d9e0705150841l6fe05baajab67a16eb78e411d@mail.gmail.com","threadId":"7978","inReplyTo":"20070504235413.29479.13640.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT RFC PATCH] Activate rename detection by default.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-05-15T15:41:47Z","receivedAt":"2007-05-15T15:41:47Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 05/05/07, Yann Dirson <ydirson@altern.org> wrote:\n> This patch uses -M when generating diffs, which then looks fine, just\n> like any other git-generated diff.\n\nI think we should only use -M for \"files\", \"status\", \"show\", \"diff\"\nbut not for \"export\" and \"mail\", maybe by adding an extra parameter to\ngit.diff() (or we could have this configurable or with an cmd line\noption). The reason is that I send patches that might not be applied\nwith GIT.\n\n-- \nCatalin\n"},{"id":"42240","messageId":"20070515184759.GC17851@diana.vm.bytemark.co.uk","threadId":"7978","inReplyTo":"b0943d9e0705150841l6fe05baajab67a16eb78e411d@mail.gmail.com","subject":"Re: [StGIT RFC PATCH] Activate rename detection by default.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-05-15T18:47:59Z","receivedAt":"2007-05-15T18:47:59Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-05-15 16:41:47 +0100, Catalin Marinas wrote:\n\n> On 05/05/07, Yann Dirson <ydirson@altern.org> wrote:\n>\n> > This patch uses -M when generating diffs, which then looks fine,\n> > just like any other git-generated diff.\n>\n> I think we should only use -M for \"files\", \"status\", \"show\", \"diff\"\n> but not for \"export\" and \"mail\", maybe by adding an extra parameter\n> to git.diff() (or we could have this configurable or with an cmd\n> line option). The reason is that I send patches that might not be\n> applied with GIT.\n\nSeems like a good idea to me: default to -M whenever the consumer is\nguaranteed to understand it, and have it as an option defaulting to\noff when we export data.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"42251","messageId":"20070515213717.GP19253@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"7978","inReplyTo":"20070515184759.GC17851@diana.vm.bytemark.co.uk","subject":"Re: [StGIT RFC PATCH] Activate rename detection by default.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-05-15T21:37:17Z","receivedAt":"2007-05-15T21:37:17Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Tue, May 15, 2007 at 08:47:59PM +0200, Karl Hasselström wrote:\n> On 2007-05-15 16:41:47 +0100, Catalin Marinas wrote:\n> \n> > On 05/05/07, Yann Dirson <ydirson@altern.org> wrote:\n> >\n> > > This patch uses -M when generating diffs, which then looks fine,\n> > > just like any other git-generated diff.\n> >\n> > I think we should only use -M for \"files\", \"status\", \"show\", \"diff\"\n> > but not for \"export\" and \"mail\", maybe by adding an extra parameter\n> > to git.diff() (or we could have this configurable or with an cmd\n> > line option). The reason is that I send patches that might not be\n> > applied with GIT.\n> \n> Seems like a good idea to me: default to -M whenever the consumer is\n> guaranteed to understand it, and have it as an option defaulting to\n> off when we export data.\n\nThis option should probably be available through a config setting as\nwell: we want to use it everytime we send a git or StGIT patch to the\nlist :)\n\nOTOH, using different conventions for different commands is guaranted\nto confuse more than one user.  Eg, I customarily use \"stg show >\n../file.diff\", assuming it will be readable by patch(1) - I even\nissued today more than one \"stg diff -r //bottom.old | (cd ../other &&\npatch -p1)\" - luckily, no rename there ;)\n\nIt makes sense to have it my default on for \"files\" and \"status\", but\nit breaks the output format, and thus probably some user scripts.\n\nMaybe we should add this behaviour as off by default, tunable from\nconfig, and overridable from command-line (roughly what I suggested in\nhttps://gna.org/task/?4773, with everything off by default).  Now the\nquestion would be what command-line syntax to use to be usable.\n\n-M/--renames <> --no-renames ?  -M would become useles when the\ndefault, and --no-renames is cumbersome.  Also, adds 2 flags per\noption, we have 3 of them (-M -C --find-copies-harder), and we may\nwant to allow other useful ones like -w and -b.\n\n--diff-flags='-M -C' ?  Can't find a non-brain-damaging way of\nnegating that: --no-diff-flags='-C' to negate part of a\nstgit.diff.defaultflags='-M -C' is likely to be confusing.\n\nBetter ideas anyone ?\n-- \nYann.\n"}]}