{"thread":{"id":"60190","subject":"[PATCH] sequencer: fix error message on failure to copy SQUASH_MSG","startedAt":"2023-09-03T15:11:40Z","lastAt":"2023-09-04T10:10:34Z","messageCount":2,"participants":["Oswald Buddenhagen","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"481353","messageId":"20230903151132.739136-1-oswald.buddenhagen@gmx.de","threadId":"60190","inReplyTo":null,"subject":"[PATCH] sequencer: fix error message on failure to copy SQUASH_MSG","fromName":"Oswald Buddenhagen","fromEmail":"oswald.buddenhagen@gmx.de","sentAt":"2023-09-03T15:11:32Z","receivedAt":"2023-09-03T15:11:40Z","isPatch":true,"sender":{"key":"oswald.buddenhagen@gmx.de","avatar":"https://avatars.githubusercontent.com/u/812380?v=4"},"body":"The message talked about renaming, while the actual action is copying.\nThis was introduced by 6e98de72c (\"sequencer (rebase -i): add support\nfor the 'fixup' and 'squash' commands\", 2017-01-02).\n\nSigned-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>\n\n---\ni didn't try verifying whether the action shouldn't be actually be a\nmove, as i'm getting lost in this forest of files.\n\nCc: Johannes Schindelin <johannes.schindelin@gmx.de>\nCc: Phillip Wood <phillip.wood123@gmail.com>\nCc: Junio C Hamano <gitster@pobox.com>\n\n---\ntotally on a tangent, does someone feel like teaching copy_file() to try\nioctl(FICLONE) (i.e., reflink) first?\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex a66dcf8ab2..2f3d7d4eee 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2320,7 +2320,7 @@ static int do_pick_commit(struct repository *r,\n \t\t\tconst char *dest = git_path_squash_msg(r);\n \t\t\tunlink(dest);\n \t\t\tif (copy_file(dest, rebase_path_squash_msg(), 0666)) {\n-\t\t\t\tres = error(_(\"could not rename '%s' to '%s'\"),\n+\t\t\t\tres = error(_(\"could not copy '%s' to '%s'\"),\n \t\t\t\t\t    rebase_path_squash_msg(), dest);\n \t\t\t\tgoto leave;\n \t\t\t}\n-- \n2.40.0.152.g15d061e6df\n\n"},{"id":"481364","messageId":"553482a5-e7cc-47ed-9279-307f258748ca@gmail.com","threadId":"60190","inReplyTo":"20230903151132.739136-1-oswald.buddenhagen@gmx.de","subject":"Re: [PATCH] sequencer: fix error message on failure to copy SQUASH_MSG","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2023-09-04T10:10:29Z","receivedAt":"2023-09-04T10:10:34Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 03/09/2023 16:11, Oswald Buddenhagen wrote:\n> The message talked about renaming, while the actual action is copying.\n> This was introduced by 6e98de72c (\"sequencer (rebase -i): add support\n> for the 'fixup' and 'squash' commands\", 2017-01-02).\n> \n> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>\n> \n> ---\n> i didn't try verifying whether the action shouldn't be actually be a\n> move, as i'm getting lost in this forest of files.\n\nThis looks good, thanks. I think copying the file is OK. We're creating \n.git/SQUASH_MSG as a convenience in case the user decides to commit the \nconflict resolution themselves rather than leaving it to \"rebase \n--continue\". I don't think we reuse the contents of \nrebase_path_squash_msg() when tho rebase continues but copying it \ncertainly isn't wrong and we're not in a hot path where we need to worry \nabout the cost of copying a small file.\n\nBest Wishes\n\nPhillip\n\n> Cc: Johannes Schindelin <johannes.schindelin@gmx.de>\n> Cc: Phillip Wood <phillip.wood123@gmail.com>\n> Cc: Junio C Hamano <gitster@pobox.com>\n> \n> ---\n> totally on a tangent, does someone feel like teaching copy_file() to try\n> ioctl(FICLONE) (i.e., reflink) first?\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 a66dcf8ab2..2f3d7d4eee 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -2320,7 +2320,7 @@ static int do_pick_commit(struct repository *r,\n>   \t\t\tconst char *dest = git_path_squash_msg(r);\n>   \t\t\tunlink(dest);\n>   \t\t\tif (copy_file(dest, rebase_path_squash_msg(), 0666)) {\n> -\t\t\t\tres = error(_(\"could not rename '%s' to '%s'\"),\n> +\t\t\t\tres = error(_(\"could not copy '%s' to '%s'\"),\n>   \t\t\t\t\t    rebase_path_squash_msg(), dest);\n>   \t\t\t\tgoto leave;\n>   \t\t\t}\n\n"}]}