git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Orgad Shaneh via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Orgad Shaneh <orgads@gmail.com>, Orgad Shaneh <orgads@gmail.com>
Subject: [PATCH v2] submodule--helper: fix initialization of warn_if_uninitialized
Date: Mon, 25 Apr 2022 12:45:41 +0000	[thread overview]
Message-ID: <pull.1258.v2.git.git.1650890741430.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1258.git.git.1650781575173.gitgitgadget@gmail.com>

From: Orgad Shaneh <orgads@gmail.com>

The .warn_if_uninitialized member was introduced by 48308681
(git submodule update: have a dedicated helper for cloning,
2016-02-29) to submodule_update_clone struct and initialized to
false.  When c9911c93 (submodule--helper: teach update_data more
options, 2022-03-15) moved it to update_data struct, it started
to initialize it to true but this change was not explained in
its log message.

The member is set to true only when pathspec was given, and is
used when a submodule that matched the pathspec is found
uninitialized to give diagnostic message.  "submodule update"
without pathspec is supposed to iterate over all submodules
(i.e. without pathspec limitation) and update only the
initialized submodules, and finding uninitialized submodules
during the iteration is a totally expected and normal thing that
should not be warned.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
---
    submodule--helper: fix initialization of warn_if_uninitialized
    
    The .warn_if_uninitialized member was introduced by 48308681 (git
    submodule update: have a dedicated helper for cloning, 2016-02-29) to
    submodule_update_clone struct and initialized to false. When c9911c93
    (submodule--helper: teach update_data more options, 2022-03-15) moved it
    to update_data struct, it started to initialize it to true but this
    change was not explained in its log message.
    
    The member is set to true only when pathspec was given, and is used when
    a submodule that matched the pathspec is found uninitialized to give
    diagnostic message. "submodule update" without pathspec is supposed to
    iterate over all submodules (i.e. without pathspec limitation) and
    update only the initialized submodules, and finding uninitialized
    submodules during the iteration is a totally expected and normal thing
    that should not be warned.
    
    Signed-off-by: Orgad Shaneh orgads@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1258%2Forgads%2Fsub-no-warn-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1258/orgads/sub-no-warn-v2
Pull-Request: https://github.com/git/git/pull/1258

Range-diff vs v1:

 1:  089a52a50b4 ! 1:  1e34c9cad18 submodule--helper: fix initialization of warn_if_uninitialized
     @@ Metadata
       ## Commit message ##
          submodule--helper: fix initialization of warn_if_uninitialized
      
     -    This field is supposed to be off by default, and it is only enabled when
     -    running `git submodule update <path>`, and path is not initialized.
     +    The .warn_if_uninitialized member was introduced by 48308681
     +    (git submodule update: have a dedicated helper for cloning,
     +    2016-02-29) to submodule_update_clone struct and initialized to
     +    false.  When c9911c93 (submodule--helper: teach update_data more
     +    options, 2022-03-15) moved it to update_data struct, it started
     +    to initialize it to true but this change was not explained in
     +    its log message.
      
     -    Commit c9911c9358 changed it to enabled by default. This affects for
     -    example git checkout, which displays the following warning for each
     -    uninitialized submodule:
     -
     -    Submodule path 'sub' not initialized
     -    Maybe you want to use 'update --init'?
     -
     -    Amends c9911c9358e611390e2444f718c73900d17d3d60.
     +    The member is set to true only when pathspec was given, and is
     +    used when a submodule that matched the pathspec is found
     +    uninitialized to give diagnostic message.  "submodule update"
     +    without pathspec is supposed to iterate over all submodules
     +    (i.e. without pathspec limitation) and update only the
     +    initialized submodules, and finding uninitialized submodules
     +    during the iteration is a totally expected and normal thing that
     +    should not be warned.
      
          Signed-off-by: Orgad Shaneh <orgads@gmail.com>
      
     @@ builtin/submodule--helper.c: struct update_data {
       	.single_branch = -1, \
       	.max_jobs = 1, \
      -	.warn_if_uninitialized = 1, \
     -+	.warn_if_uninitialized = 0, \
       }
       
       static void next_submodule_warn_missing(struct submodule_update_clone *suc,


 builtin/submodule--helper.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 2c87ef9364f..1a8e5d06214 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2026,7 +2026,6 @@ struct update_data {
 	.references = STRING_LIST_INIT_DUP, \
 	.single_branch = -1, \
 	.max_jobs = 1, \
-	.warn_if_uninitialized = 1, \
 }
 
 static void next_submodule_warn_missing(struct submodule_update_clone *suc,

base-commit: 6cd33dceed60949e2dbc32e3f0f5e67c4c882e1e
-- 
gitgitgadget

  parent reply	other threads:[~2022-04-25 12:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24  6:26 [PATCH] submodule--helper: fix initialization of warn_if_uninitialized Orgad Shaneh via GitGitGadget
2022-04-25  9:34 ` Junio C Hamano
2022-04-25 12:43   ` Orgad Shaneh
2022-04-25 12:45 ` Orgad Shaneh via GitGitGadget [this message]
2022-04-25 18:25   ` [PATCH v2] " Junio C Hamano
2022-04-25 20:56     ` Junio C Hamano
2022-04-27 22:22       ` Glen Choo
2022-04-27 22:23       ` Glen Choo
2022-04-27 22:25       ` Glen Choo
2022-04-27 22:19   ` Glen Choo
2022-04-27 23:20     ` Junio C Hamano

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=pull.1258.v2.git.git.1650890741430.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=orgads@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).