Thread (5 messages) flat view 5 messages, 2 authors, 2016-06-15

Re: [PATCH] Teach rm to remove submodules when given with a trailing '/'

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:55:08

Am 10/29/2012 0:28, schrieb Jens Lehmann:
+	/* Remove trailing '/' from directories to find submodules in the index */
+	for (i = 0; i < argc; i++) {
+		size_t pathlen = strlen(argv[i]);
+		if (pathlen && is_directory(argv[i]) && (argv[i][pathlen - 1] == '/'))
+			argv[i] = xmemdupz(argv[i], pathlen - 1);
+	}
+
 	pathspec = get_pathspec(prefix, argv);
 	refresh_index(&the_index, REFRESH_QUIET, pathspec, NULL, NULL);
That's wrong: Either move the check below get_pathspec() (which normalizes
backslashes to forward-slashes on Windows) or use is_dir_sep().

But isn't it somewhat dangerous to check pathspec for existance in the
worktree without interpreting them? Think of magic pathspec syntax (that
we do not have yet, but which may materialize sometime in the future).

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