Skip to content

Conversation

its-miroma
Copy link

@its-miroma its-miroma commented Oct 6, 2025

cc: Karthik Nayak karthik.188@gmail.com

Copy link

Welcome to GitGitGadget

Hi @its-miroma, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that either:

  • Your Pull Request has a good description, if it consists of multiple commits, as it will be used as cover letter.
  • Your Pull Request description is empty, if it consists of a single commit, as the commit message should be descriptive enough by itself.

You can CC potential reviewers by adding a footer to the PR description with the following syntax:

CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net>

NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description,
because it will result in a malformed CC list on the mailing list. See
example.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "revisions:" to state which subsystem the change is about, and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the Libera Chat IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this. Note that any reviewers CC'd via the list in the PR description will not actually be sent emails.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Libera Chat. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@dscho
Copy link
Member

dscho commented Oct 6, 2025

/allow

Copy link

User its-miroma is now allowed to use GitGitGadget.

WARNING: its-miroma has no public email address set on GitHub; GitGitGadget needs an email address to Cc: you on your contribution, so that you receive any feedback on the Git mailing list. Go to https://github.com/settings/profile to make your preferred email public to let GitGitGadget know which email address to use.

@its-miroma its-miroma changed the base branch from master to maint October 6, 2025 10:33
@its-miroma

This comment was marked as resolved.

Copy link

Preview email sent as pull.2067.git.git.1759749683549.gitgitgadget@gmail.com

@its-miroma its-miroma force-pushed the stash-no-status-showStash branch from a3428a5 to 32a45cf Compare October 6, 2025 11:27
@its-miroma

This comment was marked as resolved.

Copy link

Preview email sent as pull.2067.git.git.1759750135340.gitgitgadget@gmail.com

@its-miroma
Copy link
Author

/submit

Copy link

Submitted as pull.2067.git.git.1759750539721.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2067/its-miroma/stash-no-status-showStash-v1

To fetch this version to local tag pr-git-2067/its-miroma/stash-no-status-showStash-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2067/its-miroma/stash-no-status-showStash-v1

Copy link

On the Git mailing list, Karthik Nayak wrote (reply to this):

"Miroma via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Miroma <its.miroma@proton.me>
>
> Currently, when status.showStash is set, 'stash pop' shows the
> following, confusing, output:
>
>     ...
>     Your stash currently has 1 entry
>     Dropped refs/stash@{0} (abc123...)
>

Right, so your proposal is to not print stash related status information
when already running a stash command. It would be nice to note that
here, along why you think so.

Personally, I think it is important to keep this as is, because it tells
the user the entries left in the stash post the stash operation.

> Signed-off-by: Miroma <its.miroma@proton.me>
> ---
>     stash: don't show irrelevant entry count in status
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2067%2Fits-miroma%2Fstash-no-status-showStash-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2067/its-miroma/stash-no-status-showStash-v1
> Pull-Request: https://github.com/git/git/pull/2067
>
>  builtin/stash.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/builtin/stash.c b/builtin/stash.c
> index 1977e50df2..2bd4b7d753 100644
> --- a/builtin/stash.c
> +++ b/builtin/stash.c
> @@ -705,6 +705,9 @@ restore_untracked:
>  			     absolute_path(repo_get_work_tree(the_repository)));
>  		strvec_pushf(&cp.env, GIT_DIR_ENVIRONMENT"=%s",
>  			     absolute_path(repo_get_git_dir(the_repository)));
> +		strvec_push(&cp.env, "GIT_CONFIG_COUNT=1");
> +		strvec_push(&cp.env, "GIT_CONFIG_KEY_0=status.showStash");
> +		strvec_push(&cp.env, "GIT_CONFIG_VALUE_0=false");
>  		strvec_push(&cp.args, "status");
>  		run_command(&cp);
>

So this block is run to print the status, unless the '--quiet' option is
used. So it makes sense to do this here.

Small nit: Shouldn't we add a test to validate this change in behavior?

Copy link

User Karthik Nayak <karthik.188@gmail.com> has been added to the cc: list.

Copy link

On the Git mailing list, Junio C Hamano wrote (reply to this):

Karthik Nayak <karthik.188@gmail.com> writes:

> "Miroma via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> From: Miroma <its.miroma@proton.me>
>>
>> Currently, when status.showStash is set, 'stash pop' shows the
>> following, confusing, output:
>>
>>     ...
>>     Your stash currently has 1 entry
>>     Dropped refs/stash@{0} (abc123...)
>>
>
> Right, so your proposal is to not print stash related status information
> when already running a stash command. It would be nice to note that
> here, along why you think so.
>
> Personally, I think it is important to keep this as is, because it tells
> the user the entries left in the stash post the stash operation.

When pop sees a conflict, it keeps the stash entry, and whe it does
not, it discards the stash entry it used just now.  So I agree with
you that the number of remaining entries may be something the user
would want to see, but in do_apply_stash(), I think we are getting
the number before popping, as dropping the entry seems to be the
responsibility of the caller of do_apply_stash(), if I am reading
pop_stash() correctly.  So, I suspect the current output may need
adjustment if we want to keep the message and want it to be useful.

>> @@ -705,6 +705,9 @@ restore_untracked:
>>  			     absolute_path(repo_get_work_tree(the_repository)));
>>  		strvec_pushf(&cp.env, GIT_DIR_ENVIRONMENT"=%s",
>>  			     absolute_path(repo_get_git_dir(the_repository)));
>> +		strvec_push(&cp.env, "GIT_CONFIG_COUNT=1");
>> +		strvec_push(&cp.env, "GIT_CONFIG_KEY_0=status.showStash");
>> +		strvec_push(&cp.env, "GIT_CONFIG_VALUE_0=false");
>>  		strvec_push(&cp.args, "status");
>>  		run_command(&cp);
>>
>
> So this block is run to print the status, unless the '--quiet' option is
> used. So it makes sense to do this here.

Does it?  What happens in existing GIT_CONFIG_{COUNT,KEY,VALUE}*
environment variables passed by the script that invoked us?

If we are spawning "git status" here, can't we do a much simpler and
more obvious thing, i.e. "git -c status.showstash=false status"?

> Small nit: Shouldn't we add a test to validate this change in behavior?

Yes.  I am not yet sure what the right output should be, though.

Copy link

On the Git mailing list, Miroma wrote (reply to this):

"Karthik Nayak" <karthik.188@gmail.com> writes:

> "Miroma via GitGitGadget" gitgitgadget@gmail.com writes:
> 

> > From: Miroma its.miroma@proton.me
> > 

> > Currently, when status.showStash is set, 'stash pop' shows the
> > following, confusing, output:
> > 

> > ...
> > Your stash currently has 1 entry
> > Dropped refs/stash@{0} (abc123...)
> 

> 

> Right, so your proposal is to not print stash related status information
> when already running a stash command. It would be nice to note that
> here, along why you think so.

I'll update the commit message.  Briefly: I think the stash count shown by
'status' when called by 'stash' internally is confusing, especially in the
cited example of 'stash pop', because the count is immediately rendered
obsolete as the pop drops it by one:

```sh
$ git stash pop
...
Your stash currently has 1 entry
Dropped refs/stash@{0} (abc123...)
$
$ git status --show-stash
...
<no stashes>
```

> Personally, I think it is important to keep this as is, because it tells
> the user the entries left in the stash post the stash operation.

The issue is that the number shown is *not* post the stash operation, rather
before; I called the output in the original message "confusing" because it
claimed 1 entry, then immediately dropped it.  The real count after the stash
drop is 0.


"Junio C Hamano" gitster@pobox.com writes:

> When pop sees a conflict, it keeps the stash entry, and whe it does
> not, it discards the stash entry it used just now. So I agree with
> you that the number of remaining entries may be something the user
> would want to see, but in do_apply_stash(), I think we are getting
> the number before popping, as dropping the entry seems to be the
> responsibility of the caller of do_apply_stash(), if I am reading
> pop_stash() correctly. So, I suspect the current output may need
> adjustment if we want to keep the message and want it to be useful.

Yes, currently 'status' shows the stash count, then 'stash pop' calls it
before the stash is dropped.

A possible solution would be calling wt_longstatus_print_stash_summary()
from 'wt-status.c' here, once 'stash' is ready to show the count.

> > So this block is run to print the status, unless the '--quiet' option is
> > used. So it makes sense to do this here.
> 

> 

> Does it? What happens in existing GIT_CONFIG_{COUNT,KEY,VALUE}*
> environment variables passed by the script that invoked us?

Good point, I missed that...  But find a solution below

> If we are spawning "git status" here, can't we do a much simpler and
> more obvious thing, i.e. "git -c status.showstash=false status"?

I found that 'status' knows of the '--no-show-stash' option; I'll use that.

> > Small nit: Shouldn't we add a test to validate this change in behavior?
> 

> 

> Yes. I am not yet sure what the right output should be, though.

I suggest the last line of the output of 'stash' commands be the count:

```sh
# assuming there are two stashes
$ git stash pop
...
Dropped refs/stash@{0} (abc123...)
Your stash currently has 1 entry
```

@its-miroma its-miroma force-pushed the stash-no-status-showStash branch 5 times, most recently from 5a695df to 4e149bb Compare October 8, 2025 12:12
@its-miroma its-miroma changed the title stash: don't show irrelevant entry count in status stash: show correct entries count Oct 8, 2025
@its-miroma its-miroma force-pushed the stash-no-status-showStash branch from 4e149bb to 6f05470 Compare October 8, 2025 12:16
Currently, 'stash apply' internally calls 'status' to show a summary of
what the command did. This also happens with 'stash pop', which roughly
corresponds to 'apply' + 'drop'.

When the configuration 'status.showStash' is set, 'status' shows a count
of stashed entries. This leads to the following, confusing, output:

```sh
$ # assuming there are two stashed entries
$ git stash pop
...
Your stash currently has 2 entries
Dropped refs/stash@{0} (abc123...)
$ # when actually...
$ git status --show-stash
...
Your stash currently has 1 entry
```

This patch changes the output format to the following, no matter the
value of 'status.showStash':

```sh
$ # assuming there's a stashed entry
$ git stash pop
...
Dropped refs/stash@{0} (abc123...)
Your stash now has 0 entries
```

This new output is only shown if the stash count has changed, which can
happen with the following subcommands:
'drop', 'pop', 'branch', 'store', 'push', 'save'.

Helped-by: Karthik Nayak <karthik.188@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Miroma <its.miroma@proton.me>
@its-miroma its-miroma force-pushed the stash-no-status-showStash branch from 6f05470 to 1118bd6 Compare October 9, 2025 10:21
@its-miroma
Copy link
Author

/preview

Copy link

Preview email sent as pull.2067.v2.git.git.1760005760216.gitgitgadget@gmail.com

@its-miroma
Copy link
Author

/submit

Copy link

Submitted as pull.2067.v2.git.git.1760007783388.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2067/its-miroma/stash-no-status-showStash-v2

To fetch this version to local tag pr-git-2067/its-miroma/stash-no-status-showStash-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2067/its-miroma/stash-no-status-showStash-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants