{"thread":{"id":"54482","subject":"[PATCH] sequencer: tolerate abbreviated stopped-sha file","startedAt":"2020-10-21T22:04:00Z","lastAt":"2020-10-21T22:56:21Z","messageCount":2,"participants":["Jonathan Tan","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"408110","messageId":"20201021220353.928067-1-jonathantanmy@google.com","threadId":"54482","inReplyTo":null,"subject":"[PATCH] sequencer: tolerate abbreviated stopped-sha file","fromName":"Jonathan Tan","fromEmail":"jonathantanmy@google.com","sentAt":"2020-10-21T22:03:53Z","receivedAt":"2020-10-21T22:04:00Z","isPatch":true,"sender":{"key":"jonathantanmy@fastmail.com","avatar":null},"body":"In 0512eabd91 (\"sequencer: stop abbreviating stopped-sha file\",\n2020-09-25), Git was taught both to write full object names to the\nstopped-sha file and to require full object names when reading. However,\na user would experience a problem if they started an interactive rebase\nusing an old version of Git and then continued with a current version of\nGit (for example, if the system version of Git was updated in the\nmeantime).\n\nTeach Git to allow object names of any length when reading.\n\nSigned-off-by: Jonathan Tan <jonathantanmy@google.com>\n---\nNot sure how big of a problem this will potentially be, but I noticed it\nand wanted to mention it.\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 00acb12496..37847d4534 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2653,7 +2653,7 @@ static int read_populate_opts(struct replay_opts *opts)\n \t\t}\n \n \t\tif (read_oneliner(&buf, rebase_path_squash_onto(), 0)) {\n-\t\t\tif (get_oid_hex(buf.buf, &opts->squash_onto) < 0) {\n+\t\t\tif (get_oid_committish(buf.buf, &opts->squash_onto) < 0) {\n \t\t\t\tret = error(_(\"unusable squash-onto\"));\n \t\t\t\tgoto done_rebase_i;\n \t\t\t}\n-- \n2.29.0.rc1.297.gfa9743e501-goog\n\n"},{"id":"408123","messageId":"xmqqd01b429a.fsf@gitster.c.googlers.com","threadId":"54482","inReplyTo":"20201021220353.928067-1-jonathantanmy@google.com","subject":"Re: [PATCH] sequencer: tolerate abbreviated stopped-sha file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-10-21T22:56:17Z","receivedAt":"2020-10-21T22:56:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Tan <jonathantanmy@google.com> writes:\n\n> In 0512eabd91 (\"sequencer: stop abbreviating stopped-sha file\",\n> 2020-09-25), Git was taught both to write full object names to the\n> stopped-sha file and to require full object names when reading. However,\n> a user would experience a problem if they started an interactive rebase\n> using an old version of Git and then continued with a current version of\n> Git (for example, if the system version of Git was updated in the\n> meantime).\n>\n> Teach Git to allow object names of any length when reading.\n>\n> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>\n> ---\n> Not sure how big of a problem this will potentially be, but I noticed it\n> and wanted to mention it.\n\nIf I didn't mention that I deliberately chose to declare it a\nnon-issue during the discussion, that was my mistake.\n\nIf this is not causing real-world problem, I'd in principle prefer\nto keep the \"expect full hex when reading what's supposed to be\nwritten as full hex\" sanity checking, but this is a file that is\npurely internal between the two invocation of the program and not\neven known by mere end users, so I could be persuaded to change my\nmind on this particular case.\n\nAssuming that the \"use case\" is real, the patch is obviously\ncorrect.  We won't write anything but a commit object name so\nusing oid_committish() would not change the behaviour in good\ncases.\n\nThanks.\n\n> ---\n>  sequencer.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/sequencer.c b/sequencer.c\n> index 00acb12496..37847d4534 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -2653,7 +2653,7 @@ static int read_populate_opts(struct replay_opts *opts)\n>  \t\t}\n>  \n>  \t\tif (read_oneliner(&buf, rebase_path_squash_onto(), 0)) {\n> -\t\t\tif (get_oid_hex(buf.buf, &opts->squash_onto) < 0) {\n> +\t\t\tif (get_oid_committish(buf.buf, &opts->squash_onto) < 0) {\n>  \t\t\t\tret = error(_(\"unusable squash-onto\"));\n>  \t\t\t\tgoto done_rebase_i;\n>  \t\t\t}\n"}]}