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

Re: What's cooking in git.git (May 2011, #06; Fri, 13)

From
Junio C Hamano <gitster@pobox.com>
Date
May 15, 2011, 20:23 UTC
Message-ID
<7vfwofpvai.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4DD0043D.1050101@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
Show 9 quoted lines
> Am 13.05.2011 22:03, schrieb Junio C Hamano:
>> * jl/read-tree-m-dry-run (2011-05-11) 1 commit
>>  - Teach read-tree the -n|--dry-run option
>> 
>> Looked good. We _might_ want to make -n simply ignore -u, though.
>
> Fine by me. Do you want me to send an updated version? If so,
> should a warning be issued in that case or should that just
> happen silently?

Later we _may_ have a condition where "read-tree -m" with some options (except "-n") may succeed but "read-tree -m -u" with the same other options may fail, and the reason to have "-n" is so that the caller can tell if the operation may or may not fail in advance without changing the state. Singling out "do not write INDEX" was a mistake to begin with.

How about "simply ignore" aka "silently"? We do not even have to make it sound like an user error, if we explain the option like this.

I think the change to the implementation would be trivial, but you would probably want to update the tests in 1002 (remove the one at the end that checks -u/-n incompatibility, and perhaps make sure "-n -u" combination does not touch anything as advertised).

Thanks.
diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index a35849f..46a96f2 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -55,8 +55,8 @@ OPTIONS
 
 -n::
 --dry-run::
-	Don't write the index file. This option isn't allowed together
-	with -u.
+	Check if the command would error out, without updating the index
+	nor the files in the working tree for real.
 
 -v::
 	Show the progress of checking files out.
Previous: Jens LehmannNext: Jens Lehmann
Message 6 of 12 in “What's cooking in git.git (May 2011, #06; Fri, 13)”
  1. Junio C HamanoMay 13, 2011
  2. Nguyen Thai Ngoc DuyMay 14, 2011
  3. Junio C HamanoMay 14, 2011
  4. Nguyen Thai Ngoc DuyMay 15, 2011
  5. Jens LehmannMay 15, 2011
  6. Junio C HamanoMay 15, 2011
  7. Teach read-tree the -n|--dry-run optionJens Lehmann, May 17, 2011
  8. Jens LehmannMay 17, 2011
  9. Junio C HamanoMay 17, 2011
  10. unpack-trees: add check_worktree flag to enable dry-run functionalityJens Lehmann, May 19, 2011
  11. Junio C HamanoMay 19, 2011
  12. Jens LehmannMay 19, 2011

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.