Skip to contentSkip to conversation

sequencer: fix error message on failure to copy SQUASH_MSG

PATCH In review Oswald Buddenhagen 2 participants 2 messages Sep 3, 2023 – Sep 4, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sequencer: fix error message on failure to copy SQUASH_MSG

The message talked about renaming, while the actual action is copying. This was introduced by 6e98de72c ("sequencer (rebase -i): add support for the 'fixup' and 'squash' commands", 2017-01-02).

---
i didn't try verifying whether the action shouldn't be actually be a move, as i'm getting lost in this forest of files.

Cc Johannes Schindelin <[email protected]>
Cc Phillip Wood <[email protected]>
Cc Junio C Hamano <[email protected]>

---
totally on a tangent, does someone feel like teaching copy_file() to try ioctl(FICLONE) (i.e., reflink) first?

---
 sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sequencer.c +1 -1
index a66dcf8ab2..2f3d7d4eee 100644
@@ -2320,7 +2320,7 @@ static int do_pick_commit(struct repository *r,
 			const char *dest = git_path_squash_msg(r);
 			unlink(dest);
 			if (copy_file(dest, rebase_path_squash_msg(), 0666)) {
-				res = error(_("could not rename '%s' to '%s'"),
+				res = error(_("could not copy '%s' to '%s'"),
 					    rebase_path_squash_msg(), dest);
 				goto leave;
 			}
Signature · 1 line
2.40.0.152.g15d061e6df
#1 lore raw
Quoted 9 lines · Oswald Buddenhagen

The message talked about renaming, while the actual action is copying. This was introduced by 6e98de72c ("sequencer (rebase -i): add support for the 'fixup' and 'squash' commands", 2017-01-02).

---
i didn't try verifying whether the action shouldn't be actually be a move, as i'm getting lost in this forest of files.

This looks good, thanks. I think copying the file is OK. We're creating .git/SQUASH_MSG as a convenience in case the user decides to commit the conflict resolution themselves rather than leaving it to "rebase --continue". I don't think we reuse the contents of rebase_path_squash_msg() when tho rebase continues but copying it certainly isn't wrong and we're not in a hot path where we need to worry about the cost of copying a small file.

Best Wishes

Phillip

Quoted 24 lines
Cc Johannes Schindelin <[email protected]>
Cc Phillip Wood <[email protected]>
Cc Junio C Hamano <[email protected]>

---
totally on a tangent, does someone feel like teaching copy_file() to try ioctl(FICLONE) (i.e., reflink) first?

---
  sequencer.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
sequencer.c +1 -1
index a66dcf8ab2..2f3d7d4eee 100644
@@ -2320,7 +2320,7 @@ static int do_pick_commit(struct repository *r,
  			const char *dest = git_path_squash_msg(r);
  			unlink(dest);
  			if (copy_file(dest, rebase_path_squash_msg(), 0666)) {
-				res = error(_("could not rename '%s' to '%s'"),
+				res = error(_("could not copy '%s' to '%s'"),
  					    rebase_path_squash_msg(), dest);
  				goto leave;
  			}