Have About dialog copy full Git commit hash to clipboard

and use full hash in GitHub web app URI
This commit is contained in:
YoshiRulz 2024-06-20 03:38:13 +10:00
parent e5dc04dc37
commit 3490b544b4
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 5 additions and 6 deletions

View File

@ -49,7 +49,7 @@ public class VersionInfoGenerator : ISourceGenerator
var rev = ExecuteGitWithArguments($"-C {projectDir} rev-list HEAD --count") ?? string.Empty;
var branch = ExecuteGitWithArguments($"-C {projectDir} rev-parse --abbrev-ref HEAD") ?? "master";
var shortHash = ExecuteGitWithArguments($"-C {projectDir} log -1 --format=\"%h\"") ?? "000000000";
var hash = ExecuteGitWithArguments($"-C {projectDir} log -1 --format=\"%H\"") ?? "0000000000000000000000000000000000000000";
// Generated source code
string source = $@"namespace BizHawk.Common
@ -58,7 +58,8 @@ public class VersionInfoGenerator : ISourceGenerator
{{
public const string SVN_REV = ""{rev}"";
public const string GIT_BRANCH = ""{branch}"";
public const string GIT_SHORTHASH = ""{shortHash}"";
public const string GIT_HASH = ""{hash}"";
public const string GIT_SHORTHASH = ""{hash.Substring(startIndex: 0, length: 9)}"";
}}
}}
";

View File

@ -58,9 +58,7 @@ namespace BizHawk.Client.EmuHawk
=> Process.Start((string) ((Control) sender).Tag);
private void btnCopyHash_Click(object sender, EventArgs e)
{
Clipboard.SetText(VersionInfo.GIT_SHORTHASH);
}
=> Clipboard.SetText(VersionInfo.GIT_HASH);
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
=> Process.Start(VersionInfo.BizHawkContributorsListURI);

View File

@ -41,7 +41,7 @@ namespace BizHawk.Common
}
public static (string Label, string TargetURI) GetGitCommitLink()
=> ($"Commit :{GIT_BRANCH}@{GIT_SHORTHASH}", $"https://github.com/TASEmulators/BizHawk/commit/{GIT_SHORTHASH}");
=> ($"Commit :{GIT_BRANCH}@{GIT_SHORTHASH}", $"https://github.com/TASEmulators/BizHawk/commit/{GIT_HASH}");
public static string GetFullVersionDetails()
{