From: Junio C Hamano <gitster@pobox.com>
To: David Turner <novalis@novalis.org>
Cc: Emily Xie <emilyxxie@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] pathspec: prevent empty strings as pathspecs
Date: Sat, 18 Jun 2016 23:18:14 -0700 [thread overview]
Message-ID: <xmqq60t5ya55.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <576623F7.3020700@novalis.org> (David Turner's message of "Sun, 19 Jun 2016 00:47:51 -0400")
David Turner <novalis@novalis.org> writes:
> The help for rev-parse --show-prefix says:
> "When the command is invoked from a subdirectory, show the path of
> the current directory relative to the top-level directory."
>
> This doesn't say what it does when invoked at the top-level. Maybe we
> should just change it to output "./", which would make such scripts
> work? It would not necessarily fix all possible scripts, but it would
> fix these. It seem odd to insist on preserving this undocumented
> behavior of git add/rm.
For two obvious reasons, you do not want to go there.
As you seem to understand in the above, "--show-prefix" was given
merely as an example, so updating its behaviour would not change the
fundamental problem with the patch under discussion at all. It will
break scripts that knew, documented or not, that pathspec match is a
prefix substring match that honors directory boundary and an empty
string is defined long time ago to match any path and it does not
matter if that definition was made by mistake.
Also, if you change "--show-prefix" output, documented or not, that
will break other scripts that knew that checking it against an empty
string is a valid way to check if you are already at the top level
of the working tree. And I highly suspect that such a change is
much harder to advertise and warn existing scripts, compared to the
change proposed by the patch under discussion. The output routine
in show-prefix knows what it is giving to the caller, but does not
know how the caller uses it and what for. Compared to that, ...
>> At least you would need two-step process to introduce a change like
>> this to warn the people whose tools and workflows you are breaking.
>> That is, (1) in one release, you add code to only detect the case
>> you will be changing the behaviour in a later version and give
>> warning messages, and (2) in another release that is several release
>> cycles later, stop warning and actually change the behaviour.
... is a lot easier transition (again, assuming that this change is
worth doing in the first place).
next prev parent reply other threads:[~2016-06-19 6:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-19 0:57 [PATCH] pathspec: prevent empty strings as pathspecs Emily Xie
2016-06-19 1:49 ` David Turner
2016-06-19 2:23 ` Eric Sunshine
2016-06-19 3:10 ` Junio C Hamano
2016-06-19 4:47 ` David Turner
2016-06-19 6:18 ` Junio C Hamano [this message]
2016-06-19 20:32 ` Emily Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq60t5ya55.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=emilyxxie@gmail.com \
--cc=git@vger.kernel.org \
--cc=novalis@novalis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox