{"thread":{"id":"9703","subject":"[StGit PATCH 2/2] Cleanup tree_status and use -z","startedAt":"2007-08-30T11:11:09Z","lastAt":"2007-08-30T12:45:29Z","messageCount":7,"participants":["David Kågedal","Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"51894","messageId":"11884722703161-git-send-email-davidk@lysator.liu.se","threadId":"9703","inReplyTo":null,"subject":"[StGit PATCH 1/1] Add basic test for stg status","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-08-30T11:11:09Z","receivedAt":"2007-08-30T11:11:09Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"\nSigned-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n---\n\nThis is very basic, but there was no test at all that ran stg status,\nso nothing excercised the code changed in the following patch.\n\n t/t0002-status.sh |   15 +++++++++++++++\n 1 files changed, 15 insertions(+), 0 deletions(-)\n create mode 100755 t/t0002-status.sh\n\ndiff --git a/t/t0002-status.sh b/t/t0002-status.sh\nnew file mode 100755\nindex 0000000..c088d56\n--- /dev/null\n+++ b/t/t0002-status.sh\n@@ -0,0 +1,15 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 David Kågedal\n+#\n+\n+test_description='Basic stg status\n+\n+Test that \"stg status\" works.'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'Run status on empty' \\\n+  'stg status'\n+\n+test_done\n-- \n1.5.3.rc6.31.g3c3b\n"},{"id":"51893","messageId":"11884722703840-git-send-email-davidk@lysator.liu.se","threadId":"9703","inReplyTo":"11884722703161-git-send-email-davidk@lysator.liu.se","subject":"[StGit PATCH 2/2] Cleanup tree_status and use -z","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-08-30T11:11:10Z","receivedAt":"2007-08-30T11:11:10Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"From: David KÃ¥gedal <david@virtutech.com>\n\nImproved the python code, eliminating temporary variables and using\ndestructuring binds. And use NUL-separation instead of newlines.\n\nSigned-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n---\nThere are still no good test cases for this code, though.\n\n stgit/commands/patches.py |    2 +-\n stgit/commands/refresh.py |    2 +-\n stgit/git.py              |   22 +++++++++++-----------\n 3 files changed, 13 insertions(+), 13 deletions(-)\n\ndiff --git a/stgit/commands/patches.py b/stgit/commands/patches.py\nindex b3defb6..fb65b62 100644\n--- a/stgit/commands/patches.py\n+++ b/stgit/commands/patches.py\n@@ -51,7 +51,7 @@ def func(parser, options, args):\n     \"\"\"Show the patches modifying a file\n     \"\"\"\n     if not args:\n-        files = [stat[1] for stat in git.tree_status(verbose = True)]\n+        files = [path for (stat,path) in git.tree_status(verbose = True)]\n     else:\n         files = args\n \ndiff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py\nindex 218075b..f44c58c 100644\n--- a/stgit/commands/refresh.py\n+++ b/stgit/commands/refresh.py\n@@ -121,7 +121,7 @@ def func(parser, options, args):\n     else:\n         sign_str = None\n \n-    files = [x[1] for x in git.tree_status(verbose = True)]\n+    files = [path for (stat,path) in git.tree_status(verbose = True)]\n     if args:\n         files = [f for f in files if f in args]\n \ndiff --git a/stgit/git.py b/stgit/git.py\nindex 7962cdb..f315b05 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -168,7 +168,7 @@ def exclude_files():\n \n def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n                   noexclude = True, verbose = False, diff_flags = []):\n-    \"\"\"Returns a list of pairs - [status, filename]\n+    \"\"\"Returns a list of pairs - (status, filename)\n     \"\"\"\n     if verbose:\n         out.start('Checking for changes in the working directory')\n@@ -181,16 +181,16 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n \n     # unknown files\n     if unknown:\n-        if noexclude:\n-            exclude = []\n-        else:\n-            exclude = (['--exclude=%s' % s for s in\n-                        ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']]\n-                       + ['--exclude-per-directory=.gitignore']\n-                       + ['--exclude-from=%s' % fn for fn in exclude_files()\n-                          if os.path.exists(fn)])\n-        lines = GRun('git-ls-files', '--others', '--directory', *exclude\n-                     ).output_lines()\n+        cmd = ['git-ls-files', '-z', '--others', '--directory']\n+        if not noexclude:\n+            cmd += ['--exclude=%s' % s for s in\n+                    ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']]\n+            cmd += ['--exclude-per-directory=.gitignore']\n+            cmd += ['--exclude-from=%s' % fn\n+                    for fn in exclude_files()\n+                    if os.path.exists(fn)]\n+\n+        lines = GRun(*cmd).raw_output().split('\\0')\n         cache_files += [('?', line) for line in lines]\n \n     # conflicted files\n-- \n1.5.3.rc6.31.g3c3b\n"},{"id":"51895","messageId":"87lkbtgtpy.fsf@morpheus.local","threadId":"9703","inReplyTo":"11884722703161-git-send-email-davidk@lysator.liu.se","subject":"Re: [StGit PATCH 1/1] Add basic test for stg status","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-08-30T11:14:17Z","receivedAt":"2007-08-30T11:14:17Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"David Kågedal <davidk@lysator.liu.se> writes:\n\n> Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n\nThis was probably confused by the fact that the patch itself contained\nmy name in latin1 encoding.\n\n-- \nDavid Kågedal\n"},{"id":"51896","messageId":"87ir6xgssk.fsf@morpheus.local","threadId":"9703","inReplyTo":"87lkbtgtpy.fsf@morpheus.local","subject":"Re: [StGit PATCH 1/1] Add basic test for stg status","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-08-30T11:34:19Z","receivedAt":"2007-08-30T11:34:19Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"David Kågedal <davidk@lysator.liu.se> writes:\n\n> David Kågedal <davidk@lysator.liu.se> writes:\n>\n>> Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n>\n> This was probably confused by the fact that the patch itself contained\n> my name in latin1 encoding.\n\nOr not.  It's the same problem as before.  I'll stop using\ngit-send-email until I or someone else fixes it.\n\n-- \nDavid Kågedal\n"},{"id":"51901","messageId":"20070830120755.GA14181@diana.vm.bytemark.co.uk","threadId":"9703","inReplyTo":"87ir6xgssk.fsf@morpheus.local","subject":"Re: [StGit PATCH 1/1] Add basic test for stg status","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-08-30T12:07:55Z","receivedAt":"2007-08-30T12:07:55Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-08-30 13:34:19 +0200, David Kågedal wrote:\n\n> David Kågedal <davidk@lysator.liu.se> writes:\n>\n> > David Kågedal <davidk@lysator.liu.se> writes:\n> >\n> > > Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n> >\n> > This was probably confused by the fact that the patch itself\n> > contained my name in latin1 encoding.\n>\n> Or not. It's the same problem as before. I'll stop using\n> git-send-email until I or someone else fixes it.\n\nTry \"stg mail\", since you are already using StGIT. It used to have\nthis kind of problem, but it doesn't anymore (at least for me).\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"51902","messageId":"20070830121158.GB14181@diana.vm.bytemark.co.uk","threadId":"9703","inReplyTo":"11884722703840-git-send-email-davidk@lysator.liu.se","subject":"Re: [StGit PATCH 2/2] Cleanup tree_status and use -z","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-08-30T12:11:58Z","receivedAt":"2007-08-30T12:11:58Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-08-30 13:11:10 +0200, David Kågedal wrote:\n\n> Improved the python code, eliminating temporary variables and using\n> destructuring binds. And use NUL-separation instead of newlines.\n\nGood changes, both of them. It all looks OK to me (but I haven't tried\nto run it yet).\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"51909","messageId":"87abs9gphy.fsf@morpheus.local","threadId":"9703","inReplyTo":"20070830120755.GA14181@diana.vm.bytemark.co.uk","subject":"Re: [StGit PATCH 1/1] Add basic test for stg status","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-08-30T12:45:29Z","receivedAt":"2007-08-30T12:45:29Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> On 2007-08-30 13:34:19 +0200, David Kågedal wrote:\n>\n>> David Kågedal <davidk@lysator.liu.se> writes:\n>>\n>> > David Kågedal <davidk@lysator.liu.se> writes:\n>> >\n>> > > Signed-off-by: David KÃ¥gedal <davidk@lysator.liu.se>\n>> >\n>> > This was probably confused by the fact that the patch itself\n>> > contained my name in latin1 encoding.\n>>\n>> Or not. It's the same problem as before. I'll stop using\n>> git-send-email until I or someone else fixes it.\n>\n> Try \"stg mail\", since you are already using StGIT. It used to have\n> this kind of problem, but it doesn't anymore (at least for me).\n\nYes, much better. Thank you.\n\n-- \nDavid Kågedal\n"}]}