# [PATCH 0/1] doc: Correct man page for the SHAs reported by 'submodule status'

6 messages from 2019-11-22 to 2019-11-23. Participants: Manish Goregaokar via GitGitGadget, Junio C Hamano, Manish Goregaokar.
Thread: https://gitlist.dev/t/52320

## Manish Goregaokar via GitGitGadget, 2019-11-22 23:11

Subject: [PATCH 0/1] doc: Correct man page for the SHAs reported by 'submodule status'
Message-ID: <pull.470.git.1574464285.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.470.git.1574464285.gitgitgadget%40gmail.com

```
The documentation is currently incorrect, it talks about the checked out
SHAs when git submodule status actually reports the superproject's tracked
SHAs.

It's possible (but unlikely IMO) that we should change the behavior of the
tool to match the documentation. A flag for this behavior may be useful.

Manish Goregaokar (1):
  Documentation: Correct man page for the SHAs reported by 'submodule
    status'

 Documentation/git-submodule.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-470%2FManishearth%2Fsubmodule-sha-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-470/Manishearth/submodule-sha-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/470
-- 
gitgitgadget

```

## Manish Goregaokar via GitGitGadget, 2019-11-22 23:11

Subject: [PATCH 1/1] Documentation: Correct man page for the SHAs reported by 'submodule status'
Message-ID: <0eabb27ba0c7a07bbf24f13f1766c0ff63995348.1574464285.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/0eabb27ba0c7a07bbf24f13f1766c0ff63995348.1574464285.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.470.git.1574464285.gitgitgadget@gmail.com>

```
From: Manish Goregaokar <manishsmail@gmail.com>

'git submodule status' reports the SHAs expected by the parent project,
not the SHAs that are actually checked out in the submodule. Checking
out a new SHA in a submodule will not change the output of 'git
submodule status' until you 'git add' the submodule.

Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
---
 Documentation/git-submodule.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 0ed5c24dc1..31e089454a 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -72,8 +72,8 @@ git-submodule will correctly locate the submodule using the relative
 URL in `.gitmodules`.
 
 status [--cached] [--recursive] [--] [<path>...]::
-	Show the status of the submodules. This will print the SHA-1 of the
-	currently checked out commit for each submodule, along with the
+	Show the status of the submodules. This will print the SHA-1
+	recorded in the superproject for each submodule, along with the
 	submodule path and the output of 'git describe' for the
 	SHA-1. Each SHA-1 will possibly be prefixed with `-` if the submodule is
 	not initialized, `+` if the currently checked out submodule commit
-- 
gitgitgadget

```

## Junio C Hamano, 2019-11-23 01:21

Subject: Re: [PATCH 1/1] Documentation: Correct man page for the SHAs reported by 'submodule status'
Message-ID: <xmqqo8x32xqv.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqo8x32xqv.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <0eabb27ba0c7a07bbf24f13f1766c0ff63995348.1574464285.git.gitgitgadget@gmail.com>

```
"Manish Goregaokar via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Manish Goregaokar <manishsmail@gmail.com>
>
> 'git submodule status' reports the SHAs expected by the parent project,
> not the SHAs that are actually checked out in the submodule. Checking
> out a new SHA in a submodule will not change the output of 'git
> submodule status' until you 'git add' the submodule.
>
> Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
> ---
>  Documentation/git-submodule.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> index 0ed5c24dc1..31e089454a 100644
> --- a/Documentation/git-submodule.txt
> +++ b/Documentation/git-submodule.txt
> @@ -72,8 +72,8 @@ git-submodule will correctly locate the submodule using the relative
>  URL in `.gitmodules`.
>  
>  status [--cached] [--recursive] [--] [<path>...]::
> -	Show the status of the submodules. This will print the SHA-1 of the
> -	currently checked out commit for each submodule, along with the
> +	Show the status of the submodules. This will print the SHA-1
> +	recorded in the superproject for each submodule, along with the
>  	submodule path and the output of 'git describe' for the

Am I mistaken to say that neither the old or the new description is
correct, depending on the use (or non-use) of the --cached option?

	... print the object name of the commit that is currently
	checked out, or the commit that is recorded in the
	superproject if `--cached` option is given, for each
	submodule, ...

perhaps?

```

## Manish Goregaokar, 2019-11-23 05:46

Subject: Re: [PATCH 1/1] Documentation: Correct man page for the SHAs reported by 'submodule status'
Message-ID: <CACpkpxmtuunTXPc6=3bvPqGL=T7i4-LB0sKDmzLPxcNcv1ZH6A@mail.gmail.com>
URL: https://gitlist.dev/e/CACpkpxmtuunTXPc6%3D3bvPqGL%3DT7i4-LB0sKDmzLPxcNcv1ZH6A%40mail.gmail.com
In-Reply-To: <xmqqo8x32xqv.fsf@gitster-ct.c.googlers.com>

