worktree: convert struct worktree to object_id
Convert the head_sha1 member to be head_oid instead. This is required to convert resolve_ref_unsafe. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a98e6101f0
commit
0f05154c70
@ -410,7 +410,7 @@ static void show_worktree_porcelain(struct worktree *wt)
|
|||||||
if (wt->is_bare)
|
if (wt->is_bare)
|
||||||
printf("bare\n");
|
printf("bare\n");
|
||||||
else {
|
else {
|
||||||
printf("HEAD %s\n", sha1_to_hex(wt->head_sha1));
|
printf("HEAD %s\n", oid_to_hex(&wt->head_oid));
|
||||||
if (wt->is_detached)
|
if (wt->is_detached)
|
||||||
printf("detached\n");
|
printf("detached\n");
|
||||||
else if (wt->head_ref)
|
else if (wt->head_ref)
|
||||||
@ -430,7 +430,7 @@ static void show_worktree(struct worktree *wt, int path_maxlen, int abbrev_len)
|
|||||||
strbuf_addstr(&sb, "(bare)");
|
strbuf_addstr(&sb, "(bare)");
|
||||||
else {
|
else {
|
||||||
strbuf_addf(&sb, "%-*s ", abbrev_len,
|
strbuf_addf(&sb, "%-*s ", abbrev_len,
|
||||||
find_unique_abbrev(wt->head_sha1, DEFAULT_ABBREV));
|
find_unique_abbrev(wt->head_oid.hash, DEFAULT_ABBREV));
|
||||||
if (wt->is_detached)
|
if (wt->is_detached)
|
||||||
strbuf_addstr(&sb, "(detached HEAD)");
|
strbuf_addstr(&sb, "(detached HEAD)");
|
||||||
else if (wt->head_ref) {
|
else if (wt->head_ref) {
|
||||||
@ -455,7 +455,7 @@ static void measure_widths(struct worktree **wt, int *abbrev, int *maxlen)
|
|||||||
|
|
||||||
if (path_len > *maxlen)
|
if (path_len > *maxlen)
|
||||||
*maxlen = path_len;
|
*maxlen = path_len;
|
||||||
sha1_len = strlen(find_unique_abbrev(wt[i]->head_sha1, *abbrev));
|
sha1_len = strlen(find_unique_abbrev(wt[i]->head_oid.hash, *abbrev));
|
||||||
if (sha1_len > *abbrev)
|
if (sha1_len > *abbrev)
|
||||||
*abbrev = sha1_len;
|
*abbrev = sha1_len;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ static void add_head_info(struct worktree *wt)
|
|||||||
target = refs_resolve_ref_unsafe(get_worktree_ref_store(wt),
|
target = refs_resolve_ref_unsafe(get_worktree_ref_store(wt),
|
||||||
"HEAD",
|
"HEAD",
|
||||||
0,
|
0,
|
||||||
wt->head_sha1, &flags);
|
wt->head_oid.hash, &flags);
|
||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ struct worktree {
|
|||||||
char *id;
|
char *id;
|
||||||
char *head_ref; /* NULL if HEAD is broken or detached */
|
char *head_ref; /* NULL if HEAD is broken or detached */
|
||||||
char *lock_reason; /* internal use */
|
char *lock_reason; /* internal use */
|
||||||
unsigned char head_sha1[20];
|
struct object_id head_oid;
|
||||||
int is_detached;
|
int is_detached;
|
||||||
int is_bare;
|
int is_bare;
|
||||||
int is_current;
|
int is_current;
|
||||||
|
Loading…
Reference in New Issue
Block a user