From ac1fbbda2013416b6c6a93d65c5dcf6662a60579 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 Dec 2013 13:31:55 -0800 Subject: submodule: do not copy unknown update mode from .gitmodules When submodule.$name.update is given as hint from the upstream in the .gitmodules file, we used to blindly copy it to .git/config, unless there already is a value defined for the submodule. However, there is no reason to expect that the update mode hinted by the upstream is available in the version of Git the user is using, and a really custom "!cmd" prepared by an upstream person running on Linux may not even be available to a user on Windows. It is simply irresponsible to copy the setting blindly and to attempt to use it during a later "submodule update" without validating it first. Just show the suggested value to the diagnostic output, and set the value to 'none' in the configuration, if it is not one of the ones that are known to be supported by this version of Git. Helped-by: Jens Lehmann Helped-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/git-submodule.sh b/git-submodule.sh index 2979197..83917d8 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -612,11 +612,21 @@ cmd_init() fi # Copy "update" setting when it is not set yet - upd="$(git config -f .gitmodules submodule."$name".update)" - test -z "$upd" || - test -n "$(git config submodule."$name".update)" || - git config submodule."$name".update "$upd" || - die "$(eval_gettext "Failed to register update mode for submodule path '\$displaypath'")" + if upd="$(git config -f .gitmodules submodule."$name".update)" && + test -n "$upd" && + test -z "$(git config submodule."$name".update)" + then + case "$upd" in + rebase | merge | none) + ;; # known modes of updating + *) + echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'" + upd=none + ;; + esac + git config submodule."$name".update "$upd" || + die "$(eval_gettext "Failed to register update mode for submodule path '\$displaypath'")" + fi done } diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index f0b3305..0825a92 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -323,6 +323,21 @@ test_expect_success 'submodule update - command in .git/config catches failure' ) ' +test_expect_success 'submodule init does not copy command into .git/config' ' + (cd super && + H=$(git ls-files -s submodule | cut -d" " -f2) && + mkdir submodule1 && + git update-index --add --cacheinfo 160000 $H submodule1 && + git config -f .gitmodules submodule.submodule1.path submodule1 && + git config -f .gitmodules submodule.submodule1.url ../submodule && + git config -f .gitmodules submodule.submodule1.update !false && + git submodule init submodule1 && + echo "none" >expect && + git config submodule.submodule1.update >actual && + test_cmp expect actual + ) +' + test_expect_success 'submodule init picks up rebase' ' (cd super && git config -f .gitmodules submodule.rebasing.update rebase && -- cgit v0.10.2-6-g49f6 From 2f93541d88fadd1ff5307d81c2c8921ee3eea058 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 Dec 2013 15:33:30 -0800 Subject: Git 1.8.4.5 Signed-off-by: Junio C Hamano diff --git a/Documentation/RelNotes/1.8.4.5.txt b/Documentation/RelNotes/1.8.4.5.txt new file mode 100644 index 0000000..215bd1a --- /dev/null +++ b/Documentation/RelNotes/1.8.4.5.txt @@ -0,0 +1,13 @@ +Git v1.8.4.5 Release Notes +========================== + +Fixes since v1.8.4.4 +-------------------- + + * Recent update to remote-hg that attempted to make it work better + with non ASCII pathnames fed Unicode strings to the underlying Hg + API, which was wrong. + + * "git submodule init" copied "submodule.$name.update" settings from + .gitmodules to .git/config without making sure if the suggested + value was sensible. diff --git a/Documentation/git.txt b/Documentation/git.txt index 7f13d8f..8f7a460 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -43,9 +43,10 @@ unreleased) version of Git, that is available from 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.8.4.4/git.html[documentation for release 1.8.4.4] +* link:v1.8.4.5/git.html[documentation for release 1.8.4.5] * release notes for + link:RelNotes/1.8.4.5.txt[1.8.4.5], link:RelNotes/1.8.4.4.txt[1.8.4.4], link:RelNotes/1.8.4.3.txt[1.8.4.3], link:RelNotes/1.8.4.2.txt[1.8.4.2], diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 8155755..919a1d4 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.8.4.3 +DEF_VER=v1.8.4.5 LF=' ' diff --git a/RelNotes b/RelNotes index ba00ad8..cb02f31 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/1.8.4.4.txt \ No newline at end of file +Documentation/RelNotes/1.8.4.5.txt \ No newline at end of file -- cgit v0.10.2-6-g49f6