Title: [152931] trunk/Tools
Revision
152931
Author
[email protected]
Date
2013-07-19 15:46:04 -0700 (Fri, 19 Jul 2013)

Log Message

Make Perl tools work when using git bisect with Git branch build setup
https://bugs.webkit.org/show_bug.cgi?id=118512

Reviewed by Martin Robinson.

The various Perl tools (run-webkit-app, {debug, run}-safari, et cetera) don't work
during a git bisect session with a Git branch build setup (i.e. git config
core.webKitBranchBuild true). Specifically, the tools cannot find the branch-
specific build of WebKit because they cannot determine the branch Git is on (since
git bisect puts Git into a detached HEAD state). We should teach our tooling to
parse the file .git/BISECT_START (created by git bisect start) for the name of the
branch Git was on when we began a git bisect session. Then the tools can determine
the path to the built WebKit.

* Scripts/VCSUtils.pm:
(gitDirectory): Added.
(gitBisectStartBranch): Added.
(gitBranch): Modified to call gitBisectStartBranch() when we have a detached
HEAD (e.g. running git bisect).
(determineVCSRoot): Modified to call gitDirectory() to determine the path to
the .git directory in the Git checkout.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (152930 => 152931)


--- trunk/Tools/ChangeLog	2013-07-19 22:44:50 UTC (rev 152930)
+++ trunk/Tools/ChangeLog	2013-07-19 22:46:04 UTC (rev 152931)
@@ -1,3 +1,27 @@
+2013-07-19  Daniel Bates  <[email protected]>
+
+        Make Perl tools work when using git bisect with Git branch build setup
+        https://bugs.webkit.org/show_bug.cgi?id=118512
+
+        Reviewed by Martin Robinson.
+
+        The various Perl tools (run-webkit-app, {debug, run}-safari, et cetera) don't work
+        during a git bisect session with a Git branch build setup (i.e. git config
+        core.webKitBranchBuild true). Specifically, the tools cannot find the branch-
+        specific build of WebKit because they cannot determine the branch Git is on (since
+        git bisect puts Git into a detached HEAD state). We should teach our tooling to
+        parse the file .git/BISECT_START (created by git bisect start) for the name of the
+        branch Git was on when we began a git bisect session. Then the tools can determine
+        the path to the built WebKit.
+
+        * Scripts/VCSUtils.pm:
+        (gitDirectory): Added.
+        (gitBisectStartBranch): Added.
+        (gitBranch): Modified to call gitBisectStartBranch() when we have a detached
+        HEAD (e.g. running git bisect).
+        (determineVCSRoot): Modified to call gitDirectory() to determine the path to
+        the .git directory in the Git checkout.
+
 2013-07-19  Alex Christensen  <[email protected]>
 
         Added x64 configuration to Visual Studio build.

Modified: trunk/Tools/Scripts/VCSUtils.pm (152930 => 152931)


--- trunk/Tools/Scripts/VCSUtils.pm	2013-07-19 22:44:50 UTC (rev 152930)
+++ trunk/Tools/Scripts/VCSUtils.pm	2013-07-19 22:46:04 UTC (rev 152931)
@@ -236,11 +236,33 @@
     return $isGitSVN;
 }
 
+sub gitDirectory()
+{
+    chomp(my $result = `git rev-parse --git-dir`);
+    return $result;
+}
+
+sub gitBisectStartBranch()
+{
+    my $bisectStartFile = File::Spec->catfile(gitDirectory(), "BISECT_START");
+    if (!-f $bisectStartFile) {
+        return "";
+    }
+    open(BISECT_START, $bisectStartFile) or die "Failed to open $bisectStartFile: $!";
+    chomp(my $result = <BISECT_START>);
+    close(BISECT_START);
+    return $result;
+}
+
 sub gitBranch()
 {
     unless (defined $gitBranch) {
         chomp($gitBranch = `git symbolic-ref -q HEAD`);
-        $gitBranch = "" if exitStatus($?);
+        my $hasDetachedHead = exitStatus($?);
+        if ($hasDetachedHead) {
+            # We may be in a git bisect session.
+            $gitBranch = gitBisectStartBranch();
+        }
         $gitBranch =~ s#^refs/heads/##;
         $gitBranch = "" if $gitBranch eq "master";
     }
@@ -305,12 +327,6 @@
     return File::Spec->abs2rel($previousDirectory, $newDirectory);
 }
 
-sub determineGitRoot()
-{
-    chomp(my $gitDir = `git rev-parse --git-dir`);
-    return dirname($gitDir);
-}
-
 sub determineSVNRoot()
 {
     my $last = '';
@@ -359,7 +375,7 @@
 sub determineVCSRoot()
 {
     if (isGit()) {
-        return determineGitRoot();
+        return dirname(gitDirectory());
     }
 
     if (!isSVN()) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to