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 <gitster@pobox.com>
Junio C Hamano committed
Sep 24, 2020 at 22:49 UTC
0512eabd915a6a7e79b368bf6408b36bbdc56386
1 file changed
+6
-5
sequencer.c
+6
-5
@@ -120,7 +120,7 @@ static GIT_PATH_FUNC(rebase_path_author_script, "rebase-merge/author-script")
120
static GIT_PATH_FUNC(rebase_path_amend, "rebase-merge/amend")
121
/*
122
* 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.
124
*/
125
static GIT_PATH_FUNC(rebase_path_stopped_sha, "rebase-merge/stopped-sha")
126
/*
@@ -3012,11 +3012,12 @@ static int make_patch(struct repository *r,
3012
{
3013
struct strbuf buf = STRBUF_INIT;
3014
struct rev_info log_tree_opt;
3015
- const char *subject, *p;
3015
+ const char *subject;
3016
+ char hex[GIT_MAX_HEXSZ + 1];
3017
int res = 0;
3018
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)
3021
return -1;
3022
res |= write_rebase_head(&commit->object.oid);
3023
@@ -4396,7 +4397,7 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
4397
4398
if (read_oneliner(&buf, rebase_path_stopped_sha(),
4399
READ_ONELINER_SKIP_IF_EMPTY) &&
4399
- !get_oid_committish(buf.buf, &oid))
4400
+ !get_oid_hex(buf.buf, &oid))
4401
record_in_rewritten(&oid, peek_command(&todo_list, 0));
4402
strbuf_release(&buf);
4403
}