From: Karl Hasselström Date: Tue, 8 Jul 2008 18:24:43 +0000 (+0200) Subject: Merge branch 'stable' X-Git-Tag: v0.15-rc1~203 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/7a6a45b5f1379466bd23b33a7feed47d0b8331b7?hp=a05954efcf4fce744252ce2e1a650b78fa5788d6 Merge branch 'stable' Conflicts: stgit/commands/status.py --- diff --git a/stgit/commands/status.py b/stgit/commands/status.py index a5b2f88..a84ff6c 100644 --- a/stgit/commands/status.py +++ b/stgit/commands/status.py @@ -61,18 +61,15 @@ options = [make_option('-m', '--modified', 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: @@ -115,5 +112,4 @@ def func(parser, options, args): 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) diff --git a/stgit/git.py b/stgit/git.py index 0955be7..ee31ecd 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -191,6 +191,9 @@ def ls_files(files, tree = 'HEAD', full_name = True): 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: @@ -204,7 +207,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). @@ -249,7 +252,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()): @@ -265,7 +268,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 4364709..5e1e8ca 100755 --- a/t/t0002-status.sh +++ b/t/t0002-status.sh @@ -175,4 +175,15 @@ test_expect_success 'Status of disappeared newborn' ' test_cmp expected.txt output.txt ' +cat > expected.txt < output.txt && + test_cmp expected.txt output.txt +' + test_done