git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carlos Rica <jasampler@gmail.com>
To: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: On writing builtin-reset.c, a question about git-reset.sh
Date: Mon, 20 Aug 2007 01:45:08 +0200	[thread overview]
Message-ID: <46C8D604.4090203@gmail.com> (raw)

Hi, I'm writing builtin-reset.c and
I'm really stuck with a little code in
git-reset.sh:

if orig=$(git rev-parse --verify HEAD 2>/dev/null)
then
	echo "$orig" >"$GIT_DIR/ORIG_HEAD"
else
	rm -f "$GIT_DIR/ORIG_HEAD"
fi

My question is about when this condition
could fail (and then the rm executed), and
if you would be able to reproduce it in tests.
I couldn't, and asking for this in the IRC
didn't help me at all.

This code was introduced in 45d197, when
different reset types were introduced,
and it seems that there was a reason for
doing it that way, looking at the change.

Thanks in advance for your support.

--
Carlos

             reply	other threads:[~2007-08-19 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-19 23:45 Carlos Rica [this message]
2007-08-20  0:24 ` On writing builtin-reset.c, a question about git-reset.sh Junio C Hamano

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=46C8D604.4090203@gmail.com \
    --to=jasampler@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --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.
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).