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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> 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);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]