git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Σταύρος Ντέντος" <stdedos@gmail.com>
To: git <git@vger.kernel.org>
Subject: git stash push/save/create all return exit code 0, even if no object was created
Date: Sun, 22 Mar 2020 17:09:57 +0200	[thread overview]
Message-ID: <CAHMHMxW=muHe5qqndtdzR_md6KFQqwEonko-2gXC_q973JgB5w@mail.gmail.com> (raw)

Hello there,

I am trying to run a `git checkout` command on a repository, without
the possibility of getting any error message about files interfering
with the checkout process.
I thought a safe way to do this was to run `git-stash`, similarly to
`rebase.autoStash = true`

However, I find two issues with those:
1) Exit code is 0, even if no object/stash was created.

It feels weird to parse stdout/stderr to decide "what happened".

2) `git stash create` (which sounds more like what I need), does not
clear what it was stored.
I can "take the pain" of printing the object-sha1 to be traceable if
something happens (even though I would prefer more if it was
"securely" stored in `refs/stash` i.e. `git stash push`), but then
`git stash` won't clean what it just stored.
Is the solution to also run `git reset --hard` there?

With regards,
Ntentos Stavros

             reply	other threads:[~2020-03-22 15:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 15:09 Σταύρος Ντέντος [this message]
2020-03-22 15:50 ` git stash push/save/create all return exit code 0, even if no object was created Junio C Hamano
2020-03-22 16:15   ` Σταύρος Ντέντος

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHMHMxW=muHe5qqndtdzR_md6KFQqwEonko-2gXC_q973JgB5w@mail.gmail.com' \
    --to=stdedos@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).