Re: [NOT-SERIOUS PATCH] Make get_relative_cwd() not accept NULL for a directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 1, 2007, 16:58 UTC
- Message-ID
- <7vmyxb5h0g.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0708011624260.14781@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Okay, I made up my mind. Allowing "dir == NULL" is not > only a matter of convenience. It is the most natural > way to say that "dir" is an invalid or non-existing > directory.
That is also fine; it only needs to be clarified somehow to people who might wonder what get_relative_cwd() function is used for and how to use it in their programs. The comment that says "As a convenience" may need to become a bit more elaborate to say why it is convenient for the callers to do so (e.g. "The caller may have called another function that returns a directory to obtain the 'dir', which may have returned NULL as a way to say 'there is nothing applicable in your case', and in such a case, your $(cwd) relative to that 'dir' is also something that cannot be used, hence a NULL is returned").