Skip to content

Escape # in CompareCommits base and head refs#1649

Merged
gmlewis merged 3 commits intogoogle:masterfrom
urohit011:1642-replace#
Nov 27, 2020
Merged

Escape # in CompareCommits base and head refs#1649
gmlewis merged 3 commits intogoogle:masterfrom
urohit011:1642-replace#

Conversation

@urohit011
Copy link
Copy Markdown
Contributor

@urohit011 urohit011 commented Nov 15, 2020

This change will fix #1642 by replacig # with %23 in the base and head refs which are required for comparing commits.

Fixes #1642.

@google-cla google-cla Bot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Nov 15, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 15, 2020

Codecov Report

Merging #1649 (ee2258f) into master (1ff2714) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1649   +/-   ##
=======================================
  Coverage   70.01%   70.01%           
=======================================
  Files          97       97           
  Lines        6340     6340           
=======================================
  Hits         4439     4439           
  Misses        985      985           
  Partials      916      916           
Impacted Files Coverage Δ
github/repos_commits.go 68.18% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ff2714...ee2258f. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis 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 unit test that demonstrates this new behavior and also add a comment to the method that describes this behavior (between lines 225-226).
Thank you!

@gmlewis gmlewis changed the title Fixes #1642 Escape # in CompareCommits base and head refs Nov 16, 2020
@urohit011
Copy link
Copy Markdown
Contributor Author

Hi @gmlewis , I have added the changes you requested. Please let me know if it's okay now.
Thank you

@urohit011 urohit011 requested a review from gmlewis November 20, 2020 20:35
Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Why don't I see %23 anywhere in the updated unit test?
Shouldn't the #b# or #h# be escaped?

Comment thread github/repos_commits.go Outdated
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
b := url.QueryEscape(c.b)
h := url.QueryEscape(c.h)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi, acutally I store the escaped value for head and base in h and b and use the variables in the test instead of using literal values.

Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @urohit011 !
LGTM.

Awaiting second LGTM before merging.

@gmlewis gmlewis requested a review from wesleimp November 27, 2020 21:06
Copy link
Copy Markdown
Collaborator

@wesleimp wesleimp left a comment

Choose a reason for hiding this comment

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

LGTM 👌🏼

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Nov 27, 2020

Thank you, @wesleimp !
Merging.

@gmlewis gmlewis merged commit 2aebd0d into google:master Nov 27, 2020
@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Dec 1, 2020

This, unfortunately, causes problems that I should have caught. Reverting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indication that the PR author has signed a Google Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompareCommits() doesn't encode given base/head refs?

3 participants