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 <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Petr Baudis committed
Jul 16, 2008 at 21:11 UTC
f6c52fe4e871d1d07cb7d86692ccf8cc4de54579
1 file changed
+7
-9
builtin-mv.c
+7
-9
@@ -228,15 +228,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
228
if (mode == WORKING_DIRECTORY)
229
continue;
230
231
- if (cache_name_pos(src, strlen(src)) >= 0) {
232
- string_list_insert(src, &deleted);
233
-
234
- /* destination can be a directory with 1 file inside */
235
- if (string_list_has_string(&overwritten, dst))
236
- string_list_insert(dst, &changed);
237
- else
238
- string_list_insert(dst, &added);
239
- } else
231
+ assert(cache_name_pos(src, strlen(src)) >= 0);
232
+
233
+ string_list_insert(src, &deleted);
234
+ /* destination can be a directory with 1 file inside */
235
+ if (string_list_has_string(&overwritten, dst))
236
+ string_list_insert(dst, &changed);
237
+ else
238
string_list_insert(dst, &added);
239
}
240