Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: [PATCH v6] submodule: add 'deinit' command

From: Heiko Voigt <hidden>
Date: 2016-06-15 22:56:18

Possibly related (same subject, not in this thread)

Hi,

On Mon, Mar 04, 2013 at 10:20:24PM +0100, Jens Lehmann wrote:
quoted hunk ↗ jump to hunk
diff --git a/git-submodule.sh b/git-submodule.sh
index 004c034..44f70c4 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -547,6 +548,80 @@ cmd_init()
 }
[...]
+
+	module_list "$@" |
+	while read mode sha1 stage sm_path
+	do
+		die_if_unmatched "$mode"
+		name=$(module_name "$sm_path") || exit
+
+		# Remove the submodule work tree (unless the user already did it)
+		if test -d "$sm_path"
+		then
+			# Protect submodules containing a .git directory
+			if test -d "$sm_path/.git"
+			then
+				echo >&2 "$(eval_gettext "Submodule work tree '\$sm_path' contains a .git directory")"
+				die "$(eval_gettext "(use 'rm -rf' if you really want to remove it including all of its history)")"
+			fi
+
+			if test -z "$force"
+			then
+				git rm -n "$sm_path" ||
+				die "$(eval_gettext "Submodule work tree '\$sm_path' contains local modifications; use '-f' to discard them")"
Minor nit. IMO, there is an indentation for the || missing here. Maybe
Junio can squash that in on his side?
+			fi
+			rm -rf "$sm_path" || say "$(eval_gettext "Could not remove submodule work tree '\$sm_path'")"
+		fi
+
+		mkdir "$sm_path" || say "$(eval_gettext "Could not create empty submodule directory '\$sm_path'")"
[...]

Everything else looks good to me.

Cheers Heiko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help