Re: [PATCH v3 3/7] sequencer: use rebase_path_message()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 2, 2023, 22:02 UTC
- Message-ID
- <xmqqedkl6r1t.fsf@gitster.g>
- In-Reply-To
- <619e458b-218b-a790-dfb4-9200e201b513@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 21 quoted lines
> On 01/08/2023 18:23, Junio C Hamano wrote: >> "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes: >> >>> From: Phillip Wood <phillip.wood@dunelm.org.uk> >>> >>> Rather than constructing the path in a struct strbuf use the ready >>> made function to get the path name instead. This was the last >>> remaining use of the strbuf so remove it as well. >> The same comment about "get_dir() vs hardcoded rebase-merge" applies >> here, I think. And the same (1) assertion to ensure that we are in >> "rebase -i" when make_patch() is called should give us a sufficient >> safety valve, > > Agreed > >> or (2) instead of hardcoding rebase_path_message(), >> call it sequencer_path_message() and switch at runtime behaving the >> same way as get_dir(opts) based version, would also work. > > I think that would me misleading because cherry-pick/revert do not > create that file - they rely on "git commit" reading .git/MERGE_MSG
Fair enough.
Abusing the MERGE_MSG this way probably came from the "if 'commit' picks up whatever is left inside MERGE_MSG when it is run, reusing it for this operation (even though it clearly is not a 'merge') would be a way to do with the least effort, even if it does not make sense for those who will be reading the code 3 years from now on" kind of hackery. The file probably outgrew its name and we might want to rename it to a more appropriate name (it is "we gave control back to the user to help us resolve a mess in the working tree, and here is the message to be used when the user is done"; the "mess" no longer is limited to conflicts created during a "merge").
But it would be a major headache if end-user tools are relying on it, so it is not likely to happen anytime soon.
So, moving to hardcoded "rebase-merge", as long as we make sure make_patch() will only callable by "rebase -i" (and not something like "cherry-pick -i" people will wish to add in the future), I am fine with such a design.
Thanks.