get_control_field()
{
- awk -F "$_TAB" -v branch="$1" -v field="$2" '/^[^#]/ && $3==branch { print $field; }' "$CTRL_FILE"
+ awk -F "$_TAB" -v branch="$1" -v field="$2" '/^[^-#]/ && $3==branch { print $field; }' "$CTRL_FILE"
}
get_branches()
{
- awk -F "$_TAB" '/^[^#]/ && $2=="git"{ print $3; }' "$CTRL_FILE"
+ awk -F "$_TAB" '/^[^-#]/ && $2=="git"{ print $3; }' "$CTRL_FILE"
}
get_pending_branches()
{
- awk -F "$_TAB" '/^[^#]/ && $2=="git"{ print $3; } $1=="pending-fixes" { exit; }' "$CTRL_FILE"
+ awk -F "$_TAB" '/^[^-#]/ && $2=="git"{ print $3; } $1=="pending-fixes" { exit; }' "$CTRL_FILE"
}
get_contacts()
heads=$(awk -F '\t' '
/^#/ { next; }
$2=="git" { printf("%s/%s ", $3, $5); }
- $2=="branch" { printf("branch/%s ", $1); }' "$CTRL_FILE")
+ $2=="branch" { printf("branch/%s ", $1); }
+ $2=="switch" { printf("switch/%s/%s ", $3, $4); }' "$CTRL_FILE")
need_build=false
for h in $heads; do
tree=${h%%/*}
+ branch=${h#"$tree"/}
if [ -n "$start_from" ]; then
if [ "$tree" = "$start_from" ]; then
fi
if [ "$tree" = "branch" ]; then
- git branch -f "${h#branch/}"
- linux-next-notify "update branch ${h#branch/}"
+ git branch -f "$branch"
+ linux-next-notify "update branch $branch"
continue
fi
+ if [ "$tree" = 'switch' ]; then
+ new_branch=${branch%%/*}
+ if [ "$new_branch" = 'master' ]; then
+ old_branch=$(git branch --show-current)
+ if ! [ "$old_branch" = 'master' ]; then
+ if ! cd ../next; then
+ fix_up 'no ../next directory!'
+ fi
+ git worktree remove "$old_branch"
+ fi
+ else
+ base=${branch#"$new_branch"/}
+ if ! git worktree add -B "$new_branch" ../"$new_branch" "$base"; then
+ fix_up 'git worktree add failed'
+ fi
+ if ! cd ../"$new_branch"; then
+ fix_up 'cannot chdir to new worktree directory'
+ fi
+ fi
+ continue
+ fi
+
+ h=${h%/}
hlog=$(git log -1 --oneline "$h") 2>/dev/null
old_head=$(git rev-parse HEAD)
if [ -f "../pre-merge/$tree" ]; then
fi
repo="${build_host:+$build_host:}${build_dir}"
- if ! git push -f "$repo" master:refs/heads/next; then
+ if ! git push -f "$repo" HEAD:refs/heads/next; then
fix_up "push failed for $tree" "git push failed"
fi