##// END OF EJS Templates
rust-dirstate: panic if the DirstateMap counters go below 0...
Raphaël Gomès -
r49865:2593873c stable
parent child Browse files
Show More
@@ -831,10 +831,20 b' impl OwningDirstateMap {'
831 )? {
831 )? {
832 dropped = d;
832 dropped = d;
833 if dropped.had_entry {
833 if dropped.had_entry {
834 node.descendants_with_entry_count -= 1;
834 node.descendants_with_entry_count = node
835 .descendants_with_entry_count
836 .checked_sub(1)
837 .expect(
838 "descendants_with_entry_count should be >= 0",
839 );
835 }
840 }
836 if dropped.was_tracked {
841 if dropped.was_tracked {
837 node.tracked_descendants_count -= 1;
842 node.tracked_descendants_count = node
843 .tracked_descendants_count
844 .checked_sub(1)
845 .expect(
846 "tracked_descendants_count should be >= 0",
847 );
838 }
848 }
839
849
840 // Directory caches must be invalidated when removing a
850 // Directory caches must be invalidated when removing a
@@ -889,10 +899,16 b' impl OwningDirstateMap {'
889 filename,
899 filename,
890 )? {
900 )? {
891 if dropped.had_entry {
901 if dropped.had_entry {
892 map.nodes_with_entry_count -= 1
902 map.nodes_with_entry_count = map
903 .nodes_with_entry_count
904 .checked_sub(1)
905 .expect("nodes_with_entry_count should be >= 0");
893 }
906 }
894 if dropped.had_copy_source {
907 if dropped.had_copy_source {
895 map.nodes_with_copy_source_count -= 1
908 map.nodes_with_copy_source_count = map
909 .nodes_with_copy_source_count
910 .checked_sub(1)
911 .expect("nodes_with_copy_source_count should be >= 0");
896 }
912 }
897 } else {
913 } else {
898 debug_assert!(!was_tracked);
914 debug_assert!(!was_tracked);
General Comments 0
You need to be logged in to leave comments. Login now