+def ls_files(files, tree = None, full_name = True):
+ """Return the files known to GIT or raise an error otherwise. It also
+ converts the file to the full path relative the the .git directory.
+ """
+ if not files:
+ return []
+
+ args = []
+ if tree:
+ args.append('--with-tree=%s' % tree)
+ if full_name:
+ args.append('--full-name')
+ args.append('--')
+ args.extend(files)
+ try:
+ return 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'
+