6 while getopts 'ns:' opt; do
21 # shellcheck source=common.sh
22 source "$(dirname "$0")/common.sh"
26 echo "$@" | tee -a "$LOG_FILE"
32 "$@" 2>&1 | tee -a "$LOG_FILE"
33 return "${PIPESTATUS[0]}"
36 [ -n "$start_from" ] || {
37 cp /dev/null "$LOG_FILE"
39 execute git checkout master
40 execute git reset --hard stable
41 printf 'Name\t\tSHA1\n----\t\t----\n' > "$SHA1_FILE"
45 heads=$(awk -F '\t' '/^#/ { next; } $2=="quilt" || $2=="git" { printf("%s/%s ", $3, $5); } $2=="branch" { printf("branch/%s ", $1); }' "$CTRL_FILE")
52 [ -n "$start_from" ] && {
53 if [ "$tree" = "$start_from" ]; then
60 [ "$tree" = "branch" ] && {
61 git branch -f "${h#branch/}"
65 hlog=$(git log -1 --oneline "${h/\/*://}") 2>/dev/null
66 old_head=$(git rev-parse HEAD)
67 [ -f "../pre-merge/$tree" ] && {
68 while read -r p <&7; do
69 if ! "$bin_dir/do_patch" -n "$p"; then
70 linux-next-notify "premerge patch failed"
73 done 7<"../pre-merge/$tree"
75 log Merging "$h" "($hlog)"
76 execute git merge "$h" || {
77 echo Merge failed 1>&2
78 echo "$h" >>../merge.debug
79 git diff >>../merge.debug 2>&1
81 check_unmerged_files "$tree"
83 git diff 2>&1 | grep -E -q '<<<<<|^\*' && {
84 linux-next-notify "new conflict found merging $tree"
85 if [ -f "../merge-fixes/$tree" ]; then
86 echo "Merge fixes exist for this tree:"
87 cat "../merge-fixes/$tree"
91 # [ "$(git status --porcelain)" ] && {
92 GIT_EDITOR=: execute git commit -v -a || {
93 linux-next-notify "next commit failed for $tree"
96 execute git diff -M --stat --summary 'HEAD^..'
99 [ -f "../merge-fixes/$tree" ] && {
100 while read -r p <&7; do
101 if ! "$bin_dir/merge_fix" -n "$p"; then
102 linux-next-notify "merge fix failed for $tree"
105 done 7<"../merge-fixes/$tree"
108 [ "${#tree}" -le 8 ] && tab=$'\t\t'
109 printf '%s%s%s\n' "$tree" "$tab" "$(git rev-parse "${h/\/*://}^{}")" >> "$SHA1_FILE"
110 $no_build && continue
112 # See if we need to build after merging this tree
113 new_head=$(git rev-parse HEAD)
114 [ "$old_head" = "$new_head" ] ||
115 [ "$(git diff "$old_head".. | wc -c)" -eq 0 ] ||
120 do_build=$(awk -F '\t' '/^[^#]/ && $3=="'"$tree"'" { print $6; }' "$CTRL_FILE")
121 [ "$do_build" = "yes" ] ||
123 git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
124 echo git push failed 1>&2
125 linux-next-notify "push failed for $tree"
128 [ -x "../pre-build/$tree" ] && {
129 "../pre-build/$tree" || {
130 echo Prebuild script failed 1>&2
131 linux-next-notify "pre-build script failed for $tree"
135 "$bin_dir/do_build" "$tree" || {
136 echo Build failed 1>&2
137 linux-next-notify "build failed for $tree"