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

zoekt-mirror-gerrit: allow to use reponame without host in the index #771

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

xavier-calland
Copy link
Contributor

The repo is indexed only with the reponame which is more user-friendly in the search when there is onely one host
Filter string will be "r:my-repo" instead of "r:my-gerrit-sever.com/my-repo"

@cla-bot cla-bot bot added the cla-signed label Apr 26, 2024
Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

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

This is quite specific behaviour. Additionally I'm surprised at the amount of code for a private implementation detail for flag parsing. So I recommend one of the possible paths forward:

  • take in a template and use go's text/template to generate the name.
  • simplify how you parse the flag. Rather than a flag.Var, just use flag.String and handle unexpected outputs after calling flag.Parse

func main() {
dest := flag.String("dest", "", "destination directory")
namePattern := flag.String("name", "", "only clone repos whose name matches the regexp.")
// Default value for
repoFormat := WithServerHost
flag.Var(&RepoFormatEnumValue{&repoFormat}, "repo-name-format", "the format of the local repo name in zoekt (WithServerHost or WithoutServerHost)")
Copy link
Member

Choose a reason for hiding this comment

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

minor: the CamelCase values read a bit weird for a command line argument. Maybe better values for this would be qualified and project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The repo is indexed only with the reponame which is more user-friendly
in the search when there is onely one host
Filter string will be "r:my-repo" instead of "r:my-gerrit-sever.com/my-repo"
@keegancsmith keegancsmith merged commit 5411e9b into sourcegraph:main Apr 29, 2024
8 checks passed
@xavier-calland xavier-calland deleted the gerrit-repo-name branch April 30, 2024 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants