From 8b456a57a0fa60701fa990077a4e513a928cd934 Mon Sep 17 00:00:00 2001 From: Kim Diallo Date: Sat, 3 Jan 2026 02:46:43 +0100 Subject: [PATCH] src/dlw/git_ops.py aktualisiert --- src/dlw/git_ops.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/dlw/git_ops.py b/src/dlw/git_ops.py index f970381..263e1aa 100644 --- a/src/dlw/git_ops.py +++ b/src/dlw/git_ops.py @@ -1,26 +1,12 @@ from git import Repo, exc import os -REPO_PATH = os.getcwd() - -def initialize_repo(): - try: - return Repo(REPO_PATH) - except exc.InvalidGitRepositoryError: - return None - def commit_and_push_article(article_path, download_paths, title): - repo = initialize_repo() - if not repo: - return False, "Kein Git-Repository gefunden." - try: - files_to_add = [article_path] + download_paths - repo.index.add(files_to_add) - repo.index.commit(f"FEAT: Neuer Artikel - {title}") - - origin = repo.remotes.origin - origin.push() - return True, "Erfolgreich gepusht!" + repo = Repo(os.getcwd()) + repo.index.add([article_path] + download_paths) + repo.index.commit(f"FEAT: {title}") + repo.remotes.origin.push() + return True, "Gepusht zu Forgejo!" except Exception as e: - return False, f"Fehler: {str(e)}" \ No newline at end of file + return False, str(e) \ No newline at end of file