This way commit hash of 7 to 40 characters are automatically transformed to link to the specified commit.
I had my cat check this regular expression out and he purred. (I don't have a cat.)
I loose hair everytime I need to touch this file
unit-tests for the win there!
Does this get() have the API where you can provide a default argument if the key is not found? If so, you could drop line 26 and all these if statements and just write something like:
get()
user = flask.request.args.get('user', None)
If not, I just spent time typing nonsense.
You're right this can be simplified
I know this PR isn't really the space to discuss this, but it might be nice to make it so Pagure always does user/repo (similar to another popular git forge ☺) to make code like this less necessary. Of course, that would be a major backwards incompatible change.
Maybe drop this line.
What will happen here if the user types something that looks like a commit hash but doesn't actually match a real commit hash?
It was meant for easier debugging in case of problem but it can be dropped sure
I recommend adding one more that looks like a valid commit hash to the regex, but isn't a real commit in the git tree. I'd expect it to not turn into a link and still be rendered as plain text.
All comments are at your option, LGTM!
Currently it will add a link that will return a 404
We could do like issues and check if the hash exists or not before linking
So who/what was purring?
3 new commits added
You might be able to simplify the above block as well, and drop line 66.
Just one more comment, LGTM!
1 new commit added
Done :)
rebased
Pull-Request has been merged by pingou
Thanks again for the review :)
This way commit hash of 7 to 40 characters are automatically transformed
to link to the specified commit.