git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] read-tree: abort if no trees are given
@ 2010-09-10 10:06 Jan Krüger
  2010-09-10 11:29 ` Johannes Sixt
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Krüger @ 2010-09-10 10:06 UTC (permalink / raw)
  To: Git ML

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-10 15:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10 10:06 [PATCH] read-tree: abort if no trees are given Jan Krüger
2010-09-10 11:29 ` 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

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).