@@ -84,18 +84,25 @@ function bench_results() {
84
84
#
85
85
base_dir=$SCRIPT_DIR /$base_version
86
86
87
- # Figure out # of commits past version
88
- cd $SCRIPT_DIR /simdjson
89
- fork_commit=$( git merge-base $base_version $commit )
90
- commits_past_version=$( git rev-list --count --first-parent $base_version ...$fork_commit )
91
- if [ " $commits_past_version " -ne " 0" ]; then
92
- base_dir=" $base_dir /$commits_past_version "
87
+ # Error if commit is not a child of the base version
88
+ if ! git merge-base --is-ancestor $base_version $commit ; then
89
+ echo " Commit $commit is not derived from $base_version !"
90
+ exit 1;
93
91
fi
94
92
95
- # Figure out if commit is unmerged
96
- actual_commit=$( git rev-list -n 1 $commit )
97
- if [ " $fork_commit " != " $actual_commit " ]; then
98
- base_dir=" $base_dir /$actual_commit "
93
+ cd $SCRIPT_DIR /simdjson
94
+ if git merge-base --is-ancestor $commit master; then
95
+ # If it's *past* the base version, use the number of commits past the base version for the directory.
96
+ commits_past_version=$( git rev-list --count --first-parent $base_version ...$commit )
97
+ if [ " $commits_past_version " -ne " 0" ]; then
98
+ echo " Commit $commit is $commits_past_version commits past $base_version ."
99
+ base_dir=" $base_dir /$commits_past_version "
100
+ fi
101
+ else
102
+ # If it's not on master, it's a branch ... use the commit id.
103
+ commit_sha=$( git rev-list -n 1 $commit )
104
+ echo " $commit ($commit_sha ) is not on master. Setting base_dir to commit id $commit_sha ..."
105
+ base_dir=" $base_dir /$commit_sha "
99
106
fi
100
107
101
108
mkdir -p $base_dir
0 commit comments