|
|
|
@ -755,7 +755,7 @@ void wt_status_collect(struct wt_status *s)
@@ -755,7 +755,7 @@ void wt_status_collect(struct wt_status *s)
|
|
|
|
|
wt_status_collect_changes_index(s); |
|
|
|
|
wt_status_collect_untracked(s); |
|
|
|
|
|
|
|
|
|
wt_status_get_state(&s->state, s->branch && !strcmp(s->branch, "HEAD")); |
|
|
|
|
wt_status_get_state(s->repo, &s->state, s->branch && !strcmp(s->branch, "HEAD")); |
|
|
|
|
if (s->state.merge_in_progress && !has_unmerged(s)) |
|
|
|
|
s->committable = 1; |
|
|
|
|
} |
|
|
|
@ -1482,7 +1482,8 @@ static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
@@ -1482,7 +1482,8 @@ static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void wt_status_get_detached_from(struct wt_status_state *state) |
|
|
|
|
static void wt_status_get_detached_from(struct repository *r, |
|
|
|
|
struct wt_status_state *state) |
|
|
|
|
{ |
|
|
|
|
struct grab_1st_switch_cbdata cb; |
|
|
|
|
struct commit *commit; |
|
|
|
@ -1499,7 +1500,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
@@ -1499,7 +1500,7 @@ static void wt_status_get_detached_from(struct wt_status_state *state)
|
|
|
|
|
/* sha1 is a commit? match without further lookup */ |
|
|
|
|
(oideq(&cb.noid, &oid) || |
|
|
|
|
/* perhaps sha1 is a tag, try to dereference to a commit */ |
|
|
|
|
((commit = lookup_commit_reference_gently(the_repository, &oid, 1)) != NULL && |
|
|
|
|
((commit = lookup_commit_reference_gently(r, &oid, 1)) != NULL && |
|
|
|
|
oideq(&cb.noid, &commit->object.oid)))) { |
|
|
|
|
const char *from = ref; |
|
|
|
|
if (!skip_prefix(from, "refs/tags/", &from)) |
|
|
|
@ -1556,30 +1557,31 @@ int wt_status_check_bisect(const struct worktree *wt,
@@ -1556,30 +1557,31 @@ int wt_status_check_bisect(const struct worktree *wt,
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void wt_status_get_state(struct wt_status_state *state, |
|
|
|
|
void wt_status_get_state(struct repository *r, |
|
|
|
|
struct wt_status_state *state, |
|
|
|
|
int get_detached_from) |
|
|
|
|
{ |
|
|
|
|
struct stat st; |
|
|
|
|
struct object_id oid; |
|
|
|
|
|
|
|
|
|
if (!stat(git_path_merge_head(the_repository), &st)) { |
|
|
|
|
if (!stat(git_path_merge_head(r), &st)) { |
|
|
|
|
state->merge_in_progress = 1; |
|
|
|
|
} else if (wt_status_check_rebase(NULL, state)) { |
|
|
|
|
; /* all set */ |
|
|
|
|
} else if (!stat(git_path_cherry_pick_head(the_repository), &st) && |
|
|
|
|
} else if (!stat(git_path_cherry_pick_head(r), &st) && |
|
|
|
|
!get_oid("CHERRY_PICK_HEAD", &oid)) { |
|
|
|
|
state->cherry_pick_in_progress = 1; |
|
|
|
|
oidcpy(&state->cherry_pick_head_oid, &oid); |
|
|
|
|
} |
|
|
|
|
wt_status_check_bisect(NULL, state); |
|
|
|
|
if (!stat(git_path_revert_head(the_repository), &st) && |
|
|
|
|
if (!stat(git_path_revert_head(r), &st) && |
|
|
|
|
!get_oid("REVERT_HEAD", &oid)) { |
|
|
|
|
state->revert_in_progress = 1; |
|
|
|
|
oidcpy(&state->revert_head_oid, &oid); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (get_detached_from) |
|
|
|
|
wt_status_get_detached_from(state); |
|
|
|
|
wt_status_get_detached_from(r, state); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void wt_longstatus_print_state(struct wt_status *s) |
|
|
|
|