```
Turns out that I've found a bug! I was getting this behavior because
it wasn't detecting that submodules were modified. I'll submit a patch
shortly, but first fix this one since the documentation should be
fixed regardless.

Thanks,
-Manish Goregaokar

-Manish Goregaokar


On Fri, Nov 22, 2019 at 5:21 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Manish Goregaokar via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Manish Goregaokar <manishsmail@gmail.com>
> >
> > 'git submodule status' reports the SHAs expected by the parent project,
> > not the SHAs that are actually checked out in the submodule. Checking
> > out a new SHA in a submodule will not change the output of 'git
> > submodule status' until you 'git add' the submodule.
> >
> > Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
> > ---
> >  Documentation/git-submodule.txt | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
> > index 0ed5c24dc1..31e089454a 100644
> > --- a/Documentation/git-submodule.txt
> > +++ b/Documentation/git-submodule.txt
> > @@ -72,8 +72,8 @@ git-submodule will correctly locate the submodule using the relative
> >  URL in `.gitmodules`.
> >
> >  status [--cached] [--recursive] [--] [<path>...]::
> > -     Show the status of the submodules. This will print the SHA-1 of the
> > -     currently checked out commit for each submodule, along with the
> > +     Show the status of the submodules. This will print the SHA-1
> > +     recorded in the superproject for each submodule, along with the
> >       submodule path and the output of 'git describe' for the
>
> Am I mistaken to say that neither the old or the new description is
> correct, depending on the use (or non-use) of the --cached option?
>
>         ... print the object name of the commit that is currently
>         checked out, or the commit that is recorded in the
>         superproject if `--cached` option is given, for each
>         submodule, ...
>
> perhaps?

```

## Manish Goregaokar via GitGitGadget, 2019-11-23 05:54

Subject: [PATCH v2 0/1] doc: Document 'git submodule status --cached'
Message-ID: <pull.470.v2.git.1574488468.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.470.v2.git.1574488468.gitgitgadget%40gmail.com
In-Reply-To: <pull.470.git.1574464285.gitgitgadget@gmail.com>

```
It's currently undocumented, and should be mentioned.

I previously thought that git submodule status was displaying the behaviors
of git submodule status --cached and was thus incorrectly documented, but
that wasn't actually the case: turns out that git submodule status just
doesn't work when not in the root directory.

Manish Goregaokar (1):
  doc: Document 'git submodule status --cached'

 Documentation/git-submodule.txt | 3 +++
 1 file changed, 3 insertions(+)


base-commit: 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-470%2FManishearth%2Fsubmodule-sha-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-470/Manishearth/submodule-sha-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/470

Range-diff vs v1:

 1:  0eabb27ba0 ! 1:  3168924c3c Documentation: Correct man page for the SHAs reported by 'submodule status'
     @@ -1,11 +1,9 @@
      Author: Manish Goregaokar <manishsmail@gmail.com>
      
     -    Documentation: Correct man page for the SHAs reported by 'submodule status'
     +    doc: Document 'git submodule status --cached'
      
     -    'git submodule status' reports the SHAs expected by the parent project,
     -    not the SHAs that are actually checked out in the submodule. Checking
     -    out a new SHA in a submodule will not change the output of 'git
     -    submodule status' until you 'git add' the submodule.
     +    'git submodule status --cached' reports the SHAs expected by the parent project,
     +    instead of the SHAs that are actually checked out in the submodule.
      
          Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
      
     @@ -13,13 +11,12 @@
       --- a/Documentation/git-submodule.txt
       +++ b/Documentation/git-submodule.txt
      @@
     - URL in `.gitmodules`.
     - 
     - status [--cached] [--recursive] [--] [<path>...]::
     --	Show the status of the submodules. This will print the SHA-1 of the
     --	currently checked out commit for each submodule, along with the
     -+	Show the status of the submodules. This will print the SHA-1
     -+	recorded in the superproject for each submodule, along with the
     - 	submodule path and the output of 'git describe' for the
     - 	SHA-1. Each SHA-1 will possibly be prefixed with `-` if the submodule is
     - 	not initialized, `+` if the currently checked out submodule commit
     + 	does not match the SHA-1 found in the index of the containing
     + 	repository and `U` if the submodule has merge conflicts.
     + +
     ++If `--cached` is specified, this command will instead print the SHA-1
     ++recorded in the superproject for each submodule.
     +++
     + If `--recursive` is specified, this command will recurse into nested
     + submodules, and show their status as well.
     + +

-- 
gitgitgadget

```

## Manish Goregaokar via GitGitGadget, 2019-11-23 05:54

Subject: [PATCH v2 1/1] doc: Document 'git submodule status --cached'
Message-ID: <3168924c3c6f12a293b25a00f333a55d4b8fa3a9.1574488468.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/3168924c3c6f12a293b25a00f333a55d4b8fa3a9.1574488468.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.470.v2.git.1574488468.gitgitgadget@gmail.com>

```
From: Manish Goregaokar <manishsmail@gmail.com>

'git submodule status --cached' reports the SHAs expected by the parent project,
instead of the SHAs that are actually checked out in the submodule.

Signed-off-by: Manish Goregaokar <manishsmail@gmail.com>
---
 Documentation/git-submodule.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 0ed5c24dc1..f05c2b92fb 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -80,6 +80,9 @@ status [--cached] [--recursive] [--] [<path>...]::
 	does not match the SHA-1 found in the index of the containing
 	repository and `U` if the submodule has merge conflicts.
 +
+If `--cached` is specified, this command will instead print the SHA-1
+recorded in the superproject for each submodule.
++
 If `--recursive` is specified, this command will recurse into nested
 submodules, and show their status as well.
 +
-- 
gitgitgadget

```
