Skip to content

Commit 52f05f7

Browse files
Update push subcommand so push error is only printed for non-handled push fails
Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
1 parent d921ba0 commit 52f05f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git_sim/push.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ def construct(self):
7272
self.repo.git.push(self.remote, self.branch)
7373
# If push fails...
7474
except git.GitCommandError as e:
75-
print(f"git-sim error: git push failed: {e.stderr}")
7675
if "rejected" in e.stderr and "fetch first" in e.stderr:
7776
push_result = 1
7877
self.orig_repo = self.repo
7978
self.repo = self.remote_repo
79+
else:
80+
print(f"git-sim error: git push failed: {e.stderr}")
8081

8182
head_commit = self.get_commit()
8283
self.parse_commits(head_commit, make_branches_remote=(self.remote if self.remote else self.repo.remotes[0].name))

0 commit comments

Comments
 (0)