[PATCH 1/7] git-mv: Remove dead code branch
- From
Petr Baudis <pasky@suse.cz>
- Date
- Jul 16, 2008, 19:11 UTC
- Message-ID
- <20080716191107.19772.90413.stgit@localhost>
- In-Reply-To
- <20080716190753.19772.93357.stgit@localhost>
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 <pasky@suse.cz> ---
builtin-mv.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/builtin-mv.c b/builtin-mv.c index 5530e11..158a83d 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -227,15 +227,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) { - path_list_insert(src, &deleted); - - /* destination can be a directory with 1 file inside */ - if (path_list_has_path(&overwritten, dst)) - path_list_insert(dst, &changed); - else - path_list_insert(dst, &added); - } else + assert(cache_name_pos(src, strlen(src)) >= 0); + + path_list_insert(src, &deleted); + /* destination can be a directory with 1 file inside */ + if (path_list_has_path(&overwritten, dst)) + path_list_insert(dst, &changed); + else path_list_insert(dst, &added); }