Re: [RFC 4/6] git-check-attr: Normalize paths

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

 



Michael Haggerty <mhagger@xxxxxxxxxxxx> writes:

> 1. I'm not sure whether it is correct to fix this problem at the level
>    of git-check-attr, or whether the fix belongs in the API layer.
>    What is the convention for API functions?  Do they typically take
>    path names relative to the CWD or relative to the working tree
>    root, or ...?

I think passing down "prefix" (i.e. where your $(cwd) was relative to the
root level of the working tree) and the user-supplied "pathspec" (which
typically is relative to that original $(cwd)) is the canonical approach.
The very original git worked only at the root level of the working tree,
with paths specified relative to the root level of the tree, so many code
do:

	- find out the root of the working tree;
        - note where the $(cwd) was in "prefix";
        - chdir to the root of the working tree;
	- prepend the "prefix" to user supplied pathspec;
        - forget all the complexity and work on the whole tree.

Then the "prefix" gets stripped away from the beginning of the paths when
reporting.

Your patch from a cursory look seems to follow that pattern, which is
good.

--
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]