-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(ingest): support git clone of non-github repos #7065
fix(ingest): support git clone of non-github repos #7065
Conversation
if repo.startswith(_GITHUB_PREFIX): | ||
return f"[email protected]:{repo[len(_GITHUB_PREFIX):]}.git" | ||
elif repo.startswith(_GITLAB_PREFIX): | ||
return f"[email protected]:{repo[len(_GITLAB_PREFIX):]}.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - this is really awesome!! I was hoping we'd be able to generalize this
config.get_url_for_file_path( | ||
"cmd/admin.go" | ||
) == "https://gitea.com/gitea/tea/src/branch/main/cmd/admin.go" | ||
config.repo_ssh_locator == "https://gitea.com/gitea/tea.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome tests!
) | ||
branch: str = Field( | ||
"main", | ||
description="Branch on which your files live by default. Typically main or master. This can also be a commit hash.", | ||
) | ||
base_url: str = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we safe to remove this? Do we want to have any mapping?
def simplify_repo_url(cls, repo: str) -> str: | ||
if repo.startswith("github.com/"): | ||
repo = f"https://{repo}" | ||
elif repo.startswith("gitlab.com"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want any trailing slash like github case
elif repo.startswith("gitlab.com"): | ||
repo = f"https://{repo}" | ||
elif repo.count("/") == 1: | ||
repo = f"https://github.com/{repo}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaults to github?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great. Only concern is compatibility. What do you think?
Checklist