diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-10-20 10:11:16 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-10-20 10:11:16 +0200 |
commit | aa5e366889103172a9829730de1ba26d3dcbc01b (patch) | |
tree | 501733a2a12afae0bb0fe60eab33dca5b397c712 /lib/git/repo.py | |
parent | e64957d8e52d7542310535bad1e77a9bbd7b4857 (diff) | |
download | gitpython-aa5e366889103172a9829730de1ba26d3dcbc01b.tar.gz |
Moved specialized methods like dashify, touch and is_git_dir to module to the respective modules that use them
fixed repo.daemon_export which did not work anymore due to incorrect touch implementation and wrong property names
Diffstat (limited to 'lib/git/repo.py')
-rw-r--r-- | lib/git/repo.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/git/repo.py b/lib/git/repo.py index 8126bff4..966edf9d 100644 --- a/lib/git/repo.py +++ b/lib/git/repo.py @@ -11,7 +11,6 @@ import gzip import StringIO from errors import InvalidGitRepositoryError, NoSuchPathError -from utils import touch, is_git_dir from cmd import Git from actor import Actor from refs import * @@ -19,6 +18,23 @@ from objects import * from config import GitConfigParser from remote import Remote +def touch(filename): + fp = open(filename, "w") + fp.close() + +def is_git_dir(d): + """ This is taken from the git setup.c:is_git_directory + function.""" + + if os.path.isdir(d) and \ + os.path.isdir(os.path.join(d, 'objects')) and \ + os.path.isdir(os.path.join(d, 'refs')): + headref = os.path.join(d, 'HEAD') + return os.path.isfile(headref) or \ + (os.path.islink(headref) and + os.readlink(headref).startswith('refs')) + return False + class Repo(object): """ Represents a git repository and allows you to query references, |