Sync with 1.8.4.5
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 b73a24a..4545afb 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -48,9 +48,10 @@
 * release notes for
   link:RelNotes/1.8.5.txt[1.8.5].
 
-* 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-submodule.sh b/git-submodule.sh
index 896f1c9..66f5f75 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -612,11 +612,21 @@
 		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 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 &&