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: Move external git repo canonicalization into Workspace::init_g… #2830

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

essiene
Copy link
Collaborator

@essiene essiene commented Jan 15, 2024

Move the user input canonicalization closer to where it is actually used, so the code reads better as a whole.

Split out from #2807

@essiene essiene requested a review from yuja January 15, 2024 21:56
@essiene essiene mentioned this pull request Jan 15, 2024
1 task
…it_external

* Move canonicalization of the external git repo path into the Workspace::init_git_external().
  This keeps necessary code together.
* Add a new variant of WorkspaceInitError for reporting path not found errors. The user error
  string is written to pass existing tests.
@essiene essiene changed the base branch from essiene/2747/1 to main January 16, 2024 10:38
@essiene essiene changed the title no-op: Move external git repo canonicalization into Workspace::init_g… cli: Move external git repo canonicalization into Workspace::init_g… Jan 16, 2024
@essiene essiene enabled auto-merge (rebase) January 16, 2024 10:44
@essiene essiene merged commit dc07436 into main Jan 16, 2024
15 checks passed
@essiene essiene deleted the essiene/2747/2 branch January 16, 2024 10:46
git_repo_path.pop();
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not strongly against this change, but I think ".git" should be appended by CLI code. git_repo_path here should point to the git repository, not the workspace.

Copy link
Member

Choose a reason for hiding this comment

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

I think you're right. I saw the canonicalization below and figured it was consistent to normalize the git_repo_path here too, but I missed the TODO saying that we planned to move the canonicalization below out of this function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Circling back to clean things up.

I think I've managed to get myself confused by the terms. Help check my understanding:

Workspace path - This is the directory the user works in. It contains the 'jj' repo and may also contain a 'git' repo.

Repo path - This holds the "special" folder for git/jj, so for jj, this is the path to the .jj directory, but for git, it's the path to the .git directory.

Is that correct?

What should git_repo_path point to then?

I guess, technically, we want it to point to the '.git' directory, but for the user, it's a bit annoying UI wise, so we can accept the parent directory and normalize it ourselves.

Am I understanding this correctly?

Thanks! :-D

Copy link
Collaborator

Choose a reason for hiding this comment

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

Workspace path - This is the directory the user works in. It contains the 'jj' repo and may also contain a 'git' repo.

Repo path - This holds the "special" folder for git/jj, so for jj, this is the path to the .jj directory, but for git, it's the path to the .git directory.

Basically yes, that's my understanding. For jj, the repo path is probably .jj/repo. For "bare" git repo, the path might not end with ".git".

What should git_repo_path point to then?

I guess, technically, we want it to point to the '.git' directory, but for the user, it's a bit annoying UI wise, so we can accept the parent directory and normalize it ourselves.

Yes. That's why I insist that it's CLI/UI business to append ".git".

FWIW, we call -R/--repostiroy a repository path in CLI, but it's actually a workspace path.

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.

3 participants