git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Outreachy][PATCH v6] diff: do not show submodule with untracked files as "-dirty"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 8, 2020, 21:02 UTC
Message-ID
<xmqqblf46mg8.fsf@gitster.c.googlers.com>
In-Reply-To
<CAHjREB7-QWHBOQQPdDdEM-gJm=w3+4D=N=5TaS3UE__6XnSpJA@mail.gmail.com>
Sangeeta <sangunb09@gmail.com> writes:
Show 42 quoted lines
> Hey,
>
> I worked on passing --ignore-submodules=none as the default behavior
> of git status so that the user doesn't end up deleting a submodule
> that has uncommitted (untracked) files.
>
> The following changes make git status pass the ignoreSubmodules none
> argument as default.
>
> @@ -4587,7 +4587,7 @@ void repo_diff_setup(struct repository *r,
> struct diff_options *options)
>         options->orderfile = diff_order_file_cfg;
>
>         if (!options->flags.ignore_submodule_set)
> -               handle_ignore_submodules_arg(options, "untracked");
> +               options->flags.ignore_untracked_in_submodules = 1;
>
>         if (diff_no_prefix) {
>                 options->a_prefix = options->b_prefix = "";
>
>
> @@ -607,6 +607,9 @@ static void
> wt_status_collect_changes_worktree(struct wt_status *s)
>                 rev.diffopt.flags.override_submodule_config = 1;
>                 handle_ignore_submodules_arg(&rev.diffopt,
> s->ignore_submodule_arg);
>         }
> +       else if(!rev.diffopt.flags.ignore_submodule_set){
> +               handle_ignore_submodules_arg(&rev.diffopt, "none");
> +       }
>
> I have had to set the flag manually in diff.c because when we call
> handle_ignore_submodules_arg() with "untracked" arg,
> options->flags.ignore_submodule_set is set to 1 and therefore when we
> check for it in wt-status.c it appears that user has already set some
> config and therefore we shouldn't add "none" as ignoreSubmodules arg.
>
> Another way to do that is to have one more flag in diff_options that
> can let us know whether options->flags.ignore_submodule_set was set by
> the user or by diff passing untracked as the default argument.
>
> Can someone please help me with what might be the right way to proceed?

Hmph, neither sounds "right"---having to circumvent the assignment to _set flag made in the handle_ helper by either manually setting the underlying flag, or by introducing another flag that stops from the _set flag getting updated, sounds like working around a flaw of the approach to use _set flag and set it in the handle_ helper in the first place...

Previous: SangeetaNext: Đoàn Trần Công Danh
Message 29 of 36 in “diff: do not show submodule with untracked files as "-dirty"”
  1. diff: do not show submodule with untracked files as "-dirty"Sangeeta via GitGitGadget, Oct 15, 2020
  2. Phillip WoodOct 20, 2020
  3. Sangeeta NBOct 20, 2020
  4. Phillip WoodOct 21, 2020
  5. [Outreachy] [PATCH v2] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 21, 2020
  6. Eric SunshineOct 21, 2020
  7. Sangeeta NBOct 21, 2020
  8. Eric SunshineOct 21, 2020
  9. [Outreachy] [PATCH v3] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 22, 2020
  10. Junio C HamanoOct 22, 2020
  11. Sangeeta NBOct 23, 2020
  12. Junio C HamanoOct 23, 2020
  13. Sangeeta NBOct 23, 2020
  14. Junio C HamanoOct 23, 2020
  15. Sangeeta NBOct 23, 2020
  16. diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  17. Junio C HamanoOct 23, 2020
  18. Sangeeta NBOct 23, 2020
  19. Junio C HamanoOct 23, 2020
  20. [Outreachy] [PATCH v4] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  21. Junio C HamanoOct 23, 2020
  22. Sangeeta NBOct 25, 2020
  23. Junio C HamanoOct 26, 2020
  24. [Outreachy] [PATCH v5] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  25. [Outreachy][PATCH v6] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 26, 2020
  26. SangeetaNov 3, 2020
  27. Junio C HamanoNov 3, 2020
  28. SangeetaNov 7, 2020
  29. Junio C HamanoDec 8, 2020
  30. Đoàn Trần Công DanhNov 7, 2020
  31. SangeetaNov 9, 2020
  32. Junio C HamanoNov 9, 2020
  33. [Outreachy][PATCH v7] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Nov 10, 2020
  34. Đoàn Trần Công DanhNov 10, 2020
  35. SangeetaDec 8, 2020
  36. Junio C HamanoDec 8, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.