Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added support for separeted git dir.#99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 1 commit intogitpython-developers:0.3fromniyaton:separate-git-dir
Nov 19, 2014
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@
from fun import (
rev_parse,
is_git_dir,
read_gitfile,
touch
)

Expand DownExpand Up@@ -113,6 +114,11 @@ def __init__(self, path=None, odbt = DefaultDBType):
self.git_dir = gitpath
self._working_tree_dir = curpath
break
gitpath = read_gitfile(gitpath)
if gitpath:
self.git_dir = gitpath
self._working_tree_dir = curpath
break
curpath, dummy = os.path.split(curpath)
if not dummy:
break
Expand Down
11 changes: 11 additions & 0 deletionsgit/repo/fun.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,6 +30,17 @@ def is_git_dir(d):
os.readlink(headref).startswith('refs'))
return False

def read_gitfile(f):
""" This is taken from the git setup.c:read_gitfile function.
:return gitdir path or None if gitfile is invalid."""

if not isfile(f):
return None
line = open(f, 'r').readline().rstrip()
if line[0:8] != 'gitdir: ':
return None
path = os.path.realpath(line[8:])
return path if is_git_dir(path) else None

def short_to_long(odb, hexsha):
""":return: long hexadecimal sha1 from the given less-than-40 byte hexsha
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp