+ # everything is up-to-date
+ if len(cache_files) == 0:
+ return False
+
+ # check for unresolved conflicts
+ if not force and [x for x in cache_files
+ if x[0] not in ['M', 'N', 'A', 'D']]:
+ raise GitException, 'Updating cache failed: unresolved conflicts'
+
+ # update the cache
+ add_files = [x[1] for x in cache_files if x[0] in ['N', 'A']]
+ rm_files = [x[1] for x in cache_files if x[0] in ['D']]
+ m_files = [x[1] for x in cache_files if x[0] in ['M']]
+
+ if add_files and __run('git-update-cache --add --', add_files) != 0:
+ raise GitException, 'Failed git-update-cache --add'
+ if rm_files and __run('git-update-cache --force-remove --', rm_files) != 0:
+ raise GitException, 'Failed git-update-cache --rm'
+ if m_files and __run('git-update-cache --', m_files) != 0:
+ raise GitException, 'Failed git-update-cache'