From: Peter Osterlund Date: Thu, 28 Jul 2005 11:55:46 +0000 (+0200) Subject: Handle 'A' flag for new files X-Git-Tag: v0.14.3~729 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/c4a1503ac1528832b286cf9c1a2a97409b07eb54?hp=0d2cd1e4238e397072360bad902c8a0cff4efcb0 Handle 'A' flag for new files Patches that add new files don't work correctly if git reports them with the 'A' flag. StGIT claims there are unresolved conflicts. This patch fixes it. Signed-off-by: Peter Osterlund --- diff --git a/stgit/git.py b/stgit/git.py index aa7bf1b..fe2c447 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -274,7 +274,7 @@ def commit(message, files = [], parents = [], allowempty = False, raise GitException, 'No changes to commit' # check for unresolved conflicts - if not first and len(filter(lambda x: x[0] not in ['M', 'N', 'D'], + if not first and len(filter(lambda x: x[0] not in ['M', 'N', 'A', 'D'], cache_files)) != 0: raise GitException, 'Commit failed: unresolved conflicts' @@ -292,7 +292,7 @@ def commit(message, files = [], parents = [], allowempty = False, rm_files=[] m_files=[] for f in cache_files: - if f[0] == 'N': + if f[0] in ['N', 'A']: add_files.append(f[1]) elif f[0] == 'D': rm_files.append(f[1]) @@ -437,7 +437,8 @@ def checkout(files = [], force = False): def switch(tree_id): """Switch the tree to the given id """ - to_delete = filter(lambda x: x[0] == 'N', __tree_status(tree_id = tree_id)) + to_delete = filter(lambda x: x[0] in ['N', 'A'], + __tree_status(tree_id = tree_id)) if __run('git-read-tree -m', [tree_id]) != 0: raise GitException, 'Failed git-read-tree -m %s' % tree_id