{"thread":{"id":"24196","subject":"[RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option","startedAt":"2010-06-25T14:55:07Z","lastAt":"2010-06-28T19:55:30Z","messageCount":12,"participants":["Jens Lehmann","Junio C Hamano","Jonathan Nieder","Tay Ray Chuan","Marc Branchaud"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"144247","messageId":"4C24C34B.20403@web.de","threadId":"24196","inReplyTo":null,"subject":"[RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-25T14:55:07Z","receivedAt":"2010-06-25T14:55:07Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The first patch in this series lets \"git submodule summary\" and \"git\nsubmodule status\" ignore dirty submodules. I thought about teaching\nthem a \"--ignore\" option too, but didn't for two reasons: First, the\noutput of those commands is pretty much focused on commits. Second,\nwhen using \"git status\" with the config option 'status.submodulesummary'\nthe submodule tree is scanned twice, once for \"git status\" and then\nagain for \"git submodule summary\". With this patch the second run is\ngone, which is a big gain for users of 'status.submodulesummary' with\nlarge submodules.\n\nThe second patch teaches \"git status\" the same \"--ignore-submodules\"\noption that \"git diff\" recently learned. Ignoring all changes also\nsuppresses the output of \"git submodule summary\" when\n'status.submodulesummary' is set.\n\nAfter this series I am planning to add a config option 'ignore' to\n.gitmodules, which can be set for each submodule to either \"all\",\n\"dirty\", \"untracked\" or \"none\" (the default). \"git diff\" and \"git\nstatus\" will use that config value for each submodule. Using\n\"--ignore-submodule\" overrides this default (and the new parameter\n\"none\" will be added there to able to override the config settings).\nAnd to avoid having to do \"git submdule sync\" every time that option\nchanges, I would like to search for it in .git/config first. If it\nis not found there, it will be taken from .gitmodules, if present.\nSo users can override the setting but if they don't, upstream can\nchange it easily (e.g. when a submodules .gitignore has been updated\nso that \"ignore=untracked\" is no longer necessary anymore it can be\nremoved). Also switching branches will have an effect instantly if\nthe 'ignore' entry in .gitmodules is different between branches.\n\n\nOpinions?\n\n\nJens Lehmann (2):\n  git submodule: ignore dirty submodules for summary and status\n  Add the option \"--ignore-submodules\" to \"git status\"\n\n Documentation/git-status.txt |   11 ++++\n builtin/commit.c             |    7 ++-\n diff.c                       |   15 +----\n git-submodule.sh             |    6 +-\n submodule.c                  |   13 ++++\n submodule.h                  |    3 +\n t/t7508-status.sh            |  127 ++++++++++++++++++++++++++++++++++++++++++\n wt-status.c                  |   10 +++-\n wt-status.h                  |    1 +\n 9 files changed, 177 insertions(+), 16 deletions(-)\n\n-- \n1.7.1.757.g0ad3c.dirty\n"},{"id":"144248","messageId":"4C24C382.6030900@web.de","threadId":"24196","inReplyTo":"4C24C34B.20403@web.de","subject":"[PATCH 1/2] git submodule: ignore dirty submodules for summary and status","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-25T14:56:02Z","receivedAt":"2010-06-25T14:56:02Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The summary and status commands only care about submodule commits, so it is\nrather pointless that they check for dirty work trees. This saves the time\nneeded to scan the submodules work tree. Even \"git status\" profits from these\nsavings when the status.submodulesummary config option is set, as this lead to\ntraversing the submodule work trees twice, once for status and once again for\nthe submodule summary. And if the submodule was just dirty, submodule summary\nproduced rather meaningless output anyway:\n\n * sub 1234567...1234567 (0):\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-submodule.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 8c562a7..d9950c2 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -580,7 +580,7 @@ cmd_summary() {\n\n \tcd_to_toplevel\n \t# Get modified modules cared by user\n-\tmodules=$(git $diff_cmd $cached --raw $head -- \"$@\" |\n+\tmodules=$(git $diff_cmd $cached --ignore-submodules=dirty --raw $head -- \"$@\" |\n \t\tsane_egrep '^:([0-7]* )?160000' |\n \t\twhile read mod_src mod_dst sha1_src sha1_dst status name\n \t\tdo\n@@ -594,7 +594,7 @@ cmd_summary() {\n\n \ttest -z \"$modules\" && return\n\n-\tgit $diff_cmd $cached --raw $head -- $modules |\n+\tgit $diff_cmd $cached --ignore-submodules=dirty --raw $head -- $modules |\n \tsane_egrep '^:([0-7]* )?160000' |\n \tcut -c2- |\n \twhile read mod_src mod_dst sha1_src sha1_dst status name\n@@ -760,7 +760,7 @@ cmd_status()\n \t\t\tcontinue;\n \t\tfi\n \t\tset_name_rev \"$path\" \"$sha1\"\n-\t\tif git diff-files --quiet -- \"$path\"\n+\t\tif git diff-files --ignore-submodules=dirty --quiet -- \"$path\"\n \t\tthen\n \t\t\tsay \" $sha1 $displaypath$revname\"\n \t\telse\n-- \n1.7.1.757.g0ad3c.dirty\n"},{"id":"144249","messageId":"4C24C3AF.8000800@web.de","threadId":"24196","inReplyTo":"4C24C34B.20403@web.de","subject":"[PATCH 2/2] Add the option \"--ignore-submodules\" to \"git status\"","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-25T14:56:47Z","receivedAt":"2010-06-25T14:56:47Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"In some use cases it is not desirable that \"git status\" considers\nsubmodules that only contain untracked content as dirty. This may happen\ne.g. when the submodule is not under the developers control and not all\nbuild generated files have been added to .gitignore by the upstream\ndevelopers. Using the \"untracked\" parameter for the \"--ignore-submodules\"\noption disables checking for untracked content and lets git diff report\nthem as changed only when they have new commits or modified content.\n\nSometimes it is not wanted to have submodules show up as changed when they\njust contain changes to their work tree (this was the behavior before\n1.7.0). An example for that are scripts which just want to check for\nsubmodule commits while ignoring any changes to the work tree. Also users\nhaving large submodules known not to change might want to use this option,\nas the - sometimes substantial - time it takes to scan the submodule work\ntree(s) is saved when using the \"dirty\" parameter.\n\nAnd if you want to ignore any changes to submodules, you can now do that\nby using this option without parameters or with \"all\" (when the config\noption status.submodulesummary is set, using \"all\" will also suppress the\noutput of the submodule summary).\n\nA new function handle_ignore_submodules_arg() is introduced to parse this\noption new to \"git status\" in a single location, as \"git diff\" already\nknew it.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n Documentation/git-status.txt |   11 ++++\n builtin/commit.c             |    7 ++-\n diff.c                       |   15 +----\n submodule.c                  |   13 ++++\n submodule.h                  |    3 +\n t/t7508-status.sh            |  127 ++++++++++++++++++++++++++++++++++++++++++\n wt-status.c                  |   10 +++-\n wt-status.h                  |    1 +\n 8 files changed, 174 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-status.txt b/Documentation/git-status.txt\nindex fd0fe7c..2fd054c 100644\n--- a/Documentation/git-status.txt\n+++ b/Documentation/git-status.txt\n@@ -53,6 +53,17 @@ See linkgit:git-config[1] for configuration variable\n used to change the default for when the option is not\n specified.\n\n+--ignore-submodules[=<when>]::\n+\tIgnore changes to submodules when looking for changes. <when> can be\n+\teither \"untracked\", \"dirty\" or \"all\", which is the default. When\n+\t\"untracked\" is used submodules are not considered dirty when they only\n+\tcontain untracked content (but they are still scanned for modified\n+\tcontent). Using \"dirty\" ignores all changes to the work tree of submodules,\n+\tonly changes to the commits stored in the superproject are shown (this was\n+\tthe behavior before 1.7.0). Using \"all\" hides all changes to submodules\n+\t(and suppresses the output of submodule summaries when the config option\n+\t`status.submodulesummary` is set).\n+\n -z::\n \tTerminate entries with NUL, instead of LF.  This implies\n \tthe `--porcelain` output format if no other format is given.\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 3d99cf9..bd547f2 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -72,7 +72,7 @@ static char *author_name, *author_email, *author_date;\n static int all, edit_flag, also, interactive, only, amend, signoff;\n static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;\n static int no_post_rewrite, allow_empty_message;\n-static char *untracked_files_arg, *force_date;\n+static char *untracked_files_arg, *force_date, *ignore_submodule_arg;\n /*\n  * The default commit message cleanup mode will remove the lines\n  * beginning with # (shell comments) and leading and trailing\n@@ -1059,6 +1059,9 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \t\t  PARSE_OPT_OPTARG, NULL, (intptr_t)\"all\" },\n \t\tOPT_BOOLEAN(0, \"ignored\", &show_ignored_in_status,\n \t\t\t    \"show ignored files\"),\n+\t\t{ OPTION_STRING, 0, \"ignore-submodules\", &ignore_submodule_arg, \"when\",\n+\t\t  \"ignore changes to submodules, optional when: all, dirty, untracked. (Default: all)\",\n+\t\t  PARSE_OPT_OPTARG, NULL, (intptr_t)\"all\" },\n \t\tOPT_END(),\n \t};\n\n@@ -1089,6 +1092,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n\n \ts.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;\n \ts.in_merge = in_merge;\n+\ts.ignore_submodule_arg = ignore_submodule_arg;\n \twt_status_collect(&s);\n\n \tif (s.relative_paths)\n@@ -1107,6 +1111,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n \t\tbreak;\n \tcase STATUS_FORMAT_LONG:\n \t\ts.verbose = verbose;\n+\t\ts.ignore_submodule_arg = ignore_submodule_arg;\n \t\twt_status_print(&s);\n \t\tbreak;\n \t}\ndiff --git a/diff.c b/diff.c\nindex 9d70f9d..3aa695d 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3168,17 +3168,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \telse if (!strcmp(arg, \"--no-textconv\"))\n \t\tDIFF_OPT_CLR(options, ALLOW_TEXTCONV);\n \telse if (!strcmp(arg, \"--ignore-submodules\"))\n-\t\tDIFF_OPT_SET(options, IGNORE_SUBMODULES);\n-\telse if (!prefixcmp(arg, \"--ignore-submodules=\")) {\n-\t\tif (!strcmp(arg + 20, \"all\"))\n-\t\t\tDIFF_OPT_SET(options, IGNORE_SUBMODULES);\n-\t\telse if (!strcmp(arg + 20, \"untracked\"))\n-\t\t\tDIFF_OPT_SET(options, IGNORE_UNTRACKED_IN_SUBMODULES);\n-\t\telse if (!strcmp(arg + 20, \"dirty\"))\n-\t\t\tDIFF_OPT_SET(options, IGNORE_DIRTY_SUBMODULES);\n-\t\telse\n-\t\t\tdie(\"bad --ignore-submodules argument: %s\", arg + 20);\n-\t} else if (!strcmp(arg, \"--submodule\"))\n+\t\thandle_ignore_submodules_arg(options, \"all\");\n+\telse if (!prefixcmp(arg, \"--ignore-submodules=\"))\n+\t\thandle_ignore_submodules_arg(options, arg + 20);\n+\telse if (!strcmp(arg, \"--submodule\"))\n \t\tDIFF_OPT_SET(options, SUBMODULE_LOG);\n \telse if (!prefixcmp(arg, \"--submodule=\")) {\n \t\tif (!strcmp(arg + 12, \"log\"))\ndiff --git a/submodule.c b/submodule.c\nindex 676d48f..61cb6e2 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -46,6 +46,19 @@ done:\n \treturn ret;\n }\n\n+void handle_ignore_submodules_arg(struct diff_options *diffopt,\n+\t\t\t\t  const char *arg)\n+{\n+\tif (!strcmp(arg, \"all\"))\n+\t\tDIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);\n+\telse if (!strcmp(arg, \"untracked\"))\n+\t\tDIFF_OPT_SET(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);\n+\telse if (!strcmp(arg, \"dirty\"))\n+\t\tDIFF_OPT_SET(diffopt, IGNORE_DIRTY_SUBMODULES);\n+\telse\n+\t\tdie(\"bad --ignore-submodules argument: %s\", arg);\n+}\n+\n void show_submodule_summary(FILE *f, const char *path,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule,\ndiff --git a/submodule.h b/submodule.h\nindex dbda270..6fd3bb4 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -1,6 +1,9 @@\n #ifndef SUBMODULE_H\n #define SUBMODULE_H\n\n+struct diff_options;\n+\n+void handle_ignore_submodules_arg(struct diff_options *diffopt, const char *);\n void show_submodule_summary(FILE *f, const char *path,\n \t\tunsigned char one[20], unsigned char two[20],\n \t\tunsigned dirty_submodule,\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex 9e08107..a72fe3a 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -808,4 +808,131 @@ test_expect_success POSIXPERM 'status succeeds in a read-only repository' '\n \t(exit $status)\n '\n\n+cat > expect << EOF\n+# On branch master\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+no changes added to commit (use \"git add\" and/or \"git commit -a\")\n+EOF\n+\n+test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '\n+\techo modified > sm/untracked &&\n+\tgit status --ignore-submodules=untracked > output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '\n+\tgit status --ignore-submodules=dirty > output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '\n+\techo modified > sm/foo &&\n+\tgit status --ignore-submodules=dirty > output &&\n+\ttest_cmp expect output\n+'\n+\n+cat > expect << EOF\n+# On branch master\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+#   (commit or discard the untracked or modified content in submodules)\n+#\n+#\tmodified:   dir1/modified\n+#\tmodified:   sm (modified content)\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+no changes added to commit (use \"git add\" and/or \"git commit -a\")\n+EOF\n+\n+test_expect_success \"--ignore-submodules=untracked doesn't suppress submodules with modified content\" '\n+\tgit status --ignore-submodules=untracked > output &&\n+\ttest_cmp expect output\n+'\n+\n+head2=$(cd sm && git commit -q -m \"2nd commit\" foo && git rev-parse --short=7 --verify HEAD)\n+\n+cat > expect << EOF\n+# On branch master\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+#\n+#\tmodified:   dir1/modified\n+#\tmodified:   sm (new commits)\n+#\n+# Submodules changed but not updated:\n+#\n+# * sm $head...$head2 (1):\n+#   > 2nd commit\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+no changes added to commit (use \"git add\" and/or \"git commit -a\")\n+EOF\n+\n+test_expect_success \"--ignore-submodules=untracked doesn't suppress submodule summary\" '\n+\tgit status --ignore-submodules=untracked > output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success \"--ignore-submodules=dirty doesn't suppress submodule summary\" '\n+\tgit status --ignore-submodules=dirty > output &&\n+\ttest_cmp expect output\n+'\n+\n+cat > expect << EOF\n+# On branch master\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\texpect\n+#\toutput\n+#\tuntracked\n+no changes added to commit (use \"git add\" and/or \"git commit -a\")\n+EOF\n+\n+test_expect_success \"--ignore-submodules=all suppresses submodule summary\" '\n+\tgit status --ignore-submodules=all > output &&\n+\ttest_cmp expect output\n+'\n+\n test_done\ndiff --git a/wt-status.c b/wt-status.c\nindex 9d9cb95..373213e 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -10,6 +10,7 @@\n #include \"run-command.h\"\n #include \"remote.h\"\n #include \"refs.h\"\n+#include \"submodule.h\"\n\n static char default_wt_status_colors[][COLOR_MAXLEN] = {\n \tGIT_COLOR_NORMAL, /* WT_STATUS_HEADER */\n@@ -312,6 +313,8 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)\n \tDIFF_OPT_SET(&rev.diffopt, DIRTY_SUBMODULES);\n \tif (!s->show_untracked_files)\n \t\tDIFF_OPT_SET(&rev.diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);\n+\tif (s->ignore_submodule_arg)\n+\t\thandle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);\n \trev.diffopt.format_callback = wt_status_collect_changed_cb;\n \trev.diffopt.format_callback_data = s;\n \trev.prune_data = s->pathspec;\n@@ -328,6 +331,9 @@ static void wt_status_collect_changes_index(struct wt_status *s)\n \topt.def = s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference;\n \tsetup_revisions(0, NULL, &rev, &opt);\n\n+\tif (s->ignore_submodule_arg)\n+\t\thandle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg);\n+\n \trev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;\n \trev.diffopt.format_callback = wt_status_collect_updated_cb;\n \trev.diffopt.format_callback_data = s;\n@@ -646,7 +652,9 @@ void wt_status_print(struct wt_status *s)\n \twt_status_print_updated(s);\n \twt_status_print_unmerged(s);\n \twt_status_print_changed(s);\n-\tif (s->submodule_summary) {\n+\tif (s->submodule_summary &&\n+\t    (!s->ignore_submodule_arg ||\n+\t     strcmp(s->ignore_submodule_arg, \"all\"))) {\n \t\twt_status_print_submodule_summary(s, 0);  /* staged */\n \t\twt_status_print_submodule_summary(s, 1);  /* unstaged */\n \t}\ndiff --git a/wt-status.h b/wt-status.h\nindex 4cd74c4..9df9c9f 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -45,6 +45,7 @@ struct wt_status {\n \tint submodule_summary;\n \tint show_ignored_files;\n \tenum untracked_status_type show_untracked_files;\n+\tconst char *ignore_submodule_arg;\n \tchar color_palette[WT_STATUS_REMOTE_BRANCH+1][COLOR_MAXLEN];\n\n \t/* These are computed during processing of the individual sections */\n-- \n1.7.1.757.g0ad3c.dirty\n"},{"id":"144260","messageId":"7vlja3j7hu.fsf@alter.siamese.dyndns.org","threadId":"24196","inReplyTo":"4C24C34B.20403@web.de","subject":"Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-25T18:24:13Z","receivedAt":"2010-06-25T18:24:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> The first patch in this series lets \"git submodule summary\" and \"git\n> submodule status\" ignore dirty submodules. I thought about teaching\n> them a \"--ignore\" option too, but didn't for two reasons: First, the\n> output of those commands is pretty much focused on commits. Second,\n> when using \"git status\" with the config option 'status.submodulesummary'\n> the submodule tree is scanned twice, once for \"git status\" and then\n> again for \"git submodule summary\". With this patch the second run is\n> gone, which is a big gain for users of 'status.submodulesummary' with\n> large submodules.\n>\n> The second patch teaches \"git status\" the same \"--ignore-submodules\"\n> option that \"git diff\" recently learned. Ignoring all changes also\n> suppresses the output of \"git submodule summary\" when\n> 'status.submodulesummary' is set.\n>\n> After this series I am planning to add a config option 'ignore' to\n> .gitmodules, which can be set for each submodule to either \"all\",\n> \"dirty\", \"untracked\" or \"none\" (the default). \"git diff\" and \"git\n> status\" will use that config value for each submodule. Using\n> \"--ignore-submodule\" overrides this default (and the new parameter\n> \"none\" will be added there to able to override the config settings).\n> And to avoid having to do \"git submdule sync\" every time that option\n> changes, I would like to search for it in .git/config first. If it\n> is not found there, it will be taken from .gitmodules, if present.\n> So users can override the setting but if they don't, upstream can\n> change it easily (e.g. when a submodules .gitignore has been updated\n> so that \"ignore=untracked\" is no longer necessary anymore it can be\n> removed). Also switching branches will have an effect instantly if\n> the 'ignore' entry in .gitmodules is different between branches.\n>\n> Opinions?\n\nI think both patches make sense.  It would be reassuring to hear from\npeople who are heavier submodule users than me, though...\n\nThanks.\n"},{"id":"144261","messageId":"20100625190147.GA17493@burratino","threadId":"24196","inReplyTo":"7vlja3j7hu.fsf@alter.siamese.dyndns.org","subject":"git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-06-25T19:01:47Z","receivedAt":"2010-06-25T19:01:47Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> It would be reassuring to hear from\n> people who are heavier submodule users than me, though...\n\nSpeaking of which, what ever came of the submodule dogfood experiment?\nGiven a patch to automatically resolve submodule-ejection/subtree-merge\nconflicts, do you think a patch series to split off gitk and git-gui\nas submodules could live in pu eventually?\n\nJonathan\n"},{"id":"144283","messageId":"AANLkTimqXhGw5fAAgZsoDAI9s6kaIzcka9mbFEW8j05v@mail.gmail.com","threadId":"24196","inReplyTo":"20100625190147.GA17493@burratino","subject":"Re: git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-06-26T04:44:13Z","receivedAt":"2010-06-26T04:44:13Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi,\n\nOn Sat, Jun 26, 2010 at 3:01 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Given a patch to automatically resolve submodule-ejection/subtree-merge\n> conflicts, do you think a patch series to split off gitk and git-gui\n> as submodules could live in pu eventually?\n\n+1\n\nThey do sound like they'd fit into the submodule paradigm. Further,\nhaving git use it would be a good showcase of the submodule feature -\nor bug. :)\n\n-- \nCheers,\nRay Chuan\n"},{"id":"144296","messageId":"4C25E83E.4080905@web.de","threadId":"24196","inReplyTo":"AANLkTimqXhGw5fAAgZsoDAI9s6kaIzcka9mbFEW8j05v@mail.gmail.com","subject":"Re: git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-26T11:45:02Z","receivedAt":"2010-06-26T11:45:02Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 26.06.2010 06:44, schrieb Tay Ray Chuan:\n> On Sat, Jun 26, 2010 at 3:01 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> Given a patch to automatically resolve submodule-ejection/subtree-merge\n>> conflicts, do you think a patch series to split off gitk and git-gui\n>> as submodules could live in pu eventually?\n> \n> +1\n> \n> They do sound like they'd fit into the submodule paradigm. Further,\n> having git use it would be a good showcase of the submodule feature -\n> or bug. :)\n\nYes, I think having them as a submodule makes lots of sense. But\nsubmodules are not there yet. Unless I overlooked something, the\nfollowing issues must be resolved before having these two as a\nsubmodule, otherwise people will complain (and rightfully so!):\n\n1) Switching branches, merging, rebasing and resetting in the\n   superproject must result in a checkout of the matching submodule\n   work tree (right now you always have to issue a \"git submodule\n   update\" afterwards to get the submodules in sync).\n\n2) On \"git clone\" the submodules must be cloned and checked out too\n   (currently you have to do a \"git submodule update --init\" after\n   cloning the superproject).\n\n3) Switching between commits in the superproject where a directory\n   is replaced by a submodule or vice versa doesn't work right now.\n   Submodules should handle this situation, otherwise the commit\n   putting gitk and git gui into submodules would become a barrier.\n\nI am working on these issues, but that will take some time. But when\nthey are solved, me too thinks that these two should become submodules.\n"},{"id":"144328","messageId":"20100626183154.GA13581@burratino","threadId":"24196","inReplyTo":"4C25E83E.4080905@web.de","subject":"Re: git-gui and gitk-git as submodules","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-06-26T18:31:54Z","receivedAt":"2010-06-26T18:31:54Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jens Lehmann wrote:\n\n> 1) Switching branches, merging, rebasing and resetting in the\n>    superproject must result in a checkout of the matching submodule\n>    work tree\n\nSwitching branches can change the HEAD commit of an already checked\nout submodule, and switching branches can change the list of\nsubmodules.\n\nFor the latter, maybe it would make sense to introduce ‘git checkout\n--recursive’ which runs ‘submodule update --init --recursive’ after\ncheckout.  IMHO, in git 2.0 this even ought to be made the default.\nOne could use --no-recursive to access the more flexible traditional\nbehavior.\n\n> 2) On \"git clone\" the submodules must be cloned and checked out too\n\nDoes ‘git clone --recursive’ take care of it?\n\nThe Makefile would need to be tweaked to give a reasonable message\nwhen the caller forgets to check out an important submodule.\n\n> 3) Switching between commits in the superproject where a directory\n>    is replaced by a submodule or vice versa doesn't work right now.\n>    Submodules should handle this situation, otherwise the commit\n>    putting gitk and git gui into submodules would become a barrier.\n\nYes, this is the fatal problem imho since it would affect basic\nmaintainance tasks.  I consider maintainance of the branch (rather\nthan consumption) the most important piece to begin with; for a branch\nnot in next, usability problems can be resolved over time.\n\n> I am working on these issues, but that will take some time. But when\n> they are solved, me too thinks that these two should become submodules.\n\nThanks for the explanation.\n"},{"id":"144402","messageId":"4C28EA0A.3080804@xiplink.com","threadId":"24196","inReplyTo":"4C25E83E.4080905@web.de","subject":"Re: git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2010-06-28T18:29:30Z","receivedAt":"2010-06-28T18:29:30Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"On 10-06-26 07:45 AM, Jens Lehmann wrote:\n> \n> Yes, I think having them as a submodule makes lots of sense. But\n> submodules are not there yet. Unless I overlooked something, the\n> following issues must be resolved before having these two as a\n> submodule, otherwise people will complain (and rightfully so!):\n\nI applaud all the current submodule work -- thanks a ton!\n\nI would like to ask submodule developers to please keep in mind scenarios\nwhere only a subset of the super-project's submodules are in use at one time.\n In particular, please avoid forcing any blanket updates to all submodules.\nI think the features being discussed would be much more useful if they only\napplied to submodules that are already initialized and updated by the user,\nand that any unintialized submodules should be left alone.\n\n> 1) Switching branches, merging, rebasing and resetting in the\n>    superproject must result in a checkout of the matching submodule\n>    work tree (right now you always have to issue a \"git submodule\n>    update\" afterwards to get the submodules in sync).\n\nSo, extending my request to this situation, I would say git should only\nupdate submodules that are already initialzied and updated.\n\n> 2) On \"git clone\" the submodules must be cloned and checked out too\n>    (currently you have to do a \"git submodule update --init\" after\n>    cloning the superproject).\n\nMaking clone do this automatically would be a show-stopper for us.  The\ncurrent '--recursive' option is fine (though we never use it).\n\nIt would be interesting if the super-project could configure which submodules\nto automatically clone.\n\n(FYI, our build works along the lines of what Jonathan suggested: it\ninstructs folks on how to obtain missing submodules.)\n\n\t\tM.\n"},{"id":"144404","messageId":"4C28F0E9.8080903@web.de","threadId":"24196","inReplyTo":"20100626183154.GA13581@burratino","subject":"Re: git-gui and gitk-git as submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-28T18:58:49Z","receivedAt":"2010-06-28T18:58:49Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 26.06.2010 20:31, schrieb Jonathan Nieder:\n> For the latter, maybe it would make sense to introduce ‘git checkout\n> --recursive’ which runs ‘submodule update --init --recursive’ after\n> checkout.  IMHO, in git 2.0 this even ought to be made the default.\n> One could use --no-recursive to access the more flexible traditional\n> behavior.\n\nYup, I am working on that (I did post a WIP patch some time ago where\nI added a '--ignore-submodules' option, but since then I changed my\nmind on the name and now too think that '--[no-]recursive' is a much\nbetter choice).\n"},{"id":"144406","messageId":"4C28F130.2090904@web.de","threadId":"24196","inReplyTo":"4C28EA0A.3080804@xiplink.com","subject":"Re: git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-06-28T19:00:00Z","receivedAt":"2010-06-28T19:00:00Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 28.06.2010 20:29, schrieb Marc Branchaud:\n> On 10-06-26 07:45 AM, Jens Lehmann wrote:\n> I applaud all the current submodule work -- thanks a ton!\n\nThanks for your feedback!\n\n\n> I would like to ask submodule developers to please keep in mind scenarios\n> where only a subset of the super-project's submodules are in use at one time.\n>  In particular, please avoid forcing any blanket updates to all submodules.\n> I think the features being discussed would be much more useful if they only\n> applied to submodules that are already initialized and updated by the user,\n> and that any unintialized submodules should be left alone.\n\nYes. I think we agreed some time ago that until the user can configure the\nwanted behavior only populated submodules should be touched, so I don't\nmention that explicitly anymore.\n\n\n>> 1) Switching branches, merging, rebasing and resetting in the\n>>    superproject must result in a checkout of the matching submodule\n>>    work tree (right now you always have to issue a \"git submodule\n>>    update\" afterwards to get the submodules in sync).\n> \n> So, extending my request to this situation, I would say git should only\n> update submodules that are already initialzied and updated.\n\nYes, see above.\n\n\n>> 2) On \"git clone\" the submodules must be cloned and checked out too\n>>    (currently you have to do a \"git submodule update --init\" after\n>>    cloning the superproject).\n> \n> Making clone do this automatically would be a show-stopper for us.  The\n> current '--recursive' option is fine (though we never use it).\n> \n> It would be interesting if the super-project could configure which submodules\n> to automatically clone.\n\nThat's what I have in mind too. Maybe we could use the 'update' option of\n.gitmodules to clone all those submodules where it is set. Then different\nbranches with different .gitmodules would behave differently.\n"},{"id":"144411","messageId":"4C28FE32.80901@xiplink.com","threadId":"24196","inReplyTo":"4C28F130.2090904@web.de","subject":"Re: git-gui and gitk-git as submodules (Re: [RFC PATCH 0/2] Teach \"git status\" the \"--ignore-submodules\" option)","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2010-06-28T19:55:30Z","receivedAt":"2010-06-28T19:55:30Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"On 10-06-28 03:00 PM, Jens Lehmann wrote:\n> \n>>> 2) On \"git clone\" the submodules must be cloned and checked out too\n>>>    (currently you have to do a \"git submodule update --init\" after\n>>>    cloning the superproject).\n>>\n>> Making clone do this automatically would be a show-stopper for us.  The\n>> current '--recursive' option is fine (though we never use it).\n>>\n>> It would be interesting if the super-project could configure which submodules\n>> to automatically clone.\n> \n> That's what I have in mind too. Maybe we could use the 'update' option of\n> .gitmodules to clone all those submodules where it is set. Then different\n> branches with different .gitmodules would behave differently.\n\nThat sounds fine to me.\n\nThanks again!\n\n\t\tM.\n"}]}