Re-send worktree if reconnecting while initial scan isn't finished yet

Previously, if the client was disconnected while the initial worktree
state was being sent, it would not see the remaining state after reconnecting.
This was due to `scan_id` and `completed_scan_id` both being initialized to
`0`, so the client would ask for updates since `0` and get nothing.

This commit changes the worktree to initialize `scan_id` to `1` and
`completed_scan_id` to `0`, so that we get the full worktree again on reconnect.
This commit is contained in:
Antonio Scandurra 2023-04-11 17:15:43 +02:00
parent 172441ab72
commit 5eb1719ab8

View file

@ -221,7 +221,7 @@ impl Worktree {
root_char_bag: root_name.chars().map(|c| c.to_ascii_lowercase()).collect(),
entries_by_path: Default::default(),
entries_by_id: Default::default(),
scan_id: 0,
scan_id: 1,
completed_scan_id: 0,
},
};
@ -298,7 +298,7 @@ impl Worktree {
.collect(),
entries_by_path: Default::default(),
entries_by_id: Default::default(),
scan_id: 0,
scan_id: 1,
completed_scan_id: 0,
};