Skip to content

Don't use mtime -1 - #616

Merged
TheOneRing merged 1 commit into
mainfrom
work/fix_change_detection_mtime
Oct 23, 2025
Merged

TheOneRing merged 1 commit into
mainfrom
work/fix_change_detection_mtime

Conversation

@TheOneRing

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the FileChangedInfo structure to use std::optional<time_t> instead of time_t for the mtime field, eliminating the need to use the sentinel value -1 to indicate non-existent files. The change improves type safety by making the absence of a modification time explicit through the type system.

  • Changed mtime from time_t to std::optional<time_t> in FileChangedInfo
  • Added validation check in fromSyncJournalFileRecord to return empty info for invalid records
  • Updated fileChanged function to use has_value() instead of comparing against -1

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/libsync/filesystem.h Changed mtime field type to std::optional<time_t>
src/libsync/filesystem.cpp Updated logic to check for valid records and use optional semantics instead of sentinel values

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/libsync/filesystem.cpp Resolved
@TheOneRing
TheOneRing force-pushed the work/fix_change_detection_mtime branch from a2332e6 to 5b36ec1 Compare October 23, 2025 10:21
@TheOneRing
TheOneRing requested a review from Copilot October 23, 2025 10:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TheOneRing
TheOneRing enabled auto-merge (rebase) October 23, 2025 10:22
@TheOneRing
TheOneRing merged commit 6c43084 into main Oct 23, 2025
@TheOneRing
TheOneRing deleted the work/fix_change_detection_mtime branch October 23, 2025 10:53
@openclouders openclouders mentioned this pull request Oct 23, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants