Reported by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> at
<https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00101.html>.
* top/gitsub.sh (func_upgrade): For a submodule, use 'git branch' to
determine the branch to merge from, instead of assuming that it is
always the 'master' branch.
+2024-08-16 Bruno Haible <bruno@clisp.org>
+
+ gitsub.sh: For a submodule, merge from the right remote branch.
+ Reported by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> at
+ <https://lists.gnu.org/archive/html/bug-gnulib/2024-08/msg00101.html>.
+ * top/gitsub.sh (func_upgrade): For a submodule, use 'git branch' to
+ determine the branch to merge from, instead of assuming that it is
+ always the 'master' branch.
+
2024-08-16 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Don't treat 'valgrind-tests' as a tests module.
case " $submodule_names " in *" $1 "*)
# It's a submodule.
if test -z "$needs_init"; then
- (cd "$path" && git fetch && git merge origin/master) || func_fatal_error "git operation failed"
+ (cd "$path" \
+ && git fetch \
+ && branch=`git branch --show-current` \
+ && { test -n "$branch" || branch=HEAD; } \
+ && sed_escape_dots='s/\([.]\)/\\\1/g' \
+ && branch_escaped=`echo "$branch" | sed -e "${sed_escape_dots}"` \
+ && remote=`git branch -r | sed -n -e "s| origin/${branch_escaped} -> ||p"` \
+ && { test -n "$remote" || remote="origin/${branch}"; } \
+ && echo "In subdirectory $path: Running \"git merge $remote\"" \
+ && git merge "$remote"
+ ) || func_fatal_error "git operation failed"
fi
;;
esac