pygitgo 1.8.2__tar.gz → 1.8.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. {pygitgo-1.8.2/src/pygitgo.egg-info → pygitgo-1.8.3}/PKG-INFO +1 -1
  2. {pygitgo-1.8.2 → pygitgo-1.8.3}/pyproject.toml +1 -1
  3. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/auth/ssh_utils.py +3 -5
  4. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/link.py +19 -1
  5. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/executor.py +8 -1
  6. {pygitgo-1.8.2 → pygitgo-1.8.3/src/pygitgo.egg-info}/PKG-INFO +1 -1
  7. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_executor.py +1 -1
  8. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_link.py +20 -5
  9. {pygitgo-1.8.2 → pygitgo-1.8.3}/LICENSE +0 -0
  10. {pygitgo-1.8.2 → pygitgo-1.8.3}/README.md +0 -0
  11. {pygitgo-1.8.2 → pygitgo-1.8.3}/setup.cfg +0 -0
  12. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/__init__.py +0 -0
  13. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/auth/__init__.py +0 -0
  14. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/auth/account.py +0 -0
  15. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/auth/manager.py +0 -0
  16. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/__init__.py +0 -0
  17. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/config.py +0 -0
  18. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/git_branch.py +0 -0
  19. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/git_core.py +0 -0
  20. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/git_remote.py +0 -0
  21. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/init.py +0 -0
  22. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/jump.py +0 -0
  23. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/new.py +0 -0
  24. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/pull.py +0 -0
  25. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/push.py +0 -0
  26. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/repo.py +0 -0
  27. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/staging.py +0 -0
  28. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/stash.py +0 -0
  29. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/state.py +0 -0
  30. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/undo.py +0 -0
  31. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/commands/user.py +0 -0
  32. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/exceptions.py +0 -0
  33. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/main.py +0 -0
  34. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/__init__.py +0 -0
  35. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/bootstrap.py +0 -0
  36. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/cli_io.py +0 -0
  37. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/colors.py +0 -0
  38. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/config.py +0 -0
  39. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/platform.py +0 -0
  40. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/update_checker.py +0 -0
  41. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo/utils/validators.py +0 -0
  42. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo.egg-info/SOURCES.txt +0 -0
  43. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo.egg-info/dependency_links.txt +0 -0
  44. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo.egg-info/entry_points.txt +0 -0
  45. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo.egg-info/requires.txt +0 -0
  46. {pygitgo-1.8.2 → pygitgo-1.8.3}/src/pygitgo.egg-info/top_level.txt +0 -0
  47. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_account.py +0 -0
  48. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_bootstrap.py +0 -0
  49. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_cli_io.py +0 -0
  50. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_config_command.py +0 -0
  51. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_config_utils.py +0 -0
  52. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_git_branch.py +0 -0
  53. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_git_core.py +0 -0
  54. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_git_remote.py +0 -0
  55. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_init.py +0 -0
  56. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_integration_git.py +0 -0
  57. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_jump.py +0 -0
  58. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_main.py +0 -0
  59. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_manager.py +0 -0
  60. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_new.py +0 -0
  61. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_platform.py +0 -0
  62. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_pull.py +0 -0
  63. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_push.py +0 -0
  64. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_repo.py +0 -0
  65. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_ssh_utils.py +0 -0
  66. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_staging.py +0 -0
  67. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_stash.py +0 -0
  68. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_state.py +0 -0
  69. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_undo.py +0 -0
  70. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_update_checker.py +0 -0
  71. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_user.py +0 -0
  72. {pygitgo-1.8.2 → pygitgo-1.8.3}/tests/test_validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygitgo
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: GitGo CLI - Your Fast Git Companion. Simplifies git push, link, stash, and user management.
5
5
  Author: Huerte
6
6
  License: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pygitgo"
7
- version = "1.8.2"
7
+ version = "1.8.3"
8
8
  description = "GitGo CLI - Your Fast Git Companion. Simplifies git push, link, stash, and user management."
9
9
  readme = "README.md"
10
10
  license = {text = "GPL-3.0-or-later"}
@@ -73,7 +73,7 @@ def check_connection(ok_text=None, fail_text=None):
73
73
 
74
74
  ensure_github_known_host()
75
75
 
76
- kwargs = {"text": ok_text or "Verifying GitHub connection..."}
76
+ kwargs = {"text": "Verifying GitHub connection..."}
77
77
  if sys.stdout.isatty():
78
78
  kwargs["color"] = "cyan"
79
79
  spinner = yaspin(**kwargs)
@@ -83,12 +83,10 @@ def check_connection(ok_text=None, fail_text=None):
83
83
  connected = output is not None and "successfully authenticated" in output
84
84
 
