From 5796009122c6ab573a2961db598bbd33727a6ac0 Mon Sep 17 00:00:00 2001 From: "Claus Schneider(Eficode)" Date: Wed, 15 Oct 2025 17:22:15 +0200 Subject: [PATCH 1/5] read-cache: update add_files_to_cache take param include_ignored_submodules The include_ignored_submodules parameter is added to the function add_files_to_cache for usage of explicit updating the index for the updated submodule using the explicit patchspec to the submodule. Signed-off-by: Claus Schneider(Eficode) --- builtin/add.c | 4 +++- builtin/checkout.c | 2 +- builtin/commit.c | 2 +- read-cache-ll.h | 2 +- read-cache.c | 51 ++++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 55 insertions(+), 6 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index 0235854f8099c4..6d11382f33f39f 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -233,6 +233,7 @@ N_("The following paths are ignored by one of your .gitignore files:\n"); static int verbose, show_only, ignored_too, refresh_only; static int ignore_add_errors, intent_to_add, ignore_missing; static int warn_on_embedded_repo = 1; +static int include_ignored_submodules; #define ADDREMOVE_DEFAULT 1 static int addremove = ADDREMOVE_DEFAULT; @@ -271,6 +272,7 @@ static struct option builtin_add_options[] = { OPT_BOOL( 0 , "ignore-errors", &ignore_add_errors, N_("just skip files which cannot be added because of errors")), OPT_BOOL( 0 , "ignore-missing", &ignore_missing, N_("check if - even missing - files are ignored in dry run")), OPT_BOOL(0, "sparse", &include_sparse, N_("allow updating entries outside of the sparse-checkout cone")), + OPT_BOOL(0, "include-ignored-submodules", &include_ignored_submodules, N_("add submodules even if they has configuration ignore=all")), OPT_STRING(0, "chmod", &chmod_arg, "(+|-)x", N_("override the executable bit of the listed files")), OPT_HIDDEN_BOOL(0, "warn-embedded-repo", &warn_on_embedded_repo, @@ -582,7 +584,7 @@ int cmd_add(int argc, else exit_status |= add_files_to_cache(repo, prefix, &pathspec, ps_matched, - include_sparse, flags); + include_sparse, flags, include_ignored_submodules); if (take_worktree_changes && !add_renormalize && !ignore_add_errors && report_path_error(ps_matched, &pathspec)) diff --git a/builtin/checkout.c b/builtin/checkout.c index f9453473fe2a20..b2a404051de318 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -899,7 +899,7 @@ static int merge_working_tree(const struct checkout_opts *opts, */ add_files_to_cache(the_repository, NULL, NULL, NULL, 0, - 0); + 0, 0 ); init_ui_merge_options(&o, the_repository); o.verbosity = 0; work = write_in_core_index_as_tree(the_repository); diff --git a/builtin/commit.c b/builtin/commit.c index b5b96088133b12..5bf7ae5fc139f1 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -455,7 +455,7 @@ static const char *prepare_index(const char **argv, const char *prefix, repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR); add_files_to_cache(the_repository, also ? prefix : NULL, - &pathspec, ps_matched, 0, 0); + &pathspec, ps_matched, 0, 0, 0 ); if (!all && report_path_error(ps_matched, &pathspec)) exit(128); diff --git a/read-cache-ll.h b/read-cache-ll.h index 71b49d9af48a9d..2c8b4b21b1c7e9 100644 --- a/read-cache-ll.h +++ b/read-cache-ll.h @@ -481,7 +481,7 @@ int cmp_cache_name_compare(const void *a_, const void *b_); int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, char *ps_matched, - int include_sparse, int flags); + int include_sparse, int flags, int ignored_too ); void overlay_tree_on_index(struct index_state *istate, const char *tree_name, const char *prefix); diff --git a/read-cache.c b/read-cache.c index 06ad74db2286ae..32f32bdb4c5558 100644 --- a/read-cache.c +++ b/read-cache.c @@ -3880,9 +3880,12 @@ void overlay_tree_on_index(struct index_state *istate, struct update_callback_data { struct index_state *index; + struct repository *repo; + struct pathspec *pathspec; int include_sparse; int flags; int add_errors; + int include_ignored_submodules; }; static int fix_unmerged_status(struct diff_filepair *p, @@ -3924,7 +3927,48 @@ static void update_callback(struct diff_queue_struct *q, default: die(_("unexpected diff status %c"), p->status); case DIFF_STATUS_MODIFIED: - case DIFF_STATUS_TYPE_CHANGED: + case DIFF_STATUS_TYPE_CHANGED: { + struct stat st; + if (!lstat(path, &st) && S_ISDIR(st.st_mode)) { // only consider submodule if it is a directory + const struct submodule *sub = submodule_from_path(data->repo, null_oid(the_hash_algo), path); + if (sub && sub->name && sub->ignore && !strcmp(sub->ignore, "all")) { + int pathspec_matches = 0; + char *norm_pathspec = NULL; + int ps_i; + trace_printf("ignore=all %s\n", path); + trace_printf("pathspec %s\n", + (data->pathspec && data->pathspec->nr) ? "has pathspec" : "no pathspec"); + /* Safely scan all pathspec items (q->nr may exceed pathspec->nr). */ + if (data->pathspec) { + for (ps_i = 0; ps_i < data->pathspec->nr; ps_i++) { + const char *m = data->pathspec->items[ps_i].match; + if (!m) + continue; + norm_pathspec = xstrdup(m); + strip_dir_trailing_slashes(norm_pathspec); + if (!strcmp(path, norm_pathspec)) { + pathspec_matches = 1; + FREE_AND_NULL(norm_pathspec); + break; + } + FREE_AND_NULL(norm_pathspec); + } + } + if (pathspec_matches) { + if (data->include_ignored_submodules && data->include_ignored_submodules > 0) { + trace_printf("Add ignored=all submodule due to --include_ignored_submodules: %s\n", path); + } else { + printf(_("Skipping submodule due to ignore=all: %s"), path); + printf(_("Use --include_ignored_submodules, if you really want to add them.") ); + continue; + } + } else { + /* No explicit pathspec match -> skip silently (or with trace). */ + trace_printf("pathspec does not match %s\n", path); + continue; + } + } + } if (add_file_to_index(data->index, path, data->flags)) { if (!(data->flags & ADD_CACHE_IGNORE_ERRORS)) die(_("updating files failed")); @@ -3945,7 +3989,7 @@ static void update_callback(struct diff_queue_struct *q, int add_files_to_cache(struct repository *repo, const char *prefix, const struct pathspec *pathspec, char *ps_matched, - int include_sparse, int flags) + int include_sparse, int flags, int include_ignored_submodules ) { struct update_callback_data data; struct rev_info rev; @@ -3954,6 +3998,9 @@ int add_files_to_cache(struct repository *repo, const char *prefix, data.index = repo->index; data.include_sparse = include_sparse; data.flags = flags; + data.repo = repo; + data.include_ignored_submodules = include_ignored_submodules; + data.pathspec = (struct pathspec *)pathspec; repo_init_revisions(repo, &rev, prefix); setup_revisions(0, NULL, &rev, NULL); From 9ec79b9a116a1dda9fe7bd10d16c1faf77f778ed Mon Sep 17 00:00:00 2001 From: "Claus Schneider(Eficode)" Date: Wed, 15 Oct 2025 17:37:58 +0200 Subject: [PATCH 2/5] read-cache: add/read-cache respect submodule ignore=all Submodules configured with ignore=all are now skipped during add operations unless overridden by --include-ignored-submodules and the submodule path is explicitly specified. A message is printed (like ignored files) guiding the user to use the --include-ignored-submodules flag if the user has explicitely want to update the submodule reference. The reason for the change is support submodule branch tracking or similar and git status state nothing and git add should not add either. The workflow is more logic and similar to regular ignored files even the submodule is already tracked. The change opens up a lot of possibilities for submodules to be used more freely and simular to the repo tool. A submodule can be added for many more reason and loosely coupled dependencies to the super repo which often gives the friction of handle the explicit commits and updates without the need for tracking the submodule sha1 by sha1. Signed-off-by: Claus Schneider(Eficode) --- read-cache.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/read-cache.c b/read-cache.c index 32f32bdb4c5558..7b6d1b29144974 100644 --- a/read-cache.c +++ b/read-cache.c @@ -48,6 +48,8 @@ #include "csum-file.h" #include "promisor-remote.h" #include "hook.h" +#include "submodule.h" +#include "submodule-config.h" /* Mask for the name length in ce_flags in the on-disk index */ @@ -3956,7 +3958,7 @@ static void update_callback(struct diff_queue_struct *q, } if (pathspec_matches) { if (data->include_ignored_submodules && data->include_ignored_submodules > 0) { - trace_printf("Add ignored=all submodule due to --include_ignored_submodules: %s\n", path); + trace_printf("Add submodule due to --include_ignored_submodules: %s\n", path); } else { printf(_("Skipping submodule due to ignore=all: %s"), path); printf(_("Use --include_ignored_submodules, if you really want to add them.") ); @@ -3964,7 +3966,7 @@ static void update_callback(struct diff_queue_struct *q, } } else { /* No explicit pathspec match -> skip silently (or with trace). */ - trace_printf("pathspec does not match %s\n", path); + trace_printf("Pathspec to submodule does not match explicitly: %s\n", path); continue; } } @@ -3975,6 +3977,7 @@ static void update_callback(struct diff_queue_struct *q, data->add_errors++; } break; + } case DIFF_STATUS_DELETED: if (data->flags & ADD_CACHE_IGNORE_REMOVAL) break; From 399a153b9563ec2ce3cf1ceebda2004c13e1dbe3 Mon Sep 17 00:00:00 2001 From: "Claus Schneider(Eficode)" Date: Wed, 15 Oct 2025 17:58:22 +0200 Subject: [PATCH 3/5] tests: add new t2206-add-submodule-ignored.sh to test ignore=all scenario The tests verify that the submodule behavior is intact and updating the config with ignore=all also behaves as intended with configuration in .gitmodules and configuration given on the command line. The usage of --include_ignored_submodules is showcased and tested in the test suite. The test file is added to meson.build for execution. Signed-off-by: Claus Schneider(Eficode) --- t/meson.build | 1 + t/t2206-add-submodule-ignored.sh | 134 +++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100755 t/t2206-add-submodule-ignored.sh diff --git a/t/meson.build b/t/meson.build index 983245501ce9a2..49e29ae82fc860 100644 --- a/t/meson.build +++ b/t/meson.build @@ -282,6 +282,7 @@ integration_tests = [ 't2203-add-intent.sh', 't2204-add-ignored.sh', 't2205-add-worktree-config.sh', + 't2206-add-submodule-ignored.sh', 't2300-cd-to-toplevel.sh', 't2400-worktree-add.sh', 't2401-worktree-prune.sh', diff --git a/t/t2206-add-submodule-ignored.sh b/t/t2206-add-submodule-ignored.sh new file mode 100755 index 00000000000000..2c8a5236411c4b --- /dev/null +++ b/t/t2206-add-submodule-ignored.sh @@ -0,0 +1,134 @@ +#!/bin/sh +# shellcheck disable=SC2016 + +# shellcheck disable=SC2034 +test_description='git add respects submodule ignore=all and explicit pathspec' + +# This test covers the behavior of "git add", "git status" and "git log" when +# dealing with submodules that have the ignore=all setting in +# .gitmodules. It ensures that changes in such submodules are +# ignored by default, but can be staged with "git add --include-ignored-submodules". + +# shellcheck disable=SC1091 +. ./test-lib.sh + +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + +base_path=$(pwd -P) + +#1 +test_expect_success 'setup: create origin repos' ' + cd "${base_path}" && + git config --global protocol.file.allow always && + git init sub && + pwd && + cd sub && + test_commit sub_file1 && + git tag v1.0 && + test_commit sub_file2 && + git tag v2.0 && + test_commit sub_file3 && + git tag v3.0 && + cd "${base_path}" && + git init main && + cd main && + test_commit first && + cd "${base_path}" +' +#2 +# add submodule with default config (ignore=none) and +# check log that is contains a path entry for the submodule 'sub' +# change the commit in the submodule and check that 'git status' shows it as modified +test_expect_success 'main: add submodule with default config' ' + cd "${base_path}" && + cd main && + git submodule add ../sub && + git commit -m "add submodule" && + git log --oneline --name-only | grep "^sub$" && + git -C sub reset --hard v2.0 && + git status --porcelain | grep "^ M sub$" && + echo +' +#3 +# change the submodule config to ignore=all and check that status and log do not show changes +test_expect_success 'main: submodule config ignore=all' ' + cd "${base_path}" && + cd main && + git config -f .gitmodules submodule.sub.ignore all && + GIT_TRACE=1 git add . && + git commit -m "update submodule config sub.ignore all" && + ! git status --porcelain | grep "^.*$" && + ! git log --oneline --name-only | grep "^sub$" && + echo +' +#4 +# change the commit in the submodule and check that 'git status' does not show it as modified +# but 'git status --ignore-submodules=none' does show it as modified +test_expect_success 'sub: change to different sha1 and check status in main' ' + cd "${base_path}" && + cd main && + git -C sub reset --hard v1.0 && + ! git status --porcelain | grep "^ M sub$" && + git status --ignore-submodules=none --porcelain | grep "^ M sub$" && + echo +' + +#5 +# check that normal 'git add' does not stage the change in the submodule +test_expect_success 'main: check normal add and status' ' + cd "${base_path}" && + cd main && + GIT_TRACE=1 git add . && + ! git status --porcelain | grep "^ M sub$" && + echo +' + +#6 +# check that 'git add --include-ignored-submodules .' does not stage the change in the submodule +# and that 'git status' does not show it as modified +test_expect_success 'main: check --include-ignored-submodules add . and status' ' + cd "${base_path}" && + cd main && + GIT_TRACE=1 git add --include-ignored-submodules . && + ! git status --porcelain | grep "^M sub$" && + echo +' + +#7 +# check that 'git add .' does not stage the change in the submodule +# and that 'git status' does not show it as modified +test_expect_success 'main: check _add sub_ and status' ' + cd "${base_path}" && + cd main && + GIT_TRACE=1 git add sub | grep "Skipping submodule due to ignore=all: sub" && + ! git status --porcelain | grep "^M sub$" && + echo +' + +#8 +# check that 'git add --include-ignored-submodules sub' does stage the change in the submodule +# check that 'git add --include-ignored-submodules ./sub/' does stage the change in the submodule +# and that 'git status --porcelain' does show it as modified +# commit it.. +# check that 'git log --ignore-submodules=none' shows the submodule change +# in the log +test_expect_success 'main: check force add sub and ./sub/ and status' ' + cd "${base_path}" && + cd main && + echo "Adding with --include-ignored-submodules should work: git add --include-ignored-submodules sub" && + GIT_TRACE=1 git add --include-ignored-submodules sub && + git status --porcelain | grep "^M sub$" && + git restore --staged sub && + ! git status --porcelain | grep "^M sub$" && + echo "Adding with --include-ignored-submodules should work: git add --include-ignored-submodules ./sub/" && + GIT_TRACE=1 git add --include-ignored-submodules ./sub/ && + git status --porcelain | grep "^M sub$" && + git commit -m "update submodule pointer" && + ! git status --porcelain | grep "^ M sub$" && + git log --ignore-submodules=none --name-only --oneline | grep "^sub$" && + echo +' + +test_done +exit 0 From 93c95954f1fad9d52489798b7f9da0c94f92f79a Mon Sep 17 00:00:00 2001 From: "Claus Schneider(Eficode)" Date: Thu, 16 Oct 2025 23:21:16 +0200 Subject: [PATCH 4/5] tests: fix existing tests when add an ignore=all submodule There are tests that rely on "git add " to add updates in the parent repository. A new option --include-ignored-submodules is introduced as it is now needed with this enhancement. Updated tests: - t1013-read-tree-submodule.sh ( fixed in: t/lib-submodule-update.sh ) - t2013-checkout-submodule.sh ( fixed in: t/lib-submodule-update.sh ) - t7406-submodule-update.sh - t7508-status.sh Signed-off-by: Claus Schneider(Eficode) --- t/lib-submodule-update.sh | 6 +++--- t/t7508-status.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 36f767cb7488bf..fde5dbee0218b0 100644 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -95,14 +95,14 @@ create_lib_submodule_repo () { git commit -m "modified file2 and added file3" && git push origin modifications ) && - git add sub1 && + git add --include-ignored-submodules sub1 && git commit -m "Modify sub1" && git checkout -b add_nested_sub modify_sub1 && git -C sub1 checkout -b "add_nested_sub" && git -C sub1 submodule add --branch no_submodule ../submodule_update_sub2 sub2 && git -C sub1 commit -a -m "add a nested submodule" && - git add sub1 && + git add --include-ignored-submodules sub1 && git commit -a -m "update submodule, that updates a nested submodule" && git checkout -b modify_sub1_recursively && git -C sub1 checkout -b modify_sub1_recursively && @@ -112,7 +112,7 @@ create_lib_submodule_repo () { git -C sub1/sub2 commit -m "make a change in nested sub" && git -C sub1 add sub2 && git -C sub1 commit -m "update nested sub" && - git add sub1 && + git add --include-ignored-submodules sub1 && git commit -m "update sub1, that updates nested sub" && git -C sub1 push origin modify_sub1_recursively && git -C sub1/sub2 push origin modify_sub1_recursively && diff --git a/t/t7508-status.sh b/t/t7508-status.sh index cdc1d6fcc78f49..5c8ffed21bc923 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -1565,7 +1565,7 @@ test_expect_success 'git commit will commit a staged but ignored submodule' ' test_expect_success 'git commit --dry-run will show a staged but ignored submodule' ' git reset HEAD^ && - git add sm && + git add --include-ignored-submodules sm && cat >expect << EOF && On branch main Your branch and '\''upstream'\'' have diverged, From ee84190cd899a3954095bf7263744704bfa4fa85 Mon Sep 17 00:00:00 2001 From: "Claus Schneider(Eficode)" Date: Wed, 15 Oct 2025 18:03:38 +0200 Subject: [PATCH 5/5] Documentation: add --include_ignored_submodules + ignore=all config - git-add.adoc: Add new documentation for --include_ignored_submodules option to supress ignore=all and new submodule functionality of not adding a ignore=all submodule by default. - gitmodules.adoc and config/submodule.adoc: The submodule config ignore=all now need --include_ignored_submodules in order to update the index. Signed-off-by: Claus Schneider(Eficode) --- .devcontainer/Dockerfile | 70 ++++++++++++++++++++++++++ .devcontainer/Dockerfile.standalone | 76 +++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 25 ++++++++++ Documentation/config/submodule.adoc | 13 ++--- Documentation/git-add.adoc | 5 ++ Documentation/gitmodules.adoc | 5 +- 6 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/Dockerfile.standalone create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000000..680ca5f3ad9e47 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,70 @@ +FROM ubuntu:latest + +ARG USER_ID +ARG GROUP_ID + +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Copenhagen + +RUN apt-get update \ + && \ + apt-get install -y \ + sudo \ + build-essential \ + libcurl4-gnutls-dev \ + libexpat1-dev \ + gettext \ + libz-dev \ + libssl-dev \ + asciidoc \ + xmlto \ + docbook-xsl \ + \ + tzdata \ + git \ + coccinelle \ + && \ + ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \ + && \ + dpkg-reconfigure --frontend noninteractive tzdata + +RUN apt-get update && apt-get install -y autoconf + +RUN addgroup -gid 1001 gituser +RUN adduser --disabled-password -u 1001 -gid 1001 gituser +RUN usermod -aG sudo gituser +RUN echo 'gituser ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/010-gituser +RUN chmod 0440 /etc/sudoers.d/010-gituser + +USER 1001 + +#WORKDIR /home/gituser/git-src/ + +#RUN make configure +#RUN ./configure --prefix=${HOME}/.local/ + +#RUN make -j$(nproc) gitweb || make gitweb +#RUN make install-gitweb + +#RUN make -j$(nproc) || make +#RUN make -j$(nproc) gitweb || make gitweb +#RUN make install-gitweb +#RUN make -j$(nproc) NO_PERL=YesPlease install || make NO_PERL=YesPlease install +#RUN make install + + +RUN mkdir -p ${HOME}/.local/ +#RUN ls -la ${HOME}/.local/bin +#ENV PATH="/home/gituser/.local/bin:${PATH}" +#RUN ls -l $HOME/.local/bin +#RUN echo $PATH $HOME + +#RUN git --version +#RUN which git + +RUN git config --global user.email "gituser@example.com" +RUN git config --global user.name "Git User" + +#WORKDIR /home/gituser/git-test/ + +#CMD [ "git" ] diff --git a/.devcontainer/Dockerfile.standalone b/.devcontainer/Dockerfile.standalone new file mode 100644 index 00000000000000..39bda42c0e12e5 --- /dev/null +++ b/.devcontainer/Dockerfile.standalone @@ -0,0 +1,76 @@ +FROM ubuntu:latest + +ARG USER_ID +ARG GROUP_ID + +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Copenhagen + +RUN apt-get update \ + && \ + apt-get install -y \ + build-essential \ + libcurl4-gnutls-dev \ + libexpat1-dev \ + gettext \ + libz-dev \ + libssl-dev \ + asciidoc \ + xmlto \ + docbook-xsl \ + \ + tzdata \ + \ + nano \ + vim \ + && \ + ln -fs /usr/share/zoneinfo/$TZ /etc/localtime \ + && \ + dpkg-reconfigure --frontend noninteractive tzdata + +RUN apt-get update && apt-get install -y autoconf + +RUN addgroup -gid ${GROUP_ID} gituser +RUN adduser --disabled-password -u ${USER_ID} -gid ${GROUP_ID} gituser + + +COPY --chown=${USER_ID}:${GROUP_ID} ./git /home/gituser/git-src/ + +USER ${USER_ID} + +WORKDIR /home/gituser/git-src/ + +RUN make configure +RUN ./configure --prefix=${HOME}/.local/ + +#RUN make -j$(nproc) gitweb || make gitweb +#RUN make install-gitweb + +#RUN make -j$(nproc) || make +#RUN make -j$(nproc) gitweb || make gitweb +#RUN make install-gitweb +RUN make -j$(nproc) NO_PERL=YesPlease install || make NO_PERL=YesPlease install +RUN make install + +WORKDIR /home/gituser/git-src/t +RUN ./t2206-add-submodule-ignored.sh -v + +RUN ls -la ${HOME}/.local/ +RUN ls -la ${HOME}/.local/bin +ENV PATH="/home/gituser/.local/bin:${PATH}" +RUN ls -l $HOME/.local/bin +RUN echo $PATH $HOME + +RUN git --version +RUN which git + +RUN git config --global user.email "gituser@example.com" +RUN git config --global user.name "Git User" + +WORKDIR /home/gituser/git-src/t +RUN pwd && ls -la +RUN ./t2206-add-submodule-ignored.sh -v + +WORKDIR /home/gituser/git-test/ + +CMD [ "git" ] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000000..2bc13902d89406 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "Git Dev Container", + "build": { + "dockerfile": "Dockerfile", + "context": "", + "args": { + "user_id": "1001", + "group_id": "1001" + } + }, + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } + } + }, + "remoteUser": "gituser", + "features": {}, + "mounts": [ + "source=${localWorkspaceFolder}/,target=/home/gitusers/git-src,type=bind,consistency=cached", + "source=${localWorkspaceFolder}/,target=/home/gitusers/git-test,type=bind,consistency=cached" + ], + "postCreateCommand": "echo" +} diff --git a/Documentation/config/submodule.adoc b/Documentation/config/submodule.adoc index 0672d9911724d1..0753adbab51160 100644 --- a/Documentation/config/submodule.adoc +++ b/Documentation/config/submodule.adoc @@ -32,15 +32,16 @@ submodule..fetchRecurseSubmodules:: submodule..ignore:: Defines under what circumstances "git status" and the diff family show - a submodule as modified. When set to "all", it will never be considered - modified (but it will nonetheless show up in the output of status and - commit when it has been staged), "dirty" will ignore all changes - to the submodule's work tree and + a submodule as modified. + Set to "all" will never considered the submodule modified. It can + nevertheless be staged using the option --include_ignored_submodules and + it will then show up in the output of status. + Set to "dirty" will ignore all changes to the submodule's work tree and takes only differences between the HEAD of the submodule and the commit recorded in the superproject into account. "untracked" will additionally let submodules with modified tracked files in their work tree show up. - Using "none" (the default when this option is not set) also shows - submodules that have untracked files in their work tree as changed. + Set to "none"(default) It is also shows submodules that have untracked + files in their work tree as changed. This setting overrides any setting made in .gitmodules for this submodule, both settings can be overridden on the command line by using the "--ignore-submodules" option. The 'git submodule' commands are not diff --git a/Documentation/git-add.adoc b/Documentation/git-add.adoc index b7a735824d6ce0..ab72fad6518446 100644 --- a/Documentation/git-add.adoc +++ b/Documentation/git-add.adoc @@ -79,6 +79,11 @@ in linkgit:gitglossary[7]. `--force`:: Allow adding otherwise ignored files. +`--include_ignored_submodules`:: + The option is also used when `submodule..ignore=all` + is set, but you want to stage an update of the submodule. The + `path` to the submodule must be explicitly specified. + `--sparse`:: Allow updating index entries outside of the sparse-checkout cone. Normally, `git add` refuses to update index entries whose paths do diff --git a/Documentation/gitmodules.adoc b/Documentation/gitmodules.adoc index d9bec8b1875502..ea1fd377e62697 100644 --- a/Documentation/gitmodules.adoc +++ b/Documentation/gitmodules.adoc @@ -70,7 +70,10 @@ submodule..ignore:: -- all;; The submodule will never be considered modified (but will nonetheless show up in the output of status and commit when it has - been staged). + been staged). Add `(new commits)` can be overruled using the + `git add --include_ignored_submodules ` + The setting affects `status`, `update-index`, `diff` and `log`(due + to underlaying `diff`). dirty;; All changes to the submodule's work tree will be ignored, only committed differences between the `HEAD` of the submodule and its