diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/utils/git.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/git.py b/meta/lib/oeqa/utils/git.py index 0fc8112321..ca84680118 100644 --- a/meta/lib/oeqa/utils/git.py +++ b/meta/lib/oeqa/utils/git.py | |||
@@ -4,6 +4,8 @@ | |||
4 | # Released under the MIT license (see COPYING.MIT) | 4 | # Released under the MIT license (see COPYING.MIT) |
5 | # | 5 | # |
6 | """Git repository interactions""" | 6 | """Git repository interactions""" |
7 | import os | ||
8 | |||
7 | from oeqa.utils.commands import runCmd | 9 | from oeqa.utils.commands import runCmd |
8 | 10 | ||
9 | 11 | ||
@@ -13,9 +15,12 @@ class GitError(Exception): | |||
13 | 15 | ||
14 | class GitRepo(object): | 16 | class GitRepo(object): |
15 | """Class representing a Git repository clone""" | 17 | """Class representing a Git repository clone""" |
16 | def __init__(self, cwd): | 18 | def __init__(self, path, is_topdir=False): |
17 | self.top_dir = self._run_git_cmd_at(['rev-parse', '--show-toplevel'], | 19 | self.top_dir = self._run_git_cmd_at(['rev-parse', '--show-toplevel'], |
18 | cwd) | 20 | path) |
21 | realpath = os.path.realpath(path) | ||
22 | if is_topdir and realpath != self.top_dir: | ||
23 | raise GitError("{} is not a Git top directory".format(realpath)) | ||
19 | 24 | ||
20 | @staticmethod | 25 | @staticmethod |
21 | def _run_git_cmd_at(git_args, cwd, **kwargs): | 26 | def _run_git_cmd_at(git_args, cwd, **kwargs): |