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

Support blob link without line hash #320

Merged
merged 2 commits into from
Jun 5, 2020
Merged

Conversation

suusan2go
Copy link
Contributor

Thank you for creating this great tool!

Currently, gitpanda does not support a blob link without Line Hash.
But GitHub integration on Slack supports a link without Line Hash like this.
image

So I think it would be great if gitpanda can support blob link without line hash like GitHub!

@sue445 sue445 self-requested a review June 5, 2020 13:58
Copy link
Owner

@sue445 sue445 left a comment

Choose a reason for hiding this comment

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

Please add a test case for this patch.

See followings.

{
name: "Blob URL (single line)",
args: args{
url: "http://example.com/diaspora/diaspora-project-site/blob/master/gitlabci-templates/continuous_bundle_update.yml#L4",
},
want: &Page{
Title: "gitlabci-templates/continuous_bundle_update.yml:4",
Description: "```\n variables:\n```",
AuthorName: "",
AuthorAvatarURL: "",
AvatarURL: "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
CanTruncateDescription: false,
FooterTitle: "diaspora/diaspora-project-site",
FooterURL: "http://example.com/diaspora/diaspora-project-site",
FooterTime: nil,
Color: "",
},
},
{
name: "Blob URL (single line & including /-/)",
args: args{
url: "http://example.com/diaspora/diaspora-project-site/-/blob/master/gitlabci-templates/continuous_bundle_update.yml#L4",
},
want: &Page{
Title: "gitlabci-templates/continuous_bundle_update.yml:4",
Description: "```\n variables:\n```",
AuthorName: "",
AuthorAvatarURL: "",
AvatarURL: "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
CanTruncateDescription: false,
FooterTitle: "diaspora/diaspora-project-site",
FooterURL: "http://example.com/diaspora/diaspora-project-site",
FooterTime: nil,
Color: "",
},
},
{
name: "Blob URL (multiple line)",
args: args{
url: "http://example.com/diaspora/diaspora-project-site/blob/master/gitlabci-templates/continuous_bundle_update.yml#L4-9",
},
want: &Page{
Title: "gitlabci-templates/continuous_bundle_update.yml:4-9",
Description: "```\n variables:\n CACHE_VERSION: \"v1\"\n GIT_EMAIL: \"[email protected]\"\n GIT_USER: \"GitLab CI\"\n LABELS: \"bundle update\"\n OPTIONS: \"\"\n```",
AuthorName: "",
AuthorAvatarURL: "",
AvatarURL: "http://example.com/uploads/project/avatar/3/uploads/avatar.png",
CanTruncateDescription: false,
FooterTitle: "diaspora/diaspora-project-site",
FooterURL: "http://example.com/diaspora/diaspora-project-site",
FooterTime: nil,
Color: "",
},
},

@suusan2go
Copy link
Contributor Author

@sue445 sorry I didn't think test cases for blob fetcher covered in url_parser_test.go 😅 I add a test case for this patch, so can you review this again?

@sue445 sue445 self-requested a review June 5, 2020 14:52
Copy link
Owner

@sue445 sue445 left a comment

Choose a reason for hiding this comment

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

LGTM!

@sue445 sue445 merged commit b0450dc into sue445:master Jun 5, 2020
@sue445
Copy link
Owner

sue445 commented Jun 5, 2020

I released as v0.9.1

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.

2 participants