-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stg operations should respect notes.rewriteRef
configuration option
#108
Comments
notes.rewriteRef
notes.rewriteRef
configuration option
notes.rewriteRef
configuration optionnotes.rewriteRef
configuration option
Thank you for writing this issue, @NonLogicalDev. I like the idea of improving StGit's interoperability with git notes. That said, I'm trying to understand the behavior being asked for, but not sure if I fully understand. Is it sufficient for StGit to use the And it seems like StGit would need the default of It would help me immensely if a test case or two could be enumerated for this feature. Doesn't have to necessarily be a proper test for StGit's test suite; could just be some shell script that illustrates the desired behavior. |
Hey @jpgrayson, I keep meaning to submit a PR for this, time permitting. I will take care of this eventually. It has been a while, I will have to take a closer look but I believe https://git-scm.com/docs/git-notes#Documentation/git-notes.txt-notesrewriteltcommandgt |
@jpgrayson I added a test case, and a very dirty implementation. (#165) It does seem like extra configuration is required to get notes to copy.
Apparently git amend behavior
git amend behavior (with rewriteRef set)
Seems like git by default actually does NOT preserve (rewrite) notes when doing amend, until you tell it to that is. Relevant blurb from git manual:
|
@jpgrayson I guess if stacked git were to operate in parity to Git it would also respect the Alternatively we could check if
That would preserve backwards compatibility and minimize surprises to users, because I have a feeling most view |
Problem:
STG is using
git notes copy <old> <new>
command to copy over notes upon modifying stack.This means that users only option is to set
core.notesRef
(if the noted they want to preserve are anything other thanrefs/notes/commits
)But even this workaround allows to carry over only one ref, all others will be lost.
Background:
This is a fairly niche problem, but some tools use notes to attach metadata to commits, and currently the best course of action is to set
core.notesRef
to the notes ref you care about the most. And abandon tools that rely on other refs.Proposed Solution:
STG should respect
notes.rewriteRef
configuration.It is a multi value configuration that allows user to instruct git to carry over notes during rebase and amend operations.
It also supports glob expressions.
Git has an option
--for-rewrite
ongit notes copy
, which is, bizarrely, undocumented:https://github.com/git/git/blob/7e391989789db82983665667013a46eabc6fc570/builtin/notes.c#L498
You can also find examples in tests:
https://github.com/git/git/blob/7e391989789db82983665667013a46eabc6fc570/t/t3301-notes.sh#L1117
This option comes with a small catch that it forces
git notes copy
into reading pairs of references from stdin.So rather than:
The correct way to invoke this would be:
This has a side effect of letting the user configure merge strategy via
notes.rewrite.stg = true|false
.Code that needs to be tweaked:
stgit/stgit/lib/git/repository.py
Lines 472 to 475 in 68f9498
The text was updated successfully, but these errors were encountered: