FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Attribute lookups are always on relative paths by ethomson · Pull Request #6073 · libgit2/libgit2 · GitHub

Attribute lookups are always on relative paths - #6073

Merged
ethomson merged 5 commits into
mainfrom
ethomson/attr_lookups
Sep 27, 2021
Merged

ethomson merged 5 commits into
mainfrom
ethomson/attr_lookups

Conversation

ethomson commented Sep 24, 2021
edited
Loading

Copy link
Copy Markdown
Member

We previously (erroneously) passed absolute paths to attribute lookup functions. This sometimes led to ridiculous paths being constructed, like taking an absolute path within a workdir and prefixing the workdir to it. Always provide attribute lookups with a relative path, and enforce in the attribute lookup code that we have done so.

Make p_getcwd match the rest of our win32 path handling semantics.

(This is currently only used in tests, which is why this disparity went
unnoticed.)
When `git_repository_hashfile` is handed an absolute path, it determines
whether the path is within the repository's working directory or not.
This is necessary when there is no `as_path` specified.

If the path is within the working directory, then the given path should
be used for attribute lookups (it is the effective `as_path`).  If it is
not within the working directory, then it is _not_ eligible.

Importantly, now we will _never_ pass an absolute path down to attribute
lookup functions.
Resolve absolute paths to be working directory relative when looking up
attributes.  Importantly, now we will _never_ pass an absolute path down
to attribute lookup functions.
Always pass a working-directory relative path to attribute lookups
during checkout.
Attribute lookups are done on paths relative to the repository.  Fail if
erroneously presented with an absolute path.
ethomson force-pushed the ethomson/attr_lookups branch from 9099230 to 091bd73 Compare September 25, 2021 13:40
ethomson merged commit 853ba20 into main Sep 27, 2021
ethomson deleted the ethomson/attr_lookups branch September 27, 2021 12:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL