diff --git a/CHANGELOG.md b/CHANGELOG.md index 7550d04..ec38adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - **Template URLs:** `gitgo init --template` now supports full GitHub URLs (e.g., `https://github.com/owner/repo` or `.git` extensions) in addition to the short `owner/repo` format. ### Fixed +- Fixed `gitgo new` skipping the initial commit and push due to a double `git init` bug. It now properly deploys the scaffolded files. - Fixed `gitgo new` opening the browser on every call. It now saves the token to git config (`gitgo.github-token`) after the first paste. - Fixed `gitgo new` crashing when an old token expires. It now clears the dead token and re-prompts automatically. diff --git a/pyproject.toml b/pyproject.toml index 5b8cee4..a2c93f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygitgo" -version = "1.8.1" +version = "1.8.0" description = "GitGo CLI - Your Fast Git Companion. Simplifies git push, link, stash, and user management." readme = "README.md" license = {text = "GPL-3.0-or-later"} diff --git a/src/pygitgo/commands/link.py b/src/pygitgo/commands/link.py index 63b2390..f9c3c3a 100644 --- a/src/pygitgo/commands/link.py +++ b/src/pygitgo/commands/link.py @@ -30,7 +30,7 @@ def _link_interrupt_cleanup(repo_url, initialized, committed, remote_added): success("No git state was changed.") -def link_core(repo_url, commit_message="Initial commit", silent=False): +def link_core(repo_url, commit_message="Initial commit", silent=False, already_initialized=False): if not validate_repo_url(repo_url): raise GitGoError( "\nInvalid repository URL!\n" @@ -43,9 +43,13 @@ def link_core(repo_url, commit_message="Initial commit", silent=False): remote_added = False try: - is_new_repo = git_init() - if is_new_repo: + if already_initialized: + is_new_repo = True initialized = True + else: + is_new_repo = git_init() + if is_new_repo: + initialized = True if not is_new_repo: add_remote_origin(repo_url) diff --git a/src/pygitgo/commands/new.py b/src/pygitgo/commands/new.py index 9e64992..fb705ef 100644 --- a/src/pygitgo/commands/new.py +++ b/src/pygitgo/commands/new.py @@ -12,7 +12,7 @@ def new_operation(args): repo_url = repo_operation(args, silent=True) - link_core(repo_url, "Initial commit", silent=True) + link_core(repo_url, "Initial commit", silent=True, already_initialized=True) print_banner("PROJECT LAUNCHED. SCAFFOLDED, CREATED, AND DEPLOYED.") diff --git a/tests/test_new.py b/tests/test_new.py index d12f702..2010451 100644 --- a/tests/test_new.py +++ b/tests/test_new.py @@ -21,7 +21,7 @@ def test_new_operation_quickstart(mock_chdir, mock_link_core, mock_repo_operatio mock_init_operation.assert_called_once_with(args) mock_chdir.assert_called_once_with("my-project") mock_repo_operation.assert_called_once_with(args, silent=True) - mock_link_core.assert_called_once_with("https://github.com/user/my-project.git", "Initial commit", silent=True) + mock_link_core.assert_called_once_with("https://github.com/user/my-project.git", "Initial commit", silent=True, already_initialized=True) captured = capsys.readouterr() assert "undo link" in captured.out \ No newline at end of file