mirror of
https://github.com/git/git.git
synced 2026-04-14 02:40:08 +02:00
builtin/mv: convert assert(3p) into BUG()
The use of asserts is discouraged in our codebase because they lead to different behaviour depending on how Git is built. When being unsure enough whether a condition always holds so that one adds the assert, then the assert should probably trigger regardless of how Git is being built. Drop the call to assert(3p) in git-mv(1) and instead use `BUG()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8583c9dcbc
commit
974f0d4664
@@ -560,7 +560,8 @@ remove_entry:
|
||||
continue;
|
||||
|
||||
pos = index_name_pos(the_repository->index, src, strlen(src));
|
||||
assert(pos >= 0);
|
||||
if (pos < 0)
|
||||
BUG("could not find source in index: '%s'", src);
|
||||
if (!(mode & SPARSE) && !lstat(src, &st))
|
||||
sparse_and_dirty = ie_modified(the_repository->index,
|
||||
the_repository->index->cache[pos],
|
||||
|
||||
Reference in New Issue
Block a user