read-cache: reindent
I do not know how this happened without anybody noticing, but a few months ago we added a16c4a245a (read-cache: submodule add need --force given ignore=all configuration, 2026-02-06), and almost all lines the patch added were incorrectly indented. Reindent these lines so that they play better with surrounding lines in the same file. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 31, 2026 at 05:56 UTC
341e32111cc0bbf2542fbd8e604b5ed5187c3f98
1 file changed
+36
-34
read-cache.c
+36
-34
@@ -3910,32 +3910,33 @@ static int fix_unmerged_status(struct diff_filepair *p,
3910
}
3911
3912
static int skip_submodule(const char *path,
3913
- struct repository *repo,
3914
- struct pathspec *pathspec,
3915
- int ignored_too)
3916
-{
3917
- struct stat st;
3918
- const struct submodule *sub;
3919
- int pathspec_matches = 0;
3920
- int ps_i;
3921
- char *norm_pathspec = NULL;
3922
-
3923
- /* Only consider if path is a directory */
3924
- if (lstat(path, &st) || !S_ISDIR(st.st_mode))
3913
+ struct repository *repo,
3914
+ struct pathspec *pathspec,
3915
+ int ignored_too)
3916
+{
3917
+ struct stat st;
3918
+ const struct submodule *sub;
3919
+ int pathspec_matches = 0;
3920
+ int ps_i;
3921
+ char *norm_pathspec = NULL;
3922
+
3923
+ /* Only consider if path is a directory */
3924
+ if (lstat(path, &st) || !S_ISDIR(st.st_mode))
3925
return 0;
3926
3927
- /* Check if it's a submodule with ignore=all */
3928
- sub = submodule_from_path(repo, null_oid(the_hash_algo), path);
3929
- if (!sub || !sub->name || !sub->ignore || strcmp(sub->ignore, "all"))
3927
+ /* Check if it's a submodule with ignore=all */
3928
+ sub = submodule_from_path(repo, null_oid(the_hash_algo), path);
3929
+ if (!sub || !sub->name || !sub->ignore || strcmp(sub->ignore, "all"))
3930
return 0;
3931
3932
- trace_printf("ignore=all: %s\n", path);
3933
- trace_printf("pathspec %s\n", (pathspec && pathspec->nr)
3934
- ? "has pathspec"
3935
- : "no pathspec");
3932
+ trace_printf("ignore=all: %s\n", path);
3933
+ trace_printf("pathspec %s\n",
3934
+ ((pathspec && pathspec->nr)
3935
+ ? "has pathspec"
3936
+ : "no pathspec"));
3937
3937
- /* Check if submodule path is explicitly mentioned in pathspec */
3938
- if (pathspec) {
3938
+ /* Check if submodule path is explicitly mentioned in pathspec */
3939
+ if (pathspec) {
3940
for (ps_i = 0; ps_i < pathspec->nr; ps_i++) {
3941
const char *m = pathspec->items[ps_i].match;
3942
if (!m)
@@ -3949,28 +3950,29 @@ static int skip_submodule(const char *path,
3950
}
3951
FREE_AND_NULL(norm_pathspec);
3952
}
3952
- }
3953
+ }
3954
3954
- /* If explicitly matched and forced, allow adding */
3955
- if (pathspec_matches) {
3955
+ /* If explicitly matched and forced, allow adding */
3956
+ if (pathspec_matches) {
3957
if (ignored_too && ignored_too > 0) {
3958
trace_printf("Add submodule due to --force: %s\n", path);
3959
return 0;
3960
} else {
3961
advise_if_enabled(ADVICE_ADD_IGNORED_FILE,
3961
- _("Skipping submodule due to ignore=all: %s\n"
3962
- "Use --force if you really want to add the submodule."), path);
3962
+ _("Skipping submodule due to ignore=all: %s\n"
3963
+ "Use --force if you really want to "
3964
+ "add the submodule."), path);
3965
return 1;
3966
}
3965
- }
3967
+ }
3968
3967
- /* No explicit pathspec match -> skip silently */
3968
- trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
3969
- return 1;
3969
+ /* No explicit pathspec match -> skip silently */
3970
+ trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
3971
+ return 1;
3972
}
3973
3974
static void update_callback(struct diff_queue_struct *q,
3973
- struct diff_options *opt UNUSED, void *cbdata)
3975
+ struct diff_options *opt UNUSED, void *cbdata)
3976
{
3977
int i;
3978
struct update_callback_data *data = cbdata;
@@ -3980,7 +3982,7 @@ static void update_callback(struct diff_queue_struct *q,
3982
const char *path = p->one->path;
3983
3984
if (!data->include_sparse &&
3983
- !path_in_sparse_checkout(path, data->index))
3985
+ !path_in_sparse_checkout(path, data->index))
3986
continue;
3987
3988
switch (fix_unmerged_status(p, data)) {
@@ -3989,8 +3991,8 @@ static void update_callback(struct diff_queue_struct *q,
3991
case DIFF_STATUS_MODIFIED:
3992
case DIFF_STATUS_TYPE_CHANGED:
3993
if (skip_submodule(path, data->repo,
3992
- data->pathspec,
3993
- data->ignored_too))
3994
+ data->pathspec,
3995
+ data->ignored_too))
3996
continue;
3997
3998
if (add_file_to_index(data->index, path, data->flags)) {