Skip to content

Commit 37f52e9

Browse files
stefanbellergitster
authored andcommitted
submodule-config: keep shallow recommendation around
The shallow field will be used in a later patch by `submodule update`. To differentiate between the actual depth (which may be different), we name it `recommend_shallow` as the field in the .gitmodules file is only a recommendation by the project. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7777322 commit 37f52e9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

submodule-config.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache,
199199
submodule->update_strategy.command = NULL;
200200
submodule->fetch_recurse = RECURSE_SUBMODULES_NONE;
201201
submodule->ignore = NULL;
202+
submodule->recommend_shallow = -1;
202203

203204
hashcpy(submodule->gitmodules_sha1, gitmodules_sha1);
204205

@@ -353,6 +354,14 @@ static int parse_config(const char *var, const char *value, void *data)
353354
else if (parse_submodule_update_strategy(value,
354355
&submodule->update_strategy) < 0)
355356
die(_("invalid value for %s"), var);
357+
} else if (!strcmp(item.buf, "shallow")) {
358+
if (!me->overwrite && submodule->recommend_shallow != -1)
359+
warn_multiple_config(me->commit_sha1, submodule->name,
360+
"shallow");
361+
else {
362+
submodule->recommend_shallow =
363+
git_config_bool(var, value);
364+
}
356365
}
357366

358367
strbuf_release(&name);

submodule-config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct submodule {
1818
struct submodule_update_strategy update_strategy;
1919
/* the sha1 blob id of the responsible .gitmodules file */
2020
unsigned char gitmodules_sha1[20];
21+
int recommend_shallow;
2122
};
2223

2324
int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);

0 commit comments

Comments
 (0)