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

Re: [PATCH 1/2] stash drops the stash even if creating the branch fails because it already exists

From
Tomas Carnecky <tom@dbservice.com>
Date
Sep 28, 2010, 13:21 UTC
Message-ID
<4CA1EBF3.7090701@dbservice.com>
In-Reply-To
<1285679992-7638-2-git-send-email-jon.seymour@gmail.com>
On 9/28/10 3:19 PM, Jon Seymour wrote:
Show 6 quoted lines
> From: Tomas Carnecky <tom@dbservice.com>
> 
> This bug was disovered by someone on IRC when he tried to 'git stash branch <branch> <stash>'
> while <branch> already existed. In that case the stash is dropped even though it isn't
> applied on any branch, so the stash is effectively lost. I think that shouldn't happen,
> so here is a test.
This line was missing from my original patch, sorry about that:
Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Show 24 quoted lines
> ---
>  t/t3903-stash.sh |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> index 9ed2396..0f6b2e4 100755
> --- a/t/t3903-stash.sh
> +++ b/t/t3903-stash.sh
> @@ -545,4 +545,15 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
>  	git stash drop
>  '
>  
> +test_expect_failure 'stash branch should not drop the stash if the branch exists' '
> +	git stash clear &&
> +	echo foo > file &&
> +	git add file &&
> +	git commit -m initial &&
> +	echo bar > file &&
> +	git stash &&
> +	test_must_fail git stash branch master stash@{0} &&
> +	git rev-parse stash@{0} --
> +'
> +
>  test_done
Previous: Jon SeymourNext: Jon Seymour
Message 4 of 6 in “stash drops the stash even if creating the branch fails because it already exists”
  1. stash drops the stash even if creating the branch fails because it already existsTomas Carnecky, Sep 28, 2010
  2. 0/2 stash: test and fix git stash branch regressionJon Seymour, Sep 28, 2010
  3. 1/2 stash drops the stash even if creating the branch fails because it already existsJon Seymour, Sep 28, 2010
  4. Tomas CarneckySep 28, 2010
  5. Jon SeymourSep 29, 2010
  6. 2/2 stash: fix git stash branch regression when branch creation failsJon Seymour, Sep 28, 2010

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.