85
85
  if connected:
86
- if ok_text:
87
- spinner.text = ok_text
86
+ spinner.text = ok_text or "GitHub connection verified."
88
87
  spinner.ok("✔")
89
88
  else:
90
- if fail_text:
91
- spinner.text = fail_text
89
+ spinner.text = fail_text or "Could not connect to GitHub."
92
90
  spinner.fail("✖")
93
91
 
94
92
  return connected
@@ -2,6 +2,7 @@ from pygitgo.commands.git_remote import add_remote_origin, confirm_remote_link
2
2
  from pygitgo.utils.cli_io import success, warning, error, info, banner
3
3
  from pygitgo.commands.git_core import git_init, git_commit, git_push
4
4
  from pygitgo.commands.git_branch import get_current_branch
5
+ from pygitgo.auth.ssh_utils import ensure_github_known_host, convert_https_to_ssh, is_ssh_url, check_connection
5
6
  from pygitgo.exceptions import GitCommandError, GitGoError
6
7
  from pygitgo.utils.validators import validate_repo_url
7
8
  from pygitgo.utils.config import get_default_branch
@@ -41,6 +42,14 @@ def _link_interrupt_cleanup(repo_url, initialized, committed, remote_added):
41
42
  def link_core(repo_url, commit_message, silent=False, already_initialized=False):
42
43
  if not validate_repo_url(repo_url):
43
44
  raise GitGoError(f"Invalid remote repository URL: '{repo_url}'")
45
+
46
+ ensure_github_known_host()
47
+
48
+ if not is_ssh_url(repo_url):
49
+ if check_connection(ok_text="GitHub connection verified.", fail_text=None):
50
+ ssh_url = convert_https_to_ssh(repo_url)
51
+ if ssh_url:
52
+ repo_url = ssh_url
44
53
 
45
54
  initialized = False
46
55
  committed = False
@@ -98,7 +107,16 @@ def link_core(repo_url, commit_message, silent=False, already_initialized=False)
98
107
  warning(f"Then: gitgo push {main_branch} 'your message'\n")
99
108
  raise GitGoError(f"Failed to merge remote content: {e.stderr}" if e.stderr else "Failed to merge remote content.")
100
109
 
101
- git_push(current_branch)
110
+ try:
111
+ run_command(["git", "rev-parse", "HEAD"])
112
+ has_commits = True
113
+ except GitCommandError:
114
+ has_commits = False
115
+
116
+ if has_commits:
117
+ git_push(current_branch)
118
+ else:
119
+ info("Repository is currently empty. Add files and run 'gitgo push' to upload.")
102
120
 
103
121
  if not silent:
104
122
  banner("REPOSITORY INITIALIZED AND DEPLOYED.", "LOCAL REPOSITORY CONNECTED TO REMOTE ORIGIN.")
@@ -18,11 +18,18 @@ def run_command(command, return_complete=False, loading_msg=None, ok_text=None,
18
18
  spinner.start()
19
19
 
20
20
  try:
21
+ env = os.environ.copy()
22
+ env["GIT_TERMINAL_PROMPT"] = "0"
23
+ base_ssh_cmd = env.get("GIT_SSH_COMMAND", "ssh")
24
+ env["GIT_SSH_COMMAND"] = f"{base_ssh_cmd} -o BatchMode=yes"
25
+
21
26
  result = subprocess.run(
22
27
  command,
23
28
  check=True,
24
29
  capture_output=True,
25
- text=True
30
+ text=True,
31
+ stdin=subprocess.DEVNULL,
32
+ env=env,
26
33
  )
27
34
 
28
35
  if spinner:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygitgo
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: GitGo CLI - Your Fast Git Companion. Simplifies git push, link, stash, and user management.
5
5
  Author: Huerte
6
6
  License: GPL-3.0-or-later
@@ -11,7 +11,7 @@ def test_run_command_success(mocker):
11
11
 
12
12
  res = run_command(["echo", "hello"])
13
13
  assert res == "hello world"
14
- mock_run.assert_called_once_with(["echo", "hello"], check=True, capture_output=True, text=True)
14
+ mock_run.assert_called_once_with(["echo", "hello"], check=True, capture_output=True, text=True, stdin=subprocess.DEVNULL, env=mocker.ANY)
15
15
 
16
16
  def test_run_command_success_complete(mocker):
17
17
  mock_run = mocker.patch("subprocess.run")
@@ -38,7 +38,14 @@ def test_link_new_repo_no_remote_refs(mocker):
38
38
  mocker.patch("pygitgo.commands.link.get_default_branch", return_value="main")
39
39
  fake_push = mocker.patch("pygitgo.commands.link.git_push")
40
40
 
41
- fake_run = mocker.patch("pygitgo.commands.link.run_command", return_value="")
41
+ fake_run = mocker.patch(
42
+ "pygitgo.commands.link.run_command",
43
+ side_effect=[
44
+ "", # git branch -m main (branch rename)
45
+ "", # git ls-remote (no remote refs)
46
+ "abc123", # git rev-parse HEAD (has local commits)
47
+ ]
48
+ )
42
49
 
43
50
  args = Namespace(url="git@github.com:user/repo.git", message="Initial commit")
44
51
  link_operation(args)
@@ -65,7 +72,8 @@ def test_link_new_repo_with_remote_refs_pull_success(mocker):
65
72
  "pygitgo.commands.link.run_command",
66
73
  side_effect=[
67
74
  "1234567890abcdef refs/heads/main", # remote_refs check
68
- "Successfully pulled" # git pull
75
+ "Successfully pulled", # git pull
76
+ "123456" # git rev-parse HEAD
69
77
  ]
70
78
  )
