Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
10 changes: 7 additions & 3 deletions src/pygitgo/commands/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/pygitgo/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading