Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 3/4] add -u: only show pathless 'add -u' warning when changes exist outside cwd

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:26

Jonathan Nieder [off-list ref] writes:
Yes, that can work, for example like this (replacing the patch you're
replying to).
I think that would be a better approach if we were to do this.  I
still have the same reservation that "this is fundamentally not
worse but still hurts the users more".
+		/*
+		 * Check if "git add -A" or "git add -u" was run from a
+		 * subdirectory with a modified file outside that directory,
+		 * and warn if so.
+		 *
+		 * "git add -u" will behave like "git add -u :/" instead of
+		 * "git add -u ." in the future.  This warning prepares for
+		 * that change.
+		 */
+		if (implicit_dot &&
+		    !match_pathspec(implicit_dot, path, strlen(path), 0, NULL)) {
This one really should *not* use match_pathspec(), I think.

It is a special case where we were asked to limit to our directory
but decided to grab everything instead and filtering the outcome
outselves.  We should have a "path to the starting directory" aka
"prefix" in implicit_dot and check if path is covered by the prefix
instead.
+			warn_pathless_add();
+			continue;
+		}
 		switch (fix_unmerged_status(p, data)) {
 		default:
 			die(_("unexpected diff status %c"), p->status);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help