From: Catalin Marinas Date: Wed, 19 Dec 2007 18:00:15 +0000 (+0000) Subject: Remove multiple stages returned by git.ls_files X-Git-Tag: v0.15-rc1~319 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/05c688ad853c405089aa40b5fd99fd3028a47436 Remove multiple stages returned by git.ls_files This patch uses a set to return unique file names from git.ls_files in case there are multiple stages in the index. Signed-off-by: Catalin Marinas --- diff --git a/stgit/git.py b/stgit/git.py index 01076c9..8862bb8 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -182,11 +182,13 @@ def ls_files(files, tree = None, full_name = True): args.append('--') args.extend(files) try: - return GRun('ls-files', '--error-unmatch', *args).output_lines() + # use a set to avoid file names duplication due to different stages + fileset = set(GRun('ls-files', '--error-unmatch', *args).output_lines()) except GitRunException: # just hide the details of the 'git ls-files' command we use raise GitException, \ 'Some of the given paths are either missing or not known to GIT' + return list(fileset) def tree_status(files = None, tree_id = 'HEAD', unknown = False, noexclude = True, verbose = False, diff_flags = []):