git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org, Jon Smirl <jonsmirl@gmail.com>
Subject: [StGit PATCH 2/2] Don't allow extra diff options with "stg status"
Date: Tue, 08 Jul 2008 21:54:31 +0200	[thread overview]
Message-ID: <20080708195431.24866.46141.stgit@yoghurt> (raw)
In-Reply-To: <20080708195214.24866.61663.stgit@yoghurt>

The only extra diff options (given either with -O/--diff-opts) that
would affect "stg status" were -C and -M, and those made it crash
because it couldn't handle them. So remove those options.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/commands/status.py |   16 +++-------------
 stgit/git.py             |    9 ++++++---
 t/t0002-status.sh        |    5 -----
 3 files changed, 9 insertions(+), 21 deletions(-)


diff --git a/stgit/commands/status.py b/stgit/commands/status.py
index 20614b0..94d0b57 100644
--- a/stgit/commands/status.py
+++ b/stgit/commands/status.py
@@ -59,22 +59,18 @@ options = [make_option('-m', '--modified',
            make_option('-x', '--noexclude',
                        help = 'do not exclude any files from listing',
                        action = 'store_true'),
-           make_option('-O', '--diff-opts',
-                       help = 'options to pass to git-diff'),
            make_option('--reset',
                        help = 'reset the current tree changes',
                        action = 'store_true')]
 
 
 def status(files = None, modified = False, new = False, deleted = False,
-           conflict = False, unknown = False, noexclude = False,
-           diff_flags = []):
+           conflict = False, unknown = False, noexclude = False):
     """Show the tree status
     """
     cache_files = git.tree_status(files,
                                   unknown = (not files),
-                                  noexclude = noexclude,
-                                  diff_flags = diff_flags)
+                                  noexclude = noexclude)
     filtered = (modified or new or deleted or conflict or unknown)
 
     if filtered:
@@ -116,11 +112,5 @@ def func(parser, options, args):
             resolved_all()
             git.reset()
     else:
-        if options.diff_opts:
-            diff_flags = options.diff_opts.split()
-        else:
-            diff_flags = []
-
         status(args, options.modified, options.new, options.deleted,
-               options.conflict, options.unknown, options.noexclude,
-               diff_flags = diff_flags)
+               options.conflict, options.unknown, options.noexclude)
diff --git a/stgit/git.py b/stgit/git.py
index 8e6bdf4..35579d4 100644
--- a/stgit/git.py
+++ b/stgit/git.py
@@ -192,6 +192,9 @@ def ls_files(files, tree = 'HEAD', full_name = True):
             'Some of the given paths are either missing or not known to GIT'
 
 def parse_git_ls(output):
+    """Parse the output of git diff-index, diff-files, etc. Doesn't handle
+    rename/copy output, so don't feed it output generated with the -M
+    or -C flags."""
     t = None
     for line in output.split('\0'):
         if not line:
@@ -205,7 +208,7 @@ def parse_git_ls(output):
             t = None
 
 def tree_status(files = None, tree_id = 'HEAD', unknown = False,
-                  noexclude = True, verbose = False, diff_flags = []):
+                  noexclude = True, verbose = False):
     """Get the status of all changed files, or of a selected set of
     files. Returns a list of pairs - (status, filename).
 
@@ -252,7 +255,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,
     # specified when calling the function (i.e. report all files) or
     # files were specified but already found in the previous step
     if not files or files_left:
-        args = diff_flags + [tree_id]
+        args = [tree_id]
         if files_left:
             args += ['--'] + files_left
         for t, fn in parse_git_ls(GRun('diff-index', '-z', *args).raw_output()):
@@ -268,7 +271,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,
     # function (i.e. report all files) or files were specified but
     # already found in the previous step
     if not files or files_left:
-        args = list(diff_flags)
+        args = []
         if files_left:
             args += ['--'] + files_left
         for t, fn in parse_git_ls(GRun('diff-files', '-z', *args).raw_output()):
diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index 69c29a0..a030739 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -182,9 +182,4 @@ test_expect_success 'Status after renaming a file' '
     diff -u expected.txt output.txt
 '
 
-test_expect_failure 'Status after renaming a file (with rename detection)' '
-    stg status --diff-opts=-M > output.txt &&
-    diff -u expected.txt output.txt
-'
-
 test_done

  parent reply	other threads:[~2008-07-08 19:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 15:10 stgit error on status command Jon Smirl
2008-07-08  7:02 ` Karl Hasselström
2008-07-08 12:06   ` Jon Smirl
2008-07-08 12:25     ` Karl Hasselström
2008-07-08 19:54       ` [StGit PATCH 0/2] stg status rename fix (stable) Karl Hasselström
2008-07-08 19:54         ` [StGit PATCH 1/2] Test "stg status" with renames Karl Hasselström
2008-07-08 19:54         ` Karl Hasselström [this message]
2008-07-09  4:05         ` [StGit PATCH 0/2] stg status rename fix (stable) Karl Hasselström
2008-07-08 19:57       ` [StGit PATCH] stg status rename fix (safe+experimental) Karl Hasselström
2008-07-08 19:57         ` [StGit PATCH] Test "stg status" with -M in stgit.diff-opts Karl Hasselström

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=20080708195431.24866.46141.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).