-
Notifications
You must be signed in to change notification settings - Fork 127
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
Clarify API for dir.[ch] and unpack-trees.[ch] -- mark relevant fields as internal #1149
Commits on Feb 26, 2023
-
t2021: fix platform-specific leftover cruft
t2021.6 existed to test the status of a symlink that was left around by previous tests. It tried to also clean up the symlink after it was done so that subsequent tests wouldn't be tripped up by it. Unfortunately, since this test had a SYMLINK prerequisite, that made the cleanup platform dependent...and made a testcase I was trying to add to this testsuite fail (that testcase will be included in the next patch). Before we go and add new testcases, fix this cleanup by moving it into a separate test. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 7bbc457 - Browse repository at this point
Copy the full SHA 7bbc457View commit details -
unpack-trees: heed requests to overwrite ignored files
When a directory exists but has only ignored files within it and we are trying to switch to a branch that has a file where that directory is, the behavior depends upon --[no]-overwrite-ignore. If the user wants to --overwrite-ignore (the default), then we should delete the ignored file and directory and switch to the new branch. The code to handle this in verify_clean_subdirectory() in unpack-trees tried to handle this via paying attention to the exclude_per_dir setting of the internal dir field. This came from commit c819353 ("Fix switching to a branch with D/F when current branch has file D.", 2007-03-15), which pre-dated 039bc64 ("core.excludesfile clean-up", 2007-11-14), and thus did not pay attention to ignore patterns from other relevant files. Change it to use setup_standard_excludes() so that it is also aware of excludes specified in other locations. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 8ffdb6c - Browse repository at this point
Copy the full SHA 8ffdb6cView commit details -
dir: separate public from internal portion of dir_struct
In order to make it clearer to callers what portions of dir_struct are public API, and avoid errors from them setting fields that are meant as internal API, split the fields used for internal implementation reasons into a separate embedded struct. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 879a93a - Browse repository at this point
Copy the full SHA 879a93aView commit details -
dir: add a usage note to exclude_per_dir
As evidenced by the fix a couple commits ago, places in the code using exclude_per_dir are likely buggy and should be adapted to call setup_standard_excludes() instead. Unfortunately, the usage of exclude_per_dir has been hardcoded into the arguments ls-files accepts, so we cannot actually remove it. Add a note that it is deprecated and no other callers should use it directly. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 4ce9fae - Browse repository at this point
Copy the full SHA 4ce9faeView commit details -
dir: mark output only fields of dir_struct as such
While at it, also group these fields together for convenience. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 1234440 - Browse repository at this point
Copy the full SHA 1234440View commit details -
unpack-trees: clean up some flow control
The update_sparsity() function was introduced in commit 7af7a25 ("unpack-trees: add a new update_sparsity() function", 2020-03-27). Prior to that, unpack_trees() was used, but that had a few bugs because the needs of the caller were different, and different enough that unpack_trees() could not easily be modified to handle both usecases. The implementation detail that update_sparsity() was written by copying unpack_trees() and then streamlining it, and then modifying it in the needed ways still shows through in that there are leftover vestiges in both functions that are no longer needed. Clean them up. In particular: * update_sparsity() allows a pattern list to be passed in, but unpack_trees() never should use a different pattern list. Add a check and a BUG() if this gets violated. * update_sparsity() has a check early on that will BUG() if o->skip_sparse_checkout is set; as such, there's no need to check for that condition again later in the code. We can simply remove the check and its corresponding goto label. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 4e86e39 - Browse repository at this point
Copy the full SHA 4e86e39View commit details -
sparse-checkout: avoid using internal API of unpack-trees
struct unpack_trees_options has the following field and comment: struct pattern_list *pl; /* for internal use */ Despite the internal-use comment, commit e091228 ("sparse-checkout: update working directory in-process", 2019-11-21) starting setting this field from an external caller. At the time, the only way around that would have been to modify unpack_trees() to take an extra pattern_list argument, and there's a lot of callers of that function. However, when we split update_sparsity() off as a separate function, with sparse-checkout being the sole caller, the need to update other callers went away. Fix this API problem by adding a pattern_list argument to update_sparsity() and stop setting the internal o.pl field directly. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for cd3d489 - Browse repository at this point
Copy the full SHA cd3d489View commit details -
sparse-checkout: avoid using internal API of unpack-trees, take 2
Commit 2f6b1eb ("cache API: add a "INDEX_STATE_INIT" macro/function, add release_index()", 2023-01-12) mistakenly added some initialization of a member of unpack_trees_options that was intended to be internal-only. This initialization should be done within update_sparsity() instead. Note that while o->result is mostly meant for unpack_trees() and update_sparsity() mostly operates without o->result, check_ok_to_remove() does consult it so we need to ensure it is properly initialized. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 09140cb - Browse repository at this point
Copy the full SHA 09140cbView commit details -
unpack_trees: start splitting internal fields from public API
This just splits the two fields already marked as internal-only into a separate internal struct. Future commits will add more fields that were meant to be internal-only but were not explicitly marked as such to the same struct. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 27f2d47 - Browse repository at this point
Copy the full SHA 27f2d47View commit details -
unpack-trees: mark fields only used internally as internal
Continue the work from the previous patch by finding additional fields which are only used internally but not yet explicitly marked as such, and include them in the internal fields struct. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 4236c0d - Browse repository at this point
Copy the full SHA 4236c0dView commit details -
unpack-trees: rewrap a few overlong lines from previous patch
The previous patch made many lines a little longer, resulting in four becoming a bit too long. They were left as-is for the previous patch to facilitate reviewers verifying that we were just adding "internal." in a bunch of places, but rewrap them now. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 76f4a54 - Browse repository at this point
Copy the full SHA 76f4a54View commit details -
unpack-trees: special case read-tree debugging as internal usage
builtin/read-tree.c has some special functionality explicitly designed for debugging unpack-trees.[ch]. Associated with that is two fields that no other external caller would or should use. Mark these as internal to unpack-trees, but allow builtin/read-tree to read or write them for this special case. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ee36935 - Browse repository at this point
Copy the full SHA ee36935View commit details -
unpack-trees: add usage notices around df_conflict_entry
Avoid making users believe they need to initialize df_conflict_entry to something (as happened with other output only fields before) with a quick comment and a small sanity check. Signed-off-by: Elijah Newren <newren@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 6575c00 - Browse repository at this point
Copy the full SHA 6575c00View commit details