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

[PATCH 2/2] mv: remove unneeded 'if (!show_only)'

From
SMStefan Moch <stefanmoch@mail.de>
Date
Dec 31, 2017, 19:11 UTC
Message-ID
<20171231191156.28359-3-stefanmoch@mail.de>
In-Reply-To
<20171231191156.28359-1-stefanmoch@mail.de>

Commit a127331cd (mv: allow moving nested submodules, 2016-04-19), introduced

    if (show_only) continue;
in this for-loop before
    if (!show_only)
which became redundant, because it is now always true.
Signed-off-by: Stefan Moch <stefanmoch@mail.de>
---
 builtin/mv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c
index cf3684d90..8ce6a2ddd 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -286,8 +286,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 		pos = cache_name_pos(src, strlen(src));
 		assert(pos >= 0);
-		if (!show_only)
-			rename_cache_entry_at(pos, dst);
+		rename_cache_entry_at(pos, dst);
 	}
 
 	if (gitmodules_modified)
-- 
2.14.3
Previous: Stefan MochNext: Junio C Hamano
Message 7 of 12 in “feature-request: git "cp" like there is git mv.”
  1. Simon DoodkinDec 12, 2017
  2. Johannes SchindelinDec 13, 2017
  3. Randall S. BeckerDec 13, 2017
  4. Jonathan NiederDec 16, 2017
  5. Stefan MochDec 31, 2017
  6. 1/2 Add test case for mv --dry-run to t7001-mv.shStefan Moch, Dec 31, 2017
  7. 2/2 mv: remove unneeded 'if (!show_only)'Stefan Moch, Dec 31, 2017
  8. Junio C HamanoFeb 7, 2018
  9. Stefan BellerFeb 7, 2018
  10. Stefan MochMar 18, 2018
  11. Junio C HamanoMar 19, 2018
  12. Igor DjordjevicDec 18, 2017

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.