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>
make_option('-x', '--noexclude',
help = 'do not exclude any files from listing',
action = 'store_true'),
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,
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),
"""Show the tree status
"""
cache_files = git.tree_status(files,
unknown = (not files),
- noexclude = noexclude,
- diff_flags = diff_flags)
filtered = (modified or new or deleted or conflict or unknown)
if filtered:
filtered = (modified or new or deleted or conflict or unknown)
if filtered:
resolved_all()
git.reset()
else:
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,
status(args, options.modified, options.new, options.deleted,
- options.conflict, options.unknown, options.noexclude,
- diff_flags = diff_flags)
+ options.conflict, options.unknown, options.noexclude)
'Some of the given paths are either missing or not known to GIT'
def parse_git_ls(output):
'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:
t = None
for line in output.split('\0'):
if not line:
t = None
def tree_status(files = None, tree_id = 'HEAD', unknown = False,
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).
"""Get the status of all changed files, or of a selected set of
files. Returns a list of pairs - (status, filename).
# 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:
# 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]
if files_left:
args += ['--'] + files_left
for t, fn in parse_git_ls(GRun('diff-index', '-z', *args).raw_output()):
if files_left:
args += ['--'] + files_left
for t, fn in parse_git_ls(GRun('diff-index', '-z', *args).raw_output()):
# function (i.e. report all files) or files were specified but
# already found in the previous step
if not files or files_left:
# 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)
if files_left:
args += ['--'] + files_left
for t, fn in parse_git_ls(GRun('diff-files', '-z', *args).raw_output()):
if files_left:
args += ['--'] + files_left
for t, fn in parse_git_ls(GRun('diff-files', '-z', *args).raw_output()):
diff -u expected.txt output.txt
'
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
-'
-