Skip to content

GVFS serialize status updates #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions t/t7524-serialized-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,16 @@ EOF

'

test_expect_success 'renames' '
git init rename_test &&
echo OLDNAME >rename_test/OLDNAME &&
git -C rename_test add OLDNAME &&
git -C rename_test commit -m OLDNAME &&
git -C rename_test mv OLDNAME NEWNAME &&
git -C rename_test status --serialize=renamed.dat >output.1 &&
echo DIRT >rename_test/DIRT &&
git -C rename_test status --deserialize=renamed.dat >output.2 &&
test_i18ncmp output.1 output.2
'

test_done
5 changes: 4 additions & 1 deletion wt-status-deserialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static int wt_deserialize_v1_changed_items(const struct wt_status *cmd_s,
d->worktree_status = ntohl(sd->fixed.worktree_status);
d->index_status = ntohl(sd->fixed.index_status);
d->stagemask = ntohl(sd->fixed.stagemask);
d->rename_status = ntohl(sd->fixed.rename_status);
d->rename_score = ntohl(sd->fixed.rename_score);
d->mode_head = ntohl(sd->fixed.mode_head);
d->mode_index = ntohl(sd->fixed.mode_index);
Expand All @@ -218,10 +219,11 @@ static int wt_deserialize_v1_changed_items(const struct wt_status *cmd_s,

trace_printf_key(
&trace_deserialize,
"change: %d %d %d %d %o %o %o %d %d %s %s '%s' '%s'",
"change: %d %d %d %d %d %o %o %o %d %d %s %s '%s' '%s'",
d->worktree_status,
d->index_status,
d->stagemask,
d->rename_status,
d->rename_score,
d->mode_head,
d->mode_index,
Expand Down Expand Up @@ -534,6 +536,7 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
/* show_branch */
/* show_stash */
/* hints */
/* ahead_behind_flags */
if (cmd_s->detect_rename != des_s->detect_rename) {
trace_printf_key(&trace_deserialize, "reject: detect_rename");
return DESERIALIZE_ERR;
Expand Down
5 changes: 4 additions & 1 deletion wt-status-serialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static void wt_serialize_v1_header(struct wt_status *s, int fd)
/* show_branch */
/* show_stash */
packet_write_fmt(fd, "hints %d\n", s->hints);
/* ahead_behind_flags */
packet_write_fmt(fd, "detect_rename %d\n", s->detect_rename);
packet_write_fmt(fd, "rename_score %d\n", s->rename_score);
packet_write_fmt(fd, "rename_limit %d\n", s->rename_limit);
Expand Down Expand Up @@ -78,10 +79,11 @@ static inline void wt_serialize_v1_changed(struct wt_status *s, int fd,
int len_path, len_rename_source;

trace_printf_key(&trace_serialize,
"change: %d %d %d %d %o %o %o %d %d %s %s '%s' '%s'",
"change: %d %d %d %d %d %o %o %o %d %d %s %s '%s' '%s'",
Copy link
Member

Choose a reason for hiding this comment

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

Do we have to increase v1 to v2 so that existing serialized statuses will be ignored?

Copy link
Author

Choose a reason for hiding this comment

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

i guess we should. maybe. technically, the v1 code has been in gvfs/master for months, but i don't think it has been used by anybody yet, because we're still waiting on gvfs server support, so i don't think it would hurt to leave it at v1 (this time).

Opinions??

Copy link
Author

Choose a reason for hiding this comment

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

TODO Note to self. Verify if the design doc needs updating.

Copy link
Member

Choose a reason for hiding this comment

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

technically, yes. However, It has not been advertised, and none of our features are using this, so my opinion is to not bump the version number (and treat this feature as something we have not released yet).

Copy link
Author

Choose a reason for hiding this comment

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

i'm going to keep the version number at 1 and go ahead and merge this.

d->worktree_status,
d->index_status,
d->stagemask,
d->rename_status,
d->rename_score,
d->mode_head,
d->mode_index,
Expand All @@ -96,6 +98,7 @@ static inline void wt_serialize_v1_changed(struct wt_status *s, int fd,
sd.fixed.worktree_status = htonl(d->worktree_status);
sd.fixed.index_status = htonl(d->index_status);
sd.fixed.stagemask = htonl(d->stagemask);
sd.fixed.rename_status = htonl(d->rename_status);
sd.fixed.rename_score = htonl(d->rename_score);
sd.fixed.mode_head = htonl(d->mode_head);
sd.fixed.mode_index = htonl(d->mode_index);
Expand Down
1 change: 1 addition & 0 deletions wt-status.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ struct wt_status_serialize_data_fixed
uint32_t worktree_status;
uint32_t index_status;
uint32_t stagemask;
uint32_t rename_status;
uint32_t rename_score;
uint32_t mode_head;
uint32_t mode_index;
Expand Down