> -----Original Message----- > From: Ross Burton <ross.bur...@arm.com> > Sent: den 19 februari 2024 13:56 > To: Peter Kjellerstedt <peter.kjellerst...@axis.com> > Cc: openembedded-core@lists.openembedded.org > Subject: Re: [OE-core] [PATCHv2 5/5] lib/oe/patch: Use git notes to store > the filenames for the patches > > On 19 Feb 2024, at 01:28, Peter Kjellerstedt via lists.openembedded.org > <peter.kjellerstedt=axis....@lists.openembedded.org> wrote: > > + @staticmethod > > + def addNote(repo, ref, key, value=None): > > + note = key + (": %s" % value if value else "") > > + notes_ref = GitApplyTree.notes_ref > > + runcmd(["git", "config", "notes.rewriteMode", "ignore"], repo) > > + runcmd(["git", "config", "notes.displayRef", notes_ref, > > notes_ref], repo) > > + runcmd(["git", "config", "notes.rewriteRef", notes_ref, > > notes_ref], repo) > > + runcmd(["git", "notes", "--ref", notes_ref, "append", "-m", note, > > ref], repo) > > It feels like the config calls could be done once when setting up the > repository somehow?
While I do agree that would be better, the reason I did it like this is because there is nothing in this class that is related to setting up the repositories that are used while calling this function. Thus it felt wrong to rely on that the repository has been configured correctly beforehand for the function to work as intended. > > + # This loop, which is used to remove any line that > > + # starts with "%% original patch", is kept for > > backwards > > + # compatibility. If/when that compatibility is > > dropped, > > + # it can be replaced with code to just read the > > first > > + # line of the patch file to get the SHA-1, and the > > code > > + # below that writes the modified patch file can be > > + # replaced with a simple file move. > > This is all that is needed for the new code to work correctly with an old > worktree, right? Well, it relies on the fallback (i.e., the exception clause) in GitApplyTree.getNotes() that reads from the commit message in case a Git note cannot be found. Do you want me to extend the comment so that it includes that refence as well? > > Ross //Peter
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#195880): https://lists.openembedded.org/g/openembedded-core/message/195880 Mute This Topic: https://lists.openembedded.org/mt/104439182/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-