From: "Jan Krüger" <jk@jk.gs>
To: Git ML <git@vger.kernel.org>
Subject: [PATCH] read-tree: abort if no trees are given
Date: Fri, 10 Sep 2010 12:06:04 +0200 [thread overview]
Message-ID: <20100910120604.50aa1e94@jk.gs> (raw)
Currently, read-tree silently accepts an invocation without any
tree-ishs given and simply clobbers the index in that case. This
contradicts the usage synopsis and it's also probably not what anyone
would want to happen. So, instead, abort with a fatal error.
Signed-off-by: Jan Krüger <jk@jk.gs>
---
Someone in #git got confused by this.
builtin/read-tree.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 9ad1e66..67eb08e 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -166,6 +166,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
die("failed to unpack tree object %s", arg);
stage++;
}
+ if (nr_trees == 0)
+ die("no trees specified to read");
if (1 < opts.index_only + opts.update)
die("-u and -i at the same time makes no sense");
if ((opts.update||opts.index_only) && !opts.merge)
--
1.7.2.3.392.g02377.dirty
next reply other threads:[~2010-09-10 10:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-10 10:06 Jan Krüger [this message]
2010-09-10 11:29 ` [PATCH] read-tree: abort if no trees are given Johannes Sixt
2010-09-10 13:28 ` [PATCH] read-tree: deprecate syntax without tree-ish args Jan Krüger
2010-09-10 13:53 ` Sverre Rabbelier
2010-09-10 15:36 ` 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=20100910120604.50aa1e94@jk.gs \
--to=jk@jk.gs \
--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).