File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 103103
104104base_commit=" "
105105if [[ " $last_built " =~ ^[0-9a-f]{40}$ ]] &&
106- git cat-file -e " ${last_built} ^{commit}" 2> /dev/null &&
107- git merge-base --is-ancestor " $last_built " " $target_commit " ; then
108- base_commit=" $last_built "
109- elif [[ " ${PUSH_BEFORE:- } " =~ ^[0-9a-f]{40}$ ]] &&
106+ git cat-file -e " ${last_built} ^{commit}" 2> /dev/null; then
107+ if git merge-base --is-ancestor " $last_built " " $target_commit " ; then
108+ base_commit=" $last_built "
109+ else
110+ # A force-push can replace already-built commits with equivalent commits
111+ # that have new IDs. Resume from the histories' common ancestor so every
112+ # replacement commit receives a wheel.
113+ base_commit=" $( git merge-base " $last_built " " $target_commit " || true) "
114+ fi
115+ fi
116+
117+ if [[ -z " $base_commit " ]] &&
118+ [[ " ${PUSH_BEFORE:- } " =~ ^[0-9a-f]{40}$ ]] &&
110119 [[ ! " ${PUSH_BEFORE} " =~ ^0+$ ]] &&
111120 git cat-file -e " ${PUSH_BEFORE} ^{commit}" 2> /dev/null &&
112121 git merge-base --is-ancestor " $PUSH_BEFORE " " $target_commit " ; then
113122 base_commit=" $PUSH_BEFORE "
114- elif git rev-parse " ${target_commit} ^" > /dev/null 2>&1 ; then
123+ fi
124+
125+ if [[ -z " $base_commit " ]] &&
126+ git rev-parse " ${target_commit} ^" > /dev/null 2>&1 ; then
115127 base_commit=" $( git rev-parse " ${target_commit} ^" ) "
116128fi
117129
Original file line number Diff line number Diff line change 124124
125125base_commit=" "
126126if [[ " $last_built " =~ ^[0-9a-f]{40}$ ]] &&
127- git cat-file -e " ${last_built} ^{commit}" 2> /dev/null &&
128- git merge-base --is-ancestor " $last_built " " $target_commit " ; then
129- base_commit=" $last_built "
130- elif [[ " ${PUSH_BEFORE:- } " =~ ^[0-9a-f]{40}$ ]] &&
127+ git cat-file -e " ${last_built} ^{commit}" 2> /dev/null; then
128+ if git merge-base --is-ancestor " $last_built " " $target_commit " ; then
129+ base_commit=" $last_built "
130+ else
131+ # A force-push can replace already-built commits with equivalent commits
132+ # that have new IDs. Resume from the histories' common ancestor so every
133+ # replacement commit receives a wheel.
134+ base_commit=" $( git merge-base " $last_built " " $target_commit " || true) "
135+ fi
136+ fi
137+
138+ if [[ -z " $base_commit " ]] &&
139+ [[ " ${PUSH_BEFORE:- } " =~ ^[0-9a-f]{40}$ ]] &&
131140 [[ ! " ${PUSH_BEFORE} " =~ ^0+$ ]] &&
132141 git cat-file -e " ${PUSH_BEFORE} ^{commit}" 2> /dev/null &&
133142 git merge-base --is-ancestor " $PUSH_BEFORE " " $target_commit " ; then
134143 base_commit=" $PUSH_BEFORE "
135- elif git rev-parse " ${target_commit} ^" > /dev/null 2>&1 ; then
144+ fi
145+
146+ if [[ -z " $base_commit " ]] &&
147+ git rev-parse " ${target_commit} ^" > /dev/null 2>&1 ; then
136148 base_commit=" $( git rev-parse " ${target_commit} ^" ) "
137149fi
138150
You can’t perform that action at this time.
0 commit comments