mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-25 23:57:17 +00:00
Merge pull request #2694 from Therzok/statusFile
git_status_file now takes an exact path.
This commit is contained in:
commit
09d1408c52
@ -112,3 +112,6 @@ v0.21 + 1
|
||||
now uint32_t instead of uint16_t. This allows to set them to UINT_MAX,
|
||||
in effect asking for "infinite" context e.g. to iterate over all the
|
||||
unmodified lines of a diff.
|
||||
|
||||
* git_status_file now takes an exact path. Use git_status_list_new if
|
||||
pathspec searching is needed.
|
||||
|
@ -281,7 +281,8 @@ GIT_EXTERN(int) git_status_foreach_ext(
|
||||
*
|
||||
* @param status_flags Output combination of git_status_t values for file
|
||||
* @param repo A repository object
|
||||
* @param path The file to retrieve status for relative to the repo workdir
|
||||
* @param path The exact path to retrieve status for relative to the
|
||||
* repository working directory
|
||||
* @return 0 on success, GIT_ENOTFOUND if the file is not found in the HEAD,
|
||||
* index, and work tree, GIT_EAMBIGUOUS if `path` matches multiple files
|
||||
* or if it refers to a folder, and -1 on other errors.
|
||||
|
@ -494,7 +494,8 @@ int git_status_file(
|
||||
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS |
|
||||
GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
||||
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS |
|
||||
GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
|
||||
GIT_STATUS_OPT_INCLUDE_UNMODIFIED |
|
||||
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH;
|
||||
opts.pathspec.count = 1;
|
||||
opts.pathspec.strings = &sfi.expected;
|
||||
|
||||
|
@ -195,9 +195,7 @@ void test_status_worktree_init__bracket_in_filename(void)
|
||||
cl_git_pass(git_status_file(&status_flags, repo, "LICENSE\\[1\\].md"));
|
||||
cl_assert(status_flags == GIT_STATUS_INDEX_NEW);
|
||||
|
||||
error = git_status_file(&status_flags, repo, FILE_WITH_BRACKET);
|
||||
cl_git_fail(error);
|
||||
cl_assert_equal_i(GIT_EAMBIGUOUS, error);
|
||||
cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_BRACKET));
|
||||
|
||||
git_index_free(index);
|
||||
git_repository_free(repo);
|
||||
|
Loading…
Reference in New Issue
Block a user