git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] read-tree: at least one tree-ish argument is required

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 19, 2009, 04:53 UTC
Message-ID
<7vfx77lg2s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7veimrmv3r.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> As read-tree is a very basic and low-level Porcelain, if somebody were
> using it to empty the index in an existing script, this change would
> appear as a regression and hopefully will be caught eventually, and
> updating such a script can be made reasonably easy if we want to be
> helpful (the error message can suggest running "rm $GIT_DIR/index", for
> example).

IOW, I would prefer to queue something like this in the upcoming version, and then later make it die(). I do not think anybody relies on it, but we have been wrong before. If the warning doesn't trigger for anybody, that is also fine as well.

 builtin-read-tree.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 2a3a32c..311c489 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -111,6 +111,9 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 	argc = parse_options(argc, argv, unused_prefix, read_tree_options,
 			     read_tree_usage, 0);
 
+	if (!argc)
+		warning("running read-tree without argument to empty the index is deprecated.");
+
 	newfd = hold_locked_index(&lock_file, 1);
 
 	prefix_set = opts.prefix ? 1 : 0;
Previous: Junio C HamanoNext: Johannes Schindelin
Message 18 of 21 in “filter-branch: remove an unnecessary use of 'git read-tree'”
  1. 1/2 filter-branch: remove an unnecessary use of 'git read-tree'Johannes Sixt, Dec 15, 2009
  2. 2/2 read-tree: at least one tree-ish argument is requiredJohannes Sixt, Dec 15, 2009
  3. Johannes SixtDec 18, 2009
  4. Junio C HamanoDec 18, 2009
  5. Johannes SixtDec 18, 2009
  6. Sverre RabbelierDec 18, 2009
  7. Junio C HamanoDec 18, 2009
  8. Sverre RabbelierDec 18, 2009
  9. Junio C HamanoDec 18, 2009
  10. Sverre RabbelierDec 18, 2009
  11. Junio C HamanoDec 18, 2009
  12. Sverre RabbelierDec 18, 2009
  13. Johannes SixtDec 18, 2009
  14. Jakub NarebskiDec 18, 2009
  15. Junio C HamanoDec 18, 2009
  16. Nanako ShiraishiDec 19, 2009
  17. Junio C HamanoDec 19, 2009
  18. Junio C HamanoDec 19, 2009
  19. Johannes SchindelinDec 19, 2009
  20. Johannes SchindelinDec 15, 2009
  21. Junio C HamanoDec 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.