71
79
 
@@ -96,7 +104,8 @@ def test_link_new_repo_with_remote_refs_pull_failure(mocker):
96
104
  "pygitgo.commands.link.run_command",
97
105
  side_effect=[
98
106
  "1234567890abcdef refs/heads/main", # remote_refs check
99
- GitCommandError(["git", "pull"]) # git pull fails
107
+ GitCommandError(["git", "pull"]), # git pull fails
108
+ "123456" # git rev-parse HEAD (if reached)
100
109
  ]
101
110
  )
102
111
 
@@ -112,12 +121,14 @@ def test_link_core_already_initialized_commits_and_pushes(mocker):
112
121
  from pygitgo.commands.link import link_core
113
122
 
114
123
  mocker.patch("pygitgo.commands.link.validate_repo_url", return_value=True)
124
+ mocker.patch("pygitgo.commands.link.check_connection", return_value=True)
125
+ mocker.patch("pygitgo.commands.link.convert_https_to_ssh", return_value="git@github.com:user/repo.git")
115
126
  fake_init = mocker.patch("pygitgo.commands.link.git_init")
116
127
  fake_commit = mocker.patch("pygitgo.commands.link.git_commit", return_value=True)
117
128
  fake_add_remote = mocker.patch("pygitgo.commands.link.add_remote_origin")
118
129
  mocker.patch("pygitgo.commands.link.get_current_branch", return_value="main")
119
130
  mocker.patch("pygitgo.commands.link.get_default_branch", return_value="main")
120
- mocker.patch("pygitgo.commands.link.run_command", return_value="")
131
+ mocker.patch("pygitgo.commands.link.run_command", return_value="123456")
121
132
  fake_push = mocker.patch("pygitgo.commands.link.git_push")
122
133
 
123
134
  link_core(
@@ -133,7 +144,7 @@ def test_link_core_already_initialized_commits_and_pushes(mocker):
133
144
  loading_msg="Creating initial commit...",
134
145
  ok_text="Initial commit created.",
135
146
  )
136
- fake_add_remote.assert_called_once_with("https://github.com/user/repo.git")
147
+ fake_add_remote.assert_called_once_with("git@github.com:user/repo.git")
137
148
  fake_push.assert_called_once_with("main")
138
149
 
139
150
 
@@ -141,6 +152,8 @@ def test_link_keyboard_interrupt_during_commit(mocker):
141
152
  from pygitgo.commands.link import link_core
142
153
 
143
154
  mocker.patch("pygitgo.commands.link.validate_repo_url", return_value=True)
155
+ # Return False so no URL conversion happens; the cleanup URL stays as HTTPS.
156
+ mocker.patch("pygitgo.commands.link.check_connection", return_value=False)
144
157
  mocker.patch("pygitgo.commands.link.git_init", return_value=True)
145
158
  mocker.patch("pygitgo.commands.link.git_commit", side_effect=KeyboardInterrupt())
146
159
  mock_warning = mocker.patch("pygitgo.commands.link.warning")
@@ -163,6 +176,8 @@ def test_link_keyboard_interrupt_after_remote_added(mocker):
163
176
  from pygitgo.commands.link import link_core
164
177
 
165
178
  mocker.patch("pygitgo.commands.link.validate_repo_url", return_value=True)
179
+ # Return False so no URL conversion happens; the cleanup URL stays as HTTPS.
180
+ mocker.patch("pygitgo.commands.link.check_connection", return_value=False)
166
181
  mocker.patch("pygitgo.commands.link.git_init", return_value=True)
167
182
  mocker.patch("pygitgo.commands.link.git_commit", return_value=True)
168
183
  mocker.patch("pygitgo.commands.link.add_remote_origin")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes