git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Piotr Siupa <piotrsiupa@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: "git-stash --keep-index" crashes when there are no tracked files
Date: Fri, 16 Aug 2024 12:39:51 +0200	[thread overview]
Message-ID: <Zr8sd01HNGwd8zJC@tanuki> (raw)
In-Reply-To: <CAPM0=yCJ0snEznK0C+zkmGofWHE3OPWoMXSVGH6=TdM7=rZ84g@mail.gmail.com>

On Tue, Aug 13, 2024 at 07:36:15PM +0200, Piotr Siupa wrote:
> Hello,
> 
> I've found a bug.
> It's something that's unlikely to happen in a normal workflow but it
> breaks a script I'm trying to write.
> 
> Here is the complete report from "git bugreport":
> 
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> git init
> git commit --allow-empty --message='initial commit'
> touch foo
> git stash push --include-untracked --keep-index
> 
> What did you expect to happen? (Expected behavior)
> A stash entry storing the untracked file "foo" should be created. The
> working directory and index should become empty.
> 
> What happened instead? (Actual behavior)
> The command did what was expected but after that it crashed with the
> following error message:
> error: pathspec ':/' did not match any file(s) known to git

I would clarify that this is not "crashing", but that's basically
splitting hairs. In any case, thanks for this clear bug report with a
nice and simple reproducer. I agree that this is something that should
be fixed indeed.

Will send a patch shortly.

Patrick

  reply	other threads:[~2024-08-16 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13 17:36 "git-stash --keep-index" crashes when there are no tracked files Piotr Siupa
2024-08-16 10:39 ` Patrick Steinhardt [this message]
2024-08-16 10:42 ` [PATCH] builtin/stash: fix `--keep-index --include-untracked` with empty HEAD Patrick Steinhardt

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=Zr8sd01HNGwd8zJC@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=piotrsiupa@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).