Changeset 196097 in webkit


Ignore:
Timestamp:
Feb 3, 2016 4:35:33 PM (8 years ago)
Author:
BJ Burg
Message:

git-add-reviewer should work when run from a subdirectory within the repository
https://bugs.webkit.org/show_bug.cgi?id=153842

Reviewed by David Kilzer.

There are two problems that needed to be fixed:

  • We can't assume .git is in $PWD/.git
  • We can't specify absolute paths to git commit

Fix these problems using the helpers in VCSUtils that were added to
fix this same issue for prepare-changeCogs.

  • Scripts/VCSUtils.pm: Export gitDirectory()
  • Scripts/git-add-reviewer:

(nonInteractive): Cache gitDirectory() result.
(addReviewer):
(commit):
(changeLogsForCommit): Make paths relative.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r196093 r196097  
     12016-02-03  Brian Burg  <bburg@apple.com>
     2
     3        git-add-reviewer should work when run from a subdirectory within the repository
     4        https://bugs.webkit.org/show_bug.cgi?id=153842
     5
     6        Reviewed by David Kilzer.
     7
     8        There are two problems that needed to be fixed:
     9
     10         - We can't assume .git is in $PWD/.git
     11         - We can't specify absolute paths to `git commit`
     12
     13        Fix these problems using the helpers in VCSUtils that were added to
     14        fix this same issue for prepare-changeCogs.
     15
     16        * Scripts/VCSUtils.pm: Export gitDirectory()
     17        * Scripts/git-add-reviewer:
     18        (nonInteractive): Cache gitDirectory() result.
     19        (addReviewer):
     20        (commit):
     21        (changeLogsForCommit): Make paths relative.
     22
    1232016-02-03  Jer Noble  <jer.noble@apple.com>
    224
  • trunk/Tools/Scripts/VCSUtils.pm

    r191900 r196097  
    6161        &fixChangeLogPatch
    6262        &gitBranch
     63        &gitDirectory
    6364        &gitTreeDirectory
    6465        &gitdiff2svndiff
  • trunk/Tools/Scripts/git-add-reviewer

    r190366 r196097  
    3232use IPC::Open2;
    3333
     34use FindBin;
     35use lib $FindBin::Bin;
     36use webkitdirs;
     37use VCSUtils;
     38
    3439my $defaultReviewer = "NOBODY";
    3540
     
    8287);
    8388
     89my $gitDirectory = gitDirectory();
     90
    8491usage() if !$getOptionsResult || $showHelp;
    8592
     
    182189
    183190    unless ((($commit eq $headCommit) or checkout($commit))
    184             # FIXME: We need to use $ENV{GIT_DIR}/.git/MERGE_MSG
    185             && writeCommitMessageToFile(".git/MERGE_MSG")
     191            && writeCommitMessageToFile("$gitDirectory/MERGE_MSG")
    186192            && addReviewer(%item)
    187193            && commit(1)
     
    234240    }
    235241
    236     addReviewerToCommitMessage($item->{reviewer}, $item->{rubberstamp}, ".git/MERGE_MSG") or return fail();
     242    addReviewerToCommitMessage($item->{reviewer}, $item->{rubberstamp}, "$gitDirectory/MERGE_MSG") or return fail();
    237243
    238244    return 1;
     
    243249    my ($amend) = @_;
    244250
    245     my @command = qw(git commit -F .git/MERGE_MSG);
     251    my @command = qw(git commit -F);
     252    push @command, "$gitDirectory/MERGE_MSG";
    246253    push @command, "--amend" if $amend;
    247254    my $result = system @command;
     
    330337    @files or return fail("Couldn't determine changed files for $commit.");
    331338
    332     my @changeLogs = map { /^[ACMR]\s*(.*)/; $1 } grep { /^[ACMR].*[^-]ChangeLog/ } @files;
     339    my @changeLogs = map { /^[ACMR]\s*(.*)/; makeFilePathRelative($1) } grep { /^[ACMR].*[^-]ChangeLog/ } @files;
    333340    return \@changeLogs;
    334341}
Note: See TracChangeset for help on using the changeset viewer.