Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document IndexEntry.path a bit #586

Merged
merged 1 commit into from Jul 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/index.rs
Expand Up @@ -66,6 +66,21 @@ pub struct IndexEntry {
pub id: Oid,
pub flags: u16,
pub flags_extended: u16,

/// The path of this index entry as a byte vector. Regardless of the
/// current platform, the directory separator is an ASCII forward slash
/// (`0x2F`). There are no terminating or internal NUL characters, and no
/// trailing slashes. Most of the time, paths will be valid utf-8 — but
/// not always. For more information on the path storage format, see
/// [these git docs][git-index-docs]. Note that libgit2 will take care of
/// handling the prefix compression mentioned there.
///
/// [git-index-docs]: https://github.com/git/git/blob/a08a83db2bf27f015bec9a435f6d73e223c21c5e/Documentation/technical/index-format.txt#L107-L124
///
/// You can turn this value into a `std::ffi::CString` with
/// `CString::new(&entry.path[..]).unwrap()`. To turn a reference into a
/// `&std::path::Path`, see the `bytes2path()` function in the private,
/// internal `util` module in this crate’s source code.
pub path: Vec<u8>,
}

Expand Down