diff options
Diffstat (limited to 'morphlib/gitindex.py')
-rw-r--r-- | morphlib/gitindex.py | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/morphlib/gitindex.py b/morphlib/gitindex.py index 00098fbf..c741718a 100644 --- a/morphlib/gitindex.py +++ b/morphlib/gitindex.py @@ -82,7 +82,8 @@ class GitIndex(object): # a space, then the path. # If our status code starts with R then it's a rename, hence # has a second path, requiring us to pop an extra token. - status = self._run_git('status', '-z', '--ignored') + status = self._run_git('status', '-z', '--ignored', + '--untracked-files') tokens = collections.deque(status.split('\0')) while True: tok = tokens.popleft() @@ -113,27 +114,6 @@ class GitIndex(object): '''Modify the index to contain the contents of the treeish.''' self._run_git('read-tree', treeish) - def add_files_from_index_info(self, infos): - '''Add files without interacting with the working tree. - - `infos` is an iterable of (file mode string, object sha1, path) - There are no constraints on the size of the iterable - - ''' - - # update-index may take NUL terminated input lines of the entries - # to add so we generate a string for the input, rather than - # having many command line arguments, since for a large amount - # of entries, this can be too many arguments to process and the - # exec will fail. - # Generating the input as a string uses more memory than using - # subprocess.Popen directly and using .communicate, but is much - # less verbose. - feed_stdin = '\0'.join('%o %s\t%s' % (mode, sha1, path) - for mode, sha1, path in infos) + '\0' - self._run_git('update-index', '--add', '-z', '--index-info', - feed_stdin=feed_stdin) - def add_files_from_working_tree(self, paths): '''Add existing files to the index. @@ -142,17 +122,6 @@ class GitIndex(object): add the contents of the files to git's object store, and the index. - This is similar to the following: - - gd = GitDirectory(...) - idx = gd.get_index() - for path in paths: - fullpath = os.path.join(gd,dirname, path) - with open(fullpath, 'r') as f: - sha1 = gd.store_blob(f) - idx.add_files_from_index_info([(os.stat(fullpath).st_mode, - sha1, path)]) - ''' if self._gd.is_bare(): |