action = 'store_true'),
make_option('--reset',
help = 'reset the current tree changes',
- action = 'store_true')
- ] + make_diff_opts_option()
+ action = 'store_true')]
-def status(files, modified, new, deleted, conflict, unknown, noexclude,
- diff_flags):
+def status(files, modified, new, deleted, conflict, unknown, noexclude):
"""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:
git.reset()
else:
status(args, options.modified, options.new, options.deleted,
- options.conflict, options.unknown, options.noexclude,
- options.diff_flags)
+ options.conflict, options.unknown, options.noexclude)
return list(fileset)
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
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).
# 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()):
# 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()):
test_cmp expected.txt output.txt
'
+cat > expected.txt <<EOF
+A fay
+D fie
+EOF
+test_expect_success 'Status after renaming a file' '
+ git rm foo/bar &&
+ git mv fie fay &&
+ stg status > output.txt &&
+ test_cmp expected.txt output.txt
+'
+
test_done