Skip to content

Commit 0512eab

Browse files
committed
sequencer: stop abbreviating stopped-sha file
The object name written to this file is not exposed to end-users and the only reader of this file immediately expands it back to a full object name. Stop abbreviating while writing, and expect a full object name while reading, which simplifies the code a bit. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47ae905 commit 0512eab

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sequencer.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static GIT_PATH_FUNC(rebase_path_author_script, "rebase-merge/author-script")
120120
static GIT_PATH_FUNC(rebase_path_amend, "rebase-merge/amend")
121121
/*
122122
* When we stop at a given patch via the "edit" command, this file contains
123-
* the abbreviated commit name of the corresponding patch.
123+
* the commit object name of the corresponding patch.
124124
*/
125125
static GIT_PATH_FUNC(rebase_path_stopped_sha, "rebase-merge/stopped-sha")
126126
/*
@@ -3012,11 +3012,12 @@ static int make_patch(struct repository *r,
30123012
{
30133013
struct strbuf buf = STRBUF_INIT;
30143014
struct rev_info log_tree_opt;
3015-
const char *subject, *p;
3015+
const char *subject;
3016+
char hex[GIT_MAX_HEXSZ + 1];
30163017
int res = 0;
30173018

3018-
p = short_commit_name(commit);
3019-
if (write_message(p, strlen(p), rebase_path_stopped_sha(), 1) < 0)
3019+
oid_to_hex_r(hex, &commit->object.oid);
3020+
if (write_message(hex, strlen(hex), rebase_path_stopped_sha(), 1) < 0)
30203021
return -1;
30213022
res |= write_rebase_head(&commit->object.oid);
30223023

@@ -4396,7 +4397,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
43964397

43974398
if (read_oneliner(&buf, rebase_path_stopped_sha(),
43984399
READ_ONELINER_SKIP_IF_EMPTY) &&
4399-
!get_oid_committish(buf.buf, &oid))
4400+
!get_oid_hex(buf.buf, &oid))
44004401
record_in_rewritten(&oid, peek_command(&todo_list, 0));
44014402
strbuf_release(&buf);
44024403
}

0 commit comments

Comments
 (0)