зеркало из https://github.com/microsoft/git.git
Teach ahead-behind and serialized status to play nicely together
This commit is contained in:
Родитель
a3a79dc000
Коммит
178a03b24a
|
@ -47,7 +47,13 @@ test_expect_success 'setup' '
|
|||
git commit -m"Adding original file." &&
|
||||
mkdir untracked &&
|
||||
touch ignored.ign ignored_dir/ignored_2.txt \
|
||||
untracked_1.txt untracked/untracked_2.txt untracked/untracked_3.txt
|
||||
untracked_1.txt untracked/untracked_2.txt untracked/untracked_3.txt &&
|
||||
|
||||
test_oid_cache <<-EOF
|
||||
branch_oid sha1:68d4a437ea4c2de65800f48c053d4d543b55c410
|
||||
|
||||
branch_oid sha256:6b95e4b1ea911dad213f2020840f5e92d3066cf9e38cf35f79412ec58d409ce4
|
||||
EOF
|
||||
'
|
||||
|
||||
test_expect_success 'verify untracked-files=complete with no conversion' '
|
||||
|
@ -138,4 +144,30 @@ test_expect_success 'verify serialized status handles path scopes' '
|
|||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_expect_success 'verify no-ahead-behind and serialized status integration' '
|
||||
test_when_finished "rm serialized_status.dat new_change.txt output" &&
|
||||
cat >expect <<-EOF &&
|
||||
# branch.oid $(test_oid branch_oid)
|
||||
# branch.head alt_branch
|
||||
# branch.upstream main
|
||||
# branch.ab +1 -0
|
||||
? expect
|
||||
? serialized_status.dat
|
||||
? untracked/
|
||||
? untracked_1.txt
|
||||
EOF
|
||||
|
||||
git checkout -b alt_branch main --track >/dev/null &&
|
||||
touch alt_branch_changes.txt &&
|
||||
git add alt_branch_changes.txt &&
|
||||
test_tick &&
|
||||
git commit -m"New commit on alt branch" &&
|
||||
|
||||
git status --untracked-files=complete --ignored=matching --serialize >serialized_status.dat &&
|
||||
touch new_change.txt &&
|
||||
|
||||
git -c status.aheadBehind=false status --porcelain=v2 --branch --ahead-behind --deserialize=serialized_status.dat >output &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -517,6 +517,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;
|
||||
|
@ -555,6 +556,7 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
|
|||
des_s->show_branch = cmd_s->show_branch;
|
||||
des_s->show_stash = cmd_s->show_stash;
|
||||
/* hints */
|
||||
des_s->ahead_behind_flags = cmd_s->ahead_behind_flags;
|
||||
des_s->status_format = cmd_s->status_format;
|
||||
des_s->fp = cmd_s->fp;
|
||||
if (cmd_s->prefix && *cmd_s->prefix)
|
||||
|
@ -563,7 +565,6 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
|
|||
return DESERIALIZE_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read raw serialized status data from the given file
|
||||
*
|
||||
|
|
|
@ -52,6 +52,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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче