{"thread":{"id":"14352","subject":"[StGit PATCH 2/2] Don't allow extra diff options with \"stg status\"","startedAt":"2008-07-08T19:54:19Z","lastAt":"2008-07-09T04:05:01Z","messageCount":4,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"82631","messageId":"20080708195214.24866.61663.stgit@yoghurt","threadId":"14352","inReplyTo":"20080708122502.GA8838@diana.vm.bytemark.co.uk","subject":"[StGit PATCH 0/2] stg status rename fix (stable)","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-08T19:54:19Z","receivedAt":"2008-07-08T19:54:19Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This fixes the bug on the stable branch. (stgit.diff-opts doesn't\nexist there, so it's less of an issue, but still.)\n\nAlso available at\n\n  git://repo.or.cz/stgit/kha.git safe\n\n---\n\nKarl Hasselström (2):\n      Don't allow extra diff options with \"stg status\"\n      Test \"stg status\" with renames\n\n\n stgit/commands/status.py |   16 +++-------------\n stgit/git.py             |    9 ++++++---\n t/t0002-status.sh        |   11 +++++++++++\n 3 files changed, 20 insertions(+), 16 deletions(-)\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"82630","messageId":"20080708195425.24866.58362.stgit@yoghurt","threadId":"14352","inReplyTo":"20080708195214.24866.61663.stgit@yoghurt","subject":"[StGit PATCH 1/2] Test \"stg status\" with renames","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-08T19:54:25Z","receivedAt":"2008-07-08T19:54:25Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"Currently, it only works if -M is not passed to git diff-files, so the\nsecond of the two tests fails.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n t/t0002-status.sh |   16 ++++++++++++++++\n 1 files changed, 16 insertions(+), 0 deletions(-)\n\n\ndiff --git a/t/t0002-status.sh b/t/t0002-status.sh\nindex 43e1ca0..69c29a0 100755\n--- a/t/t0002-status.sh\n+++ b/t/t0002-status.sh\n@@ -171,4 +171,20 @@ test_expect_success 'Status of disappeared newborn' '\n     diff -u expected.txt output.txt\n '\n \n+cat > expected.txt <<EOF\n+A fay\n+D fie\n+EOF\n+test_expect_success 'Status after renaming a file' '\n+    git rm foo/bar &&\n+    git mv fie fay &&\n+    stg status > output.txt &&\n+    diff -u expected.txt output.txt\n+'\n+\n+test_expect_failure 'Status after renaming a file (with rename detection)' '\n+    stg status --diff-opts=-M > output.txt &&\n+    diff -u expected.txt output.txt\n+'\n+\n test_done\n"},{"id":"82629","messageId":"20080708195431.24866.46141.stgit@yoghurt","threadId":"14352","inReplyTo":"20080708195214.24866.61663.stgit@yoghurt","subject":"[StGit PATCH 2/2] Don't allow extra diff options with \"stg status\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-08T19:54:31Z","receivedAt":"2008-07-08T19:54:31Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"The only extra diff options (given either with -O/--diff-opts) that\nwould affect \"stg status\" were -C and -M, and those made it crash\nbecause it couldn't handle them. So remove those options.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/commands/status.py |   16 +++-------------\n stgit/git.py             |    9 ++++++---\n t/t0002-status.sh        |    5 -----\n 3 files changed, 9 insertions(+), 21 deletions(-)\n\n\ndiff --git a/stgit/commands/status.py b/stgit/commands/status.py\nindex 20614b0..94d0b57 100644\n--- a/stgit/commands/status.py\n+++ b/stgit/commands/status.py\n@@ -59,22 +59,18 @@ options = [make_option('-m', '--modified',\n            make_option('-x', '--noexclude',\n                        help = 'do not exclude any files from listing',\n                        action = 'store_true'),\n-           make_option('-O', '--diff-opts',\n-                       help = 'options to pass to git-diff'),\n            make_option('--reset',\n                        help = 'reset the current tree changes',\n                        action = 'store_true')]\n \n \n def status(files = None, modified = False, new = False, deleted = False,\n-           conflict = False, unknown = False, noexclude = False,\n-           diff_flags = []):\n+           conflict = False, unknown = False, noexclude = False):\n     \"\"\"Show the tree status\n     \"\"\"\n     cache_files = git.tree_status(files,\n                                   unknown = (not files),\n-                                  noexclude = noexclude,\n-                                  diff_flags = diff_flags)\n+                                  noexclude = noexclude)\n     filtered = (modified or new or deleted or conflict or unknown)\n \n     if filtered:\n@@ -116,11 +112,5 @@ def func(parser, options, args):\n             resolved_all()\n             git.reset()\n     else:\n-        if options.diff_opts:\n-            diff_flags = options.diff_opts.split()\n-        else:\n-            diff_flags = []\n-\n         status(args, options.modified, options.new, options.deleted,\n-               options.conflict, options.unknown, options.noexclude,\n-               diff_flags = diff_flags)\n+               options.conflict, options.unknown, options.noexclude)\ndiff --git a/stgit/git.py b/stgit/git.py\nindex 8e6bdf4..35579d4 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -192,6 +192,9 @@ def ls_files(files, tree = 'HEAD', full_name = True):\n             'Some of the given paths are either missing or not known to GIT'\n \n def parse_git_ls(output):\n+    \"\"\"Parse the output of git diff-index, diff-files, etc. Doesn't handle\n+    rename/copy output, so don't feed it output generated with the -M\n+    or -C flags.\"\"\"\n     t = None\n     for line in output.split('\\0'):\n         if not line:\n@@ -205,7 +208,7 @@ def parse_git_ls(output):\n             t = None\n \n def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n-                  noexclude = True, verbose = False, diff_flags = []):\n+                  noexclude = True, verbose = False):\n     \"\"\"Get the status of all changed files, or of a selected set of\n     files. Returns a list of pairs - (status, filename).\n \n@@ -252,7 +255,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n     # specified when calling the function (i.e. report all files) or\n     # files were specified but already found in the previous step\n     if not files or files_left:\n-        args = diff_flags + [tree_id]\n+        args = [tree_id]\n         if files_left:\n             args += ['--'] + files_left\n         for t, fn in parse_git_ls(GRun('diff-index', '-z', *args).raw_output()):\n@@ -268,7 +271,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n     # function (i.e. report all files) or files were specified but\n     # already found in the previous step\n     if not files or files_left:\n-        args = list(diff_flags)\n+        args = []\n         if files_left:\n             args += ['--'] + files_left\n         for t, fn in parse_git_ls(GRun('diff-files', '-z', *args).raw_output()):\ndiff --git a/t/t0002-status.sh b/t/t0002-status.sh\nindex 69c29a0..a030739 100755\n--- a/t/t0002-status.sh\n+++ b/t/t0002-status.sh\n@@ -182,9 +182,4 @@ test_expect_success 'Status after renaming a file' '\n     diff -u expected.txt output.txt\n '\n \n-test_expect_failure 'Status after renaming a file (with rename detection)' '\n-    stg status --diff-opts=-M > output.txt &&\n-    diff -u expected.txt output.txt\n-'\n-\n test_done\n"},{"id":"82677","messageId":"20080709040501.GA20823@diana.vm.bytemark.co.uk","threadId":"14352","inReplyTo":"20080708195214.24866.61663.stgit@yoghurt","subject":"Re: [StGit PATCH 0/2] stg status rename fix (stable)","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-07-09T04:05:01Z","receivedAt":"2008-07-09T04:05:01Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-07-08 21:54:19 +0200, Karl Hasselström wrote:\n\n> This fixes the bug on the stable branch. (stgit.diff-opts doesn't\n> exist there, so it's less of an issue, but still.)\n>\n> Also available at\n>\n>   git://repo.or.cz/stgit/kha.git safe\n\ns/safe/stable/ here, of course.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}