3 export LOG_FILE=../akpm-import.log
5 # shellcheck source=./common.sh
6 . "$(dirname "$0")/common.sh" ''
10 echo "$@" | tee -a $LOG_FILE
16 "$@" 2>&1 | tee -a $LOG_FILE
17 return ${PIPESTATUS[0]}
24 [ -f "$mmotm/broken-out/origin.patch" ] &&
25 base=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/origin.patch")
27 base=$(tail -n 1 "$mmotm/.DATE")
31 nbase=$(sed -n '1s/^GIT *\([^ ]*\).*$/\1/p' "$mmotm/broken-out/linux-next.patch")
32 git rev-parse --verify "$base" >/dev/null || {
33 log "Unknown origin BASE $base"
36 git rev-parse --verify "$nbase" >/dev/null || {
37 log "Unknown linux-next BASE $nbase"
40 db=$(git describe "$base")
41 dnb=$(git describe --contains "$nbase")
42 log "Importing akpm based on $db/$dnb"
44 [ -d "../tmp-akpm" ] && {
45 log "akpm import directory already exists"
49 execute git worktree add -b tmp-akpm/master ../tmp-akpm "$db" ||
52 log '$' cd ../tmp-akpm
54 execute git branch tmp-akpm/current-base ||
58 /NEXT_PATCHES_START/,/NEXT_PATCHES_END/{
63 patches=$(sed -n "$sed_exp" "$sfile")
70 execute git branch tmp-akpm/current ||
72 execute git merge --no-edit --no-stat "$dnb" || {
73 check_unmerged_files akpm-current
75 git diff 2>&1 | grep -E -q '<<<<<|^\*' && {
78 GIT_EDITOR=: execute git commit -v -a
80 [ -f "../merge-fixes/akpm-current" ] && {
81 for p in $(cat "../merge-fixes/akpm-current"); do
82 $(dirname $0)/merge_fix -n "$p" ||
86 execute git branch tmp-akpm/master-base ||
90 execute git am -s --patch-format=mbox "$mmotm/broken-out/$f" ||
99 execute rm -rf ../tmp-akpm
100 execute git worktree prune
102 for i in akpm/current akpm/current-base akpm/master akpm/master-base; do
103 execute git branch -f $i tmp-$i
104 execute git branch -D tmp-$i