Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slash in git execute fix #1575

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Slash in git execute fix #1575

merged 2 commits into from
Sep 19, 2024

Conversation

sfc-gh-astus
Copy link
Collaborator

@sfc-gh-astus sfc-gh-astus commented Sep 16, 2024

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.

Changes description

Fixed git execute for branches with / in name.
Fixed execute command for files with space in name.

@sfc-gh-astus sfc-gh-astus force-pushed the slash-in-git-execute-fix branch 3 times, most recently from f281ad4 to 068c600 Compare September 17, 2024 13:29
@sfc-gh-astus sfc-gh-astus marked this pull request as ready for review September 17, 2024 13:42
@sfc-gh-astus sfc-gh-astus requested review from a team as code owners September 17, 2024 13:42
@sfc-gh-astus
Copy link
Collaborator Author

Add to release notes

@@ -27,16 +27,21 @@
from snowflake.cli.api.identifiers import FQN
from snowflake.connector.cursor import SnowflakeCursor

OMIT_FIRST = slice(1, None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comment explaining what is the reasoning behind those slices?

Copy link
Collaborator Author

@sfc-gh-astus sfc-gh-astus Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason was to replace magic numbers [3:], [1:].

# Check if path contains quotes and split it accordingly
if '/"' in path and '"/' in path:
if path.count('"') > 2:
raise ValueError('Too much " in path, expected 2.')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this more meaningful. Something like "invalid string blah blah..". Also please raise BadUsage error to handle this with better UX

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

Comment on lines 130 to 135
if path_parts[2] and path_parts[2] != "/":
after_quoted_part = GitManager._split_path_without_empty_parts(
path_parts[2]
)
else:
after_quoted_part = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if path_parts[2] and path_parts[2] != "/":
after_quoted_part = GitManager._split_path_without_empty_parts(
path_parts[2]
)
else:
after_quoted_part = []
if path_parts[2] == "/":
after_quoted_part = []
else:
after_quoted_part = GitManager._split_path_without_empty_parts(
path_parts[2]
)

WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better 👍

@sfc-gh-astus sfc-gh-astus merged commit 5b9307e into main Sep 19, 2024
21 checks passed
@sfc-gh-astus sfc-gh-astus deleted the slash-in-git-execute-fix branch September 19, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants