From: Brandon Casey <casey@nrlssc.navy.mil>
To: git@vger.kernel.org
Subject: git-rev-parse incorrectly uses --default parameter when invalid revision is supplied
Date: Mon, 7 Jan 2008 17:38:42 -0600 (CST) [thread overview]
Message-ID: <Pine.LNX.4.64.0801071653460.31161@torch.nrlssc.navy.mil> (raw)
When rev-parse is called with an invalid revision parameter and
--default has been used to set a default revision, the output
will be based on the parameter to --default.
For example:
This likely fails:
$ git rev-parse --verify foobar
fatal: Needed a single revision
This likely succeeds but probably should fail:
$ git rev-parse --verify --default refs/heads/master foobar
b2e62a7dc6ba20a354d7590bf6a1d9264de7efe3
The documentation for rev-parse says:
--default <arg>::
If there is no parameter given by the user, use `<arg>`
instead.
git-stash uses this command, so a typo could cause the wrong stash
to be applied.
git stash apply stsh@{1}
If stash@{0} exists, it will be applied which is definitely not
what the user would want.
It is not straight forward to me how to modify builtin-rev-parse.c
to fix this.
-brandon
next reply other threads:[~2008-01-07 23:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-07 23:38 Brandon Casey [this message]
2008-01-08 0:21 ` git-rev-parse incorrectly uses --default parameter when invalid revision is supplied 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=Pine.LNX.4.64.0801071653460.31161@torch.nrlssc.navy.mil \
--to=casey@nrlssc.navy.mil \
--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).