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

cli: Add a jj git init command. #2932

Merged
merged 1 commit into from
Feb 5, 2024
Merged

cli: Add a jj git init command. #2932

merged 1 commit into from
Feb 5, 2024

Conversation

essiene
Copy link
Collaborator

@essiene essiene commented Feb 3, 2024

Implement jj git init

There are two flags which work as mostly expected.

See GitInitArgs for details.

Some improvements around colocated repos vs --git-repo=. will come after this PR is merged.

The actual delta in this PR is tiny. The only thing new here is hooking up the jj git init command itself and inside git_init handling --colocated differently.

The rest of the PR is test and documentation.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have added tests to cover my changes

@essiene essiene linked an issue Feb 3, 2024 that may be closed by this pull request
@essiene essiene force-pushed the essiene/2747/git_init branch from 4daeed2 to c86b522 Compare February 3, 2024 23:08
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.

  • I believe that --colocated doesn't need to go through the same
    steps as --git-repo, after the repo is created. Is this correct?

Yes, but you'll need to set up .jj/.gitignore.

  • I've kept the current behaviour of jj init --git by specifying
    colocated false when invoked that way. I don't think it's worth
    the effort to add it in. Makes sense?

I don't think we'll need to add new feature to jj init --git.

cli/src/commands/git.rs Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/git_init branch 4 times, most recently from 25feffd to 800ac05 Compare February 4, 2024 13:34
@essiene
Copy link
Collaborator Author

essiene commented Feb 4, 2024

  • I believe that --colocated doesn't need to go through the same
    steps as --git-repo, after the repo is created. Is this correct?

Yes, but you'll need to set up .jj/.gitignore.
Ahh... Thanks. Done.

  • I've kept the current behaviour of jj init --git by specifying
    colocated false when invoked that way. I don't think it's worth
    the effort to add it in. Makes sense?

I don't think we'll need to add new feature to jj init --git.
Thanks for confirming.

@essiene essiene changed the title Add a jj git init command. cli: Add a jj git init command. Feb 4, 2024
@essiene essiene marked this pull request as ready for review February 4, 2024 13:41
cli/src/commands/git.rs Outdated Show resolved Hide resolved
cli/src/commands/git.rs Outdated Show resolved Hide resolved
cli/src/commands/init.rs Outdated Show resolved Hide resolved
cli/src/commands/init.rs Outdated Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/git_init branch 2 times, most recently from a7fce2a to 85322a8 Compare February 4, 2024 20:10
@essiene essiene enabled auto-merge (rebase) February 4, 2024 20:18
@essiene essiene disabled auto-merge February 4, 2024 20:18
Copy link
Collaborator

@PhilipMetzger PhilipMetzger left a comment

Choose a reason for hiding this comment

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

LGTM. But I'll defer to martin or yuya for a final approval.

cli/src/commands/init.rs Outdated Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/git_init branch from 85322a8 to d5ad207 Compare February 5, 2024 00:00
@essiene
Copy link
Collaborator Author

essiene commented Feb 5, 2024

LGTM. But I'll defer to martin or yuya for a final approval.

Thanks. I'll wait for a stamp from one of them.

cli/tests/test_git_init.rs Outdated Show resolved Hide resolved
@essiene essiene force-pushed the essiene/2747/git_init branch from d5ad207 to dc8ac02 Compare February 5, 2024 00:24
This initializes a git backed repo.

* It does the same thing as `jj init --git` except that it
  has a --colocated flag to explicitly specify that we want
  the .git repo to be side-by-side the .jj repo in the working
  directory.
* `jj init --git` will keep the current behaviour and will not
  be able to create colocated git backed repos.
* Update test snapshots.
@essiene essiene merged commit 2607512 into main Feb 5, 2024
15 checks passed
@essiene essiene deleted the essiene/2747/git_init branch February 5, 2024 00:40
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
4 participants