From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 4/4] read-cache: reindent
Date: Tue, 28 Jul 2026 14:52:19 -0700 [thread overview]
Message-ID: <20260728215219.753678-5-gitster@pobox.com> (raw)
In-Reply-To: <20260728215219.753678-1-gitster@pobox.com>
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>
---
read-cache.c | 70 +++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 34 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index 6fbab77225..ad77c0d5e2 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -3924,32 +3924,33 @@ static int fix_unmerged_status(struct diff_filepair *p,
}
static int skip_submodule(const char *path,
- struct repository *repo,
- struct pathspec *pathspec,
- int ignored_too)
-{
- struct stat st;
- const struct submodule *sub;
- int pathspec_matches = 0;
- int ps_i;
- char *norm_pathspec = NULL;
-
- /* Only consider if path is a directory */
- if (lstat(path, &st) || !S_ISDIR(st.st_mode))
+ struct repository *repo,
+ struct pathspec *pathspec,
+ int ignored_too)
+{
+ struct stat st;
+ const struct submodule *sub;
+ int pathspec_matches = 0;
+ int ps_i;
+ char *norm_pathspec = NULL;
+
+ /* Only consider if path is a directory */
+ if (lstat(path, &st) || !S_ISDIR(st.st_mode))
return 0;
- /* Check if it's a submodule with ignore=all */
- sub = submodule_from_path(repo, null_oid(the_hash_algo), path);
- if (!sub || !sub->name || !sub->ignore || strcmp(sub->ignore, "all"))
+ /* Check if it's a submodule with ignore=all */
+ sub = submodule_from_path(repo, null_oid(the_hash_algo), path);
+ if (!sub || !sub->name || !sub->ignore || strcmp(sub->ignore, "all"))
return 0;
- trace_printf("ignore=all: %s\n", path);
- trace_printf("pathspec %s\n", (pathspec && pathspec->nr)
- ? "has pathspec"
- : "no pathspec");
+ trace_printf("ignore=all: %s\n", path);
+ trace_printf("pathspec %s\n",
+ ((pathspec && pathspec->nr)
+ ? "has pathspec"
+ : "no pathspec"));
- /* Check if submodule path is explicitly mentioned in pathspec */
- if (pathspec) {
+ /* Check if submodule path is explicitly mentioned in pathspec */
+ if (pathspec) {
for (ps_i = 0; ps_i < pathspec->nr; ps_i++) {
const char *m = pathspec->items[ps_i].match;
if (!m)
@@ -3963,28 +3964,29 @@ static int skip_submodule(const char *path,
}
FREE_AND_NULL(norm_pathspec);
}
- }
+ }
- /* If explicitly matched and forced, allow adding */
- if (pathspec_matches) {
+ /* If explicitly matched and forced, allow adding */
+ if (pathspec_matches) {
if (ignored_too && ignored_too > 0) {
trace_printf("Add submodule due to --force: %s\n", path);
return 0;
} else {
advise_if_enabled(ADVICE_ADD_IGNORED_FILE,
- _("Skipping submodule due to ignore=all: %s\n"
- "Use --force if you really want to add the submodule."), path);
+ _("Skipping submodule due to ignore=all: %s\n"
+ "Use --force if you really want to "
+ "add the submodule."), path);
return 1;
}
- }
+ }
- /* No explicit pathspec match -> skip silently */
- trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
- return 1;
+ /* No explicit pathspec match -> skip silently */
+ trace_printf("Pathspec to submodule does not match explicitly: %s\n", path);
+ return 1;
}
static void update_callback(struct diff_queue_struct *q,
- struct diff_options *opt UNUSED, void *cbdata)
+ struct diff_options *opt UNUSED, void *cbdata)
{
int i;
struct update_callback_data *data = cbdata;
@@ -3994,7 +3996,7 @@ static void update_callback(struct diff_queue_struct *q,
const char *path = p->one->path;
if (!data->include_sparse &&
- !path_in_sparse_checkout(path, data->index))
+ !path_in_sparse_checkout(path, data->index))
continue;
switch (fix_unmerged_status(p, data)) {
@@ -4003,8 +4005,8 @@ static void update_callback(struct diff_queue_struct *q,
case DIFF_STATUS_MODIFIED:
case DIFF_STATUS_TYPE_CHANGED:
if (skip_submodule(path, data->repo,
- data->pathspec,
- data->ignored_too))
+ data->pathspec,
+ data->ignored_too))
continue;
if (add_file_to_index(data->index, path, data->flags)) {
--
2.55.0-594-g42d2bf033e
prev parent reply other threads:[~2026-07-28 21:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 21:52 [PATCH 0/4] git add --resolved Junio C Hamano
2026-07-28 21:52 ` [PATCH 1/4] merge-ll: consolidate conflict marker scanning logic Junio C Hamano
2026-07-28 21:52 ` [PATCH 2/4] read-cache: add remove_file_from_index_with_flags() Junio C Hamano
2026-07-28 21:52 ` [PATCH 3/4] add: introduce '--resolved' option Junio C Hamano
2026-07-29 3:28 ` Michael Montalbo
2026-07-28 21:52 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260728215219.753678-5-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox