summaryrefslogtreecommitdiff
path: root/objects
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-24 17:12:36 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-24 17:12:36 +0100
commit264ba6f54f928da31a037966198a0849325b3732 (patch)
tree3cc84ae352307fd5fded67f6a0c1e4fd376ed843 /objects
parentec0657cf5de9aeb5629cc4f4f38b36f48490493e (diff)
downloadgitpython-264ba6f54f928da31a037966198a0849325b3732.tar.gz
Fixed remaining issues, all tests work as expected
Diffstat (limited to 'objects')
-rw-r--r--objects/__init__.py1
-rw-r--r--objects/base.py4
-rw-r--r--objects/submodule/base.py10
3 files changed, 7 insertions, 8 deletions
diff --git a/objects/__init__.py b/objects/__init__.py
index 65659cd1..77f69d29 100644
--- a/objects/__init__.py
+++ b/objects/__init__.py
@@ -7,6 +7,7 @@ from base import *
# imported by the submodule.base
import submodule.util
submodule.util.IndexObject = IndexObject
+submodule.util.Object = Object
from submodule.base import *
from submodule.root import *
diff --git a/objects/base.py b/objects/base.py
index b8cec47f..5f2f7809 100644
--- a/objects/base.py
+++ b/objects/base.py
@@ -57,6 +57,10 @@ class Object(LazyMixin):
:return: new object instance of a type appropriate to represent the given
binary sha1
:param sha1: 20 byte binary sha1"""
+ if sha1 == cls.NULL_BIN_SHA:
+ # the NULL binsha is always the root commit
+ return get_object_type_by_name('commit')(repo, sha1)
+ #END handle special case
oinfo = repo.odb.info(sha1)
inst = get_object_type_by_name(oinfo.type)(repo, oinfo.binsha)
inst.size = oinfo.size
diff --git a/objects/submodule/base.py b/objects/submodule/base.py
index 4f4223b6..5d32d600 100644
--- a/objects/submodule/base.py
+++ b/objects/submodule/base.py
@@ -14,6 +14,7 @@ from git.util import (
join_path_native,
to_native_path_linux
)
+
from git.config import SectionConstraint
from git.exc import (
InvalidGitRepositoryError,
@@ -339,14 +340,7 @@ class Submodule(util.IndexObject, Iterable, Traversable):
# have a valid branch, but no checkout - make sure we can figure
# that out by marking the commit with a null_sha
- # have to write it directly as .commit = NULLSHA tries to resolve the sha
- # This will bring the branch into existance
- refpath = join_path_native(mrepo.git_dir, local_branch.path)
- refdir = os.path.dirname(refpath)
- if not os.path.isdir(refdir):
- os.makedirs(refdir)
- #END handle directory
- open(refpath, 'w').write(self.NULL_HEX_SHA)
+ local_branch.set_object(util.Object(mrepo, self.NULL_BIN_SHA))
# END initial checkout + branch creation
# make sure HEAD is not detached