Title: [216032] trunk/Tools
Revision
216032
Author
[email protected]
Date
2017-05-01 14:53:05 -0700 (Mon, 01 May 2017)

Log Message

Add a new function for getting the Git hash for a pure git directory.
https://bugs.webkit.org/show_bug.cgi?id=171450

Reviewed by David Kilzer.

* Scripts/VCSUtils.pm:
(gitHashForDirectory):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (216031 => 216032)


--- trunk/Tools/ChangeLog	2017-05-01 21:52:54 UTC (rev 216031)
+++ trunk/Tools/ChangeLog	2017-05-01 21:53:05 UTC (rev 216032)
@@ -1,3 +1,13 @@
+2017-05-01  Jason Marcell  <[email protected]>
+
+        Add a new function for getting the Git hash for a pure git directory.
+        https://bugs.webkit.org/show_bug.cgi?id=171450
+
+        Reviewed by David Kilzer.
+
+        * Scripts/VCSUtils.pm:
+        (gitHashForDirectory):
+
 2017-05-01  Joanmarie Diggs  <[email protected]>
 
         [ATK] Expose values of aria-rowcount, aria-colcount, aria-rowindex, aria-colindex, aria-rowspan, and aria-colspan as object attributes

Modified: trunk/Tools/Scripts/VCSUtils.pm (216031 => 216032)


--- trunk/Tools/Scripts/VCSUtils.pm	2017-05-01 21:52:54 UTC (rev 216031)
+++ trunk/Tools/Scripts/VCSUtils.pm	2017-05-01 21:53:05 UTC (rev 216032)
@@ -61,17 +61,20 @@
         &fixChangeLogPatch
         &fixSVNPatchForAdditionWithHistory
         &gitBranch
+        &gitCommitForSVNRevision
         &gitDirectory
+        &gitHashForDirectory
         &gitTreeDirectory
         &gitdiff2svndiff
         &isGit
-        &isGitSVN
         &isGitBranchBuild
         &isGitDirectory
+        &isGitSVN
         &isGitSVNDirectory
         &isSVN
         &isSVNDirectory
         &isSVNVersion16OrNewer
+        &listOfChangedFilesBetweenRevisions
         &makeFilePathRelative
         &mergeChangeLogs
         &normalizePath
@@ -95,8 +98,6 @@
         &svnStatus
         &svnURLForPath
         &toWindowsLineEndings
-        &gitCommitForSVNRevision
-        &listOfChangedFilesBetweenRevisions
         &unixPath
     );
     %EXPORT_TAGS = ( );
@@ -260,6 +261,24 @@
     return $result;
 }
 
+sub gitHashForDirectory($)
+{
+    my ($directory) = @_;
+    my $hash;
+
+    if (isGitDirectory($directory)) {
+        my $command = "git -C \"$directory\" rev-parse HEAD";
+        $command = "LC_ALL=C $command" if !isWindows();
+        $hash = `$command`;
+        chomp($hash);
+    }
+    if (!defined($hash)) {
+        $hash = "unknown";
+        warn "Unable to determine current Git hash in $directory";
+    }
+    return $hash;
+}
+
 sub gitTreeDirectory()
 {
     chomp(my $result = `git rev-parse --show-toplevel`);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to