Skip to content

Commit 96816a4

Browse files
committed
Move git to module gardenlinux
Signed-off-by: Tobias Wolf <[email protected]>
1 parent e6327b6 commit 96816a4

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
from .git import Git
24

35
__all__ = ["Git"]

src/gardenlinux/git/git.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from git import Git as _Git
4+
from pathlib import Path
5+
import sys
6+
7+
from ..logger import LoggerSetup
8+
9+
10+
class Git:
11+
"""Git operations handler."""
12+
13+
def __init__(self, logger=None):
14+
"""Initialize Git handler.
15+
16+
Args:
17+
logger: Optional logger instance
18+
"""
19+
20+
if logger is None or not logger.hasHandlers():
21+
logger = LoggerSetup.get_logger("gardenlinux.git")
22+
23+
self._logger = logger
24+
25+
def get_root(self):
26+
"""Get the root directory of the current Git repository."""
27+
root_dir = Git(".").rev_parse("--show-superproject-working-tree")
28+
self.log.debug(f"Git root directory: {root_dir}")
29+
30+
return Path(root_dir)

src/python_gardenlinux_lib/git/git.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)