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

Commit5991698

Browse files
committed
Support repos that use the .git-file mechanism.
1 parent0b820e6 commit5991698

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎git/repo/base.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class Repo(object):
7171
re_hexsha_shortened=re.compile('^[0-9A-Fa-f]{4,40}$')
7272
re_author_committer_start=re.compile(r'^(author|committer)')
7373
re_tab_full_line=re.compile(r'^\t(.*)$')
74+
re_git_file_gitdir=re.compile('gitdir: (.*)')
7475

7576
# invariants
7677
# represents the configuration level of a configuration file
@@ -113,6 +114,17 @@ def __init__(self, path=None, odbt = DefaultDBType):
113114
self.git_dir=gitpath
114115
self._working_tree_dir=curpath
115116
break
117+
ifisfile(gitpath):
118+
line=open(gitpath,'r').readline().strip()
119+
match=self.re_git_file_gitdir.match(line)
120+
ifmatch:
121+
gitpath=match.group(1)
122+
ifnotos.path.isabs(gitpath):
123+
gitpath=os.path.normpath(join(curpath,gitpath))
124+
ifis_git_dir(gitpath):
125+
self.git_dir=gitpath
126+
self._working_tree_dir=curpath
127+
break
116128
curpath,dummy=os.path.split(curpath)
117129
ifnotdummy:
118130
break

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp