From f6c52fe4e871d1d07cb7d86692ccf8cc4de54579 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 16 Jul 2008 21:11:08 +0200 Subject: [PATCH] git-mv: Remove dead code branch The path list builder had a branch for the case the source is not in index, but this can happen only if the source was a directory. However, in that case we have already expanded the list to the directory contents and set mode to WORKING_DIRECTORY, which is tested earlier. The patch removes the superfluous branch and adds an assert() instead. git-mv testsuite still passes. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- builtin-mv.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin-mv.c b/builtin-mv.c index 736a0b8bb..e66fa5432 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -228,15 +228,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix) if (mode == WORKING_DIRECTORY) continue; - if (cache_name_pos(src, strlen(src)) >= 0) { - string_list_insert(src, &deleted); - - /* destination can be a directory with 1 file inside */ - if (string_list_has_string(&overwritten, dst)) - string_list_insert(dst, &changed); - else - string_list_insert(dst, &added); - } else + assert(cache_name_pos(src, strlen(src)) >= 0); + + string_list_insert(src, &deleted); + /* destination can be a directory with 1 file inside */ + if (string_list_has_string(&overwritten, dst)) + string_list_insert(dst, &changed); + else string_list_insert(dst, &added); } -- 2.30.2