tomasbjerre / simple-bitbucket-commit-checker

Simple, and easy to use, commit checker for Atlassian Bitbucket Server
https://marketplace.atlassian.com/plugins/se.bjurr.sscc.sscc
Other
21 stars 19 forks source link

Matching author with special character always fails #91

Open 0ge opened 5 years ago

0ge commented 5 years ago

One in our team has Swedish letters in his name. When he tries to push he gets the following errors from SBCC:

remote: - Bitbucket: 'Hugo Sjöberg' != Commit: 'Hugo Sjöberg'
remote: 
remote: - Commit: 'Hugo Sjöberg'

We have the following (related) configuration:

Require Matching Author Name: yes Require Userslug Matching Author Name: no Require Author Name in Bitbucket: yes Require Author Name As Userslug in Bitbucket: no Require Matching Committer Name: yes Require Userslug Matching Committer Name: no

I compared his gitconfig with mine and couldn't find anything amiss.

[user]
    name = Hugo Sjöberg
    email = hugo@company.com
tomasbjerre commented 5 years ago

I made a test and is getting expected output.

I would suspect that ö is configured with some different encoding. Perhaps copy/pasted from somewhere.

Here is my test:

✔ ~/workspace/rep_1 [master {origin/master} ↓·1↑·1|✔] 
18:09 $ GIT_COMMITTER_NAME="cTomas Björre" GIT_COMMITTER_EMAIL="ctomas.bjerre85@gmail.com" git commit --amend --author="aTomas Björre <atomas.bjerre85@gmail.com>"
[master 2d3ffe2] asd
 Author: aTomas Björre <atomas.bjerre85@gmail.com>
 Date: Mon Nov 19 17:48:01 2018 +0100
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 hej
✔ ~/workspace/rep_1 [master {origin/master} ↓·1↑·1|✔] 
18:09 $ git push -f
Password for 'http://admin@localhost:7990': 
Räknar upp objekt: 4, klart.
Räknar objekt: 100% (4/4), klart.
Deltakomprimering använder upp till 4 trådar
Komprimerar objekt: 100% (2/2), klart.
Skriver objekt: 100% (3/3), 284 bytes | 284.00 KiB/s, klart.
Totalt 3 (delta 1), återanvände 0 (delta 0)
remote: At least one change is not ok
remote: refs/heads/master 2dd10ae821 -> 2d3ffe2ec1
remote: 
remote: 
remote: 2d3ffe2ec135aa9a5e53a6b685df85884a02b063 aTomas Björre <atomas.bjerre85@gmail.com>
remote: >>> asd
remote: 
remote: - Bitbucket: 'Tomas Björre' != Commit: 'aTomas Björre'
remote: 
remote: - Bitbucket: 'Tomas Björre' != Commit: 'cTomas Björre'
remote: 
remote: - Commit: 'aTomas Björre'
remote: 
remote: 
remote: Simple Bitbucket Commit Checker
remote: 
To http://localhost:7990/bitbucket/scm/project_1/rep_1.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: misslyckades sända vissa referenser till "http://admin@localhost:7990/bitbucket/scm/project_1/rep_1.git"
0ge commented 5 years ago

Not sure I understand your test - that would fail regardless? How can I check the encoding used?

tomasbjerre commented 5 years ago

I should probably have included more in that comment... Don't remember exactly how I tested it now...

I'm not sure how to check the encoding of a name like that. Perhaps just re-enter it in the Bitbucket admin GUI.

0ge commented 5 years ago

And I should have gotten back faster. 😉

I opened his gitconfig file with Sublime Text and UTF-8 encoding and there it looks OK. If I open it with ISO 8859-1 (Latin-1) the special characters are wonky. I re-entered his name in JIRA (synced with Bitbucket), but it didn't help.

0ge commented 5 years ago

I ran SHOW SERVER_ENCODING in the SQL database that holds our JIRA application and its also using UTF-8.

tomasbjerre commented 5 years ago

Perhaps this can be solved by adding logging. Logging each character ascii value.

0ge commented 5 years ago

I could try this, but not sure where or how to add the logging?