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

Refactor out git_init() #2807

Merged
merged 1 commit into from
Feb 3, 2024
Merged

Refactor out git_init() #2807

merged 1 commit into from
Feb 3, 2024

Conversation

essiene
Copy link
Collaborator

@essiene essiene commented Jan 11, 2024

  • Create a git_init() function in cli/src/commands/init.rs where all git related work is done. This function will be moved to cli/src/commands/git.rs in a subsequent PR.

Checklist

If applicable:

  • I have added tests to cover my changes

Existing tests pass after the refactor.

@essiene essiene linked an issue Jan 11, 2024 that may be closed by this pull request
@essiene essiene requested a review from martinvonz January 11, 2024 13:12
@essiene essiene force-pushed the essiene/2747/refactor branch 4 times, most recently from bc2eb71 to 2848341 Compare January 11, 2024 13:27
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

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

  • Add Workspace::create_workspace_root() which is needed by all init functionality regardless of the backend.
  • Move canonicalization of the external git repo path into the Workspace::init_git_external(). This keeps necessary code together.
  • Create a git_init() function in cli/src/commands/init.rs where all git related work is done. This function will be moved to cli/src/commands/git.rs in a subsequent PR.
  • Add a new variant of WorkspaceInitError for reporting path not found errors. The user error string is written to pass existing tests.

If you have some of these as separate commits, can you send them without squashing? It's a bit hard to review code move including changes.

cli/src/commands/init.rs Outdated Show resolved Hide resolved
cli/src/commands/init.rs Outdated Show resolved Hide resolved
lib/src/workspace.rs Outdated Show resolved Hide resolved
lib/src/workspace.rs Outdated Show resolved Hide resolved
@essiene
Copy link
Collaborator Author

essiene commented Jan 15, 2024

  • Add Workspace::create_workspace_root() which is needed by all init functionality regardless of the backend.
  • Move canonicalization of the external git repo path into the Workspace::init_git_external(). This keeps necessary code together.
  • Create a git_init() function in cli/src/commands/init.rs where all git related work is done. This function will be moved to cli/src/commands/git.rs in a subsequent PR.
  • Add a new variant of WorkspaceInitError for reporting path not found errors. The user error string is written to pass existing tests.

If you have some of these as separate commits, can you send them without squashing? It's a bit hard to review code move including changes.

I've split these up now. Thanks for prompting.

I've stacked the changes up nicely, which means that this PR now has a different base CL than main.

@essiene essiene changed the title Refactor init command in preparation to move git related portions. Refactor out git_init() Jan 15, 2024
Base automatically changed from essiene/2747/2 to main January 16, 2024 10:46
@essiene essiene force-pushed the essiene/2747/refactor branch from ac52647 to 1325bd0 Compare January 16, 2024 11:01
@essiene essiene changed the base branch from main to essiene/2747/1 January 16, 2024 12:01
cli/src/commands/init.rs Outdated Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/1 branch 2 times, most recently from 47ae233 to b284701 Compare February 2, 2024 23:35
@essiene essiene force-pushed the essiene/2747/refactor branch 2 times, most recently from 4a52f92 to 8b9db06 Compare February 2, 2024 23:54
@essiene essiene requested a review from yuja February 3, 2024 00:01
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

cli/src/commands/init.rs Outdated Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/refactor branch from 8b9db06 to 0995d64 Compare February 3, 2024 14:14
Base automatically changed from essiene/2747/1 to main February 3, 2024 14:15
@essiene essiene force-pushed the essiene/2747/refactor branch 2 times, most recently from 5041ec2 to a85fcde Compare February 3, 2024 14:19
* Create a git_init() function in cli/src/commands/init.rs where all git related work is done.
  This function will be moved to cli/src/commands/git.rs in a subsequent PR.
@essiene essiene enabled auto-merge (rebase) February 3, 2024 14:23
@essiene essiene merged commit 31e4061 into main Feb 3, 2024
15 checks passed
@essiene essiene deleted the essiene/2747/refactor branch February 3, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design: the jj init experience needs a rethink
2 participants