Compare commits
3 Commits
073550825c
...
574bc9aa10
Author | SHA1 | Date | |
---|---|---|---|
|
574bc9aa10 | ||
|
0414b33206 | ||
|
b9670821a9 |
10
lib/git.py
10
lib/git.py
@ -46,7 +46,8 @@ class Git:
|
||||
)
|
||||
|
||||
def open(self):
|
||||
self.git_run(["init", "--object-format=sha256", "-b", "factory"])
|
||||
if not self.exists():
|
||||
self.git_run(["init", "--object-format=sha256", "-b", "factory"])
|
||||
|
||||
def is_dirty(self):
|
||||
"""Check if there is something to commit"""
|
||||
@ -89,7 +90,7 @@ class Git:
|
||||
else:
|
||||
ref = f"refs/heads/{branch}"
|
||||
if (self.path / ".git" / ref).exists():
|
||||
self.git_run(["switch", "-q", branch])
|
||||
self.git_run(["switch", "--no-guess", "-q", branch])
|
||||
return new_branch
|
||||
|
||||
def commit(
|
||||
@ -266,7 +267,10 @@ class Git:
|
||||
)
|
||||
|
||||
def push(self, force=False):
|
||||
if "origin" not in self.git_run(["remote"]).stdout:
|
||||
if "origin" not in self.git_run(
|
||||
["remote"],
|
||||
stdout=subprocess.PIPE,
|
||||
).stdout.decode("utf-8"):
|
||||
logger.warning("Not pushing to remote because no 'origin' configured")
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user