From 8caeec1b15645fa53ec5ddc6e990e7030ffb7c5a Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 11 May 2010 00:06:14 +0200 Subject: IndexFile.add: Fixed incorrect path handling if path rewriting was desired and absolute paths were given Commit.create_from_tree: fixed critical bug that would cause it to create a branch named master by default, instead of the reference actually set ( which is master in many, but not all cases ) - in fact it could be detached as well, we would fail ungracefully although we could assume master then ... although we cant really make the decision Repo.is_dirty: improved its abiility to deal with empty repositories and a missing head. Weird thing is that the test always worked fine with the previous code, but it didn't work for me in a similar situation without this change at least --- lib/git/objects/commit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/git/objects/commit.py') diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py index 4a0e278d..826f684c 100644 --- a/lib/git/objects/commit.py +++ b/lib/git/objects/commit.py @@ -357,9 +357,9 @@ class Commit(base.Object, Iterable, diff.Diffable, utils.Traversable): try: repo.head.commit = new_commit except ValueError: - # head is not yet set to master - create it and set it + # head is not yet set to the ref our HEAD points to. import git.refs - master = git.refs.Head.create(repo, 'master', commit=new_commit) + master = git.refs.Head.create(repo, repo.head.ref, commit=new_commit) repo.head.reference = master # END handle empty repositories # END advance head handling -- cgit v1.2.1