From 98e6edb546116cd98abdc3b37c6744e859bbde5c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 16 Nov 2010 19:01:27 +0100 Subject: Initial implementation of submodule.add without any tests. These are to come next --- lib/git/index/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/git/index/base.py') diff --git a/lib/git/index/base.py b/lib/git/index/base.py index 05501ba1..a982d5c5 100644 --- a/lib/git/index/base.py +++ b/lib/git/index/base.py @@ -35,7 +35,8 @@ from git.exc import ( ) from git.objects import ( - Blob, + Blob, + Submodule, Tree, Object, Commit, @@ -553,7 +554,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): for item in items: if isinstance(item, basestring): paths.append(self._to_relative_path(item)) - elif isinstance(item, Blob): + elif isinstance(item, (Blob, Submodule)): entries.append(BaseIndexEntry.from_blob(item)) elif isinstance(item, BaseIndexEntry): entries.append(item) @@ -588,7 +589,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): They are added at stage 0 - - Blob object + - Blob or Submodule object Blobs are added as they are assuming a valid mode is set. The file they refer to may or may not exist in the file system, but must be a path relative to our repository. @@ -612,6 +613,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): explicitly set. Please note that Index Entries require binary sha's. :param force: + **CURRENTLY INEFFECTIVE** If True, otherwise ignored or excluded files will be added anyway. As opposed to the git-add command, we enable this flag by default -- cgit v1.2.1 From b03933057df80ea9f860cc616eb7733f140f866e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 17 Nov 2010 14:52:01 +0100 Subject: index: Sped up reading and writing of the index file by reducing the amount of attribute lookups considerably --- lib/git/index/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/git/index/base.py') diff --git a/lib/git/index/base.py b/lib/git/index/base.py index a982d5c5..05caa06d 100644 --- a/lib/git/index/base.py +++ b/lib/git/index/base.py @@ -750,7 +750,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): may be absolute or relative paths, entries or blobs""" paths = list() for item in items: - if isinstance(item, (BaseIndexEntry,Blob)): + if isinstance(item, (BaseIndexEntry,(Blob, Submodule))): paths.append(self._to_relative_path(item.path)) elif isinstance(item, basestring): paths.append(self._to_relative_path(item)) @@ -777,7 +777,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): The path string may include globs, such as *.c. - - Blob object + - Blob Object Only the path portion is used in this case. - BaseIndexEntry or compatible type -- cgit v1.2.1