From c3bd7db6f10804eb660f1e2cbe82d2afefe1ba9d Mon Sep 17 00:00:00 2001 From: Stephen Cprek Date: Thu, 30 Jul 2015 12:30:34 -0500 Subject: Fix determination of commit dependencies in regards to new files Change-Id: I5722c58644c606e63a9935732a4d026038dd3231 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19451 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Jay M. Azurin Reviewed-by: Brian Silver Reviewed-by: A. Patrick Williams III --- src/build/tools/hbRelease | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/build/tools/hbRelease b/src/build/tools/hbRelease index bda4e33af..7970e73b1 100755 --- a/src/build/tools/hbRelease +++ b/src/build/tools/hbRelease @@ -772,21 +772,30 @@ sub git_commit_deps { my $base = shift; my $commit = shift; + chomp($base); + chomp($commit); my @deps = (); print "Searching for deps for $commit against $base\n" if $debug; - open COMMAND, "git diff-tree --name-only --no-commit-id -r $commit | ". - "xargs git rev-list $commit~1 ^$base -- |"; - while (my $line = ) + my @files = split('\n',`git diff-tree --name-only --no-commit-id -r $commit`); + foreach my $file (@files) { - print "Found dep: $line" if $debug; + # If a commit introduces a new file, don't run rev-list as it fails + # when the file does not exists in base. + my $file_in_base = `git log $base -n1 --oneline -- $file`; + next if ($file_in_base eq ""); - chomp $line; - push @deps, $line; + my $dep_commit = `git rev-list $commit~1 ^$base $file`; + if ($dep_commit ne "") + { + print "Found dep: $dep_commit" if $debug; + + chomp $dep_commit; + push @deps, $dep_commit; + } } - close COMMAND; return \@deps; } -- cgit v1.2.1