-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Detect possible commit hashes in the commit messages and convert them to hyperlinks #2753
Conversation
…10 limitation comes from LinkFactory
…hes. 7 is the default length for short hashes according to http://git-scm.com/docs/git-rev-parse
@@ -49,6 +50,8 @@ public static CommitInformation GetCommitInfo(CommitData data, bool showRevision | |||
string header = data.GetHeader(showRevisionsAsLinks); | |||
string body = "\n" + WebUtility.HtmlEncode(data.Body.Trim()); | |||
|
|||
if (showRevisionsAsLinks) | |||
body = GitRevision.Sha1HashShortRegex.Replace(body, m => LinkFactory.CreateCommitLink(m.Value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it replace full 40 char hash with the first 10 chars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Radrik5 I fixed that
Please consider using 'git rev-parse --verify hash^{commit}' to ignore false positive matches. |
…ive matches. 7 is the default length for short hashes according to http://git-scm.com/docs/git-rev-parse" This reverts commit e63b2a2.
Conflicts: Externals/Git.hub
f479657
to
3ba72ae
Compare
{ | ||
if (module == null) | ||
return hash; | ||
string revParseResult = module.RunGitCmd(string.Format("rev-parse --verify --quiet {0}^{{commit}}", hash)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking if hash is valid should be implemented in GitModule.
Implements #2714