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

Detect possible commit hashes in the commit messages and convert them to hyperlinks #2753

Merged
merged 14 commits into from
Apr 13, 2017

Conversation

mnaoumov
Copy link
Contributor

Implements #2714

@@ -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));
Copy link
Contributor

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?

Copy link
Contributor Author

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

@Radrik5
Copy link
Contributor

Radrik5 commented Mar 30, 2015

Please consider using 'git rev-parse --verify hash^{commit}' to ignore false positive matches.

{
if (module == null)
return hash;
string revParseResult = module.RunGitCmd(string.Format("rev-parse --verify --quiet {0}^{{commit}}", hash));
Copy link
Member

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.

@jbialobr jbialobr merged commit 143eff0 into gitextensions:master Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants