Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
Doug, > > --- save as .git/hooks/sendemail-validate --- > > #!/bin/sh > > > > set -e > > > > changeid=$(sed 's/^Change-Id: \(I.*\)$/\1/;t;d' $1) > > date=$(date +%s) > > sed 's/^Change-Id: I.*$//;T;d' -i $1 > > sed "s/^From: /Message-Id: <$date-$changeid@changeid>\nFrom: /" -i $1 > > #--- end script --- > Do you have any idea how to encourage adoption of your git hook? > Would it make sense to do something like check it in to the Linux > kernel somewhere? I still don't really know, but I wanted to post that I changed it now, because of uniqueness problems if there *isn't* a changeid, and to make the format a bit more like yours: --- save as .git/hooks/sendemail-validate --- #!/bin/bash set -e changeid=$(sed 's/^Change-Id: \(I.*\)$/\1/;t;d' $1) # let git do its own if there's no change-id [ "$changeid" = "" ] && exit 0 commit=$(sed 's/^From.*\([0-9a-fA-F]\{40\}\).*/\1/;t;d' $1) # must have a commit ID - if this fails git changed [ "$commit" == "" ] && exit 2 commit=${commit:0:12} date=$(date +%Y%m%d%H%M%S) # remove change-id sed 's/^Change-Id: I.*$//;T;d' -i $1 # and add message-id sed "s/^From: /Message-Id: <$date.$commit.$changeid@changeid>\nFrom: /" -i $1 #--- end script --- (also at https://p.sipsolutions.net/a1ebdd33abb598b4.txt) johannes ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
Hi, On Thu, Sep 26, 2019 at 6:50 PM Simon Glass wrote: > > Hi Doug, > > On Tue, 3 Sep 2019 at 13:15, Douglas Anderson wrote: > > > > As per the centithread on ksummit-discuss [1], there are folks who > > feel that if a Change-Id is present in a developer's local commit that > > said Change-Id could be interesting to include in upstream posts. > > Specifically if two commits are posted with the same Change-Id there's > > a reasonable chance that they are either the same commit or a newer > > version of the same commit. Specifically this is because that's how > > gerrit has trained people to work. > > > > There is much angst about Change-Id in upstream Linux, but one thing > > that seems safe and non-controversial is to include the Change-Id as > > part of the string of crud that makes up a Message-Id. > > > > Let's give that a try. > > > > In theory (if there is enough adoption) this could help a tool more > > reliably find various versions of a commit. This actually might work > > pretty well for U-Boot where (I believe) quite a number of developers > > use patman, so there could be critical mass (assuming that enough of > > these people also use a git hook that adds Change-Id to their > > commits). I was able to find this git hook by searching for "gerrit > > change id git hook" in my favorite search engine. > > > > In theory one could imagine something like this could be integrated > > into other tools, possibly even git-send-email. Getting it into > > patman seems like a sane first step, though. > > > > NOTE: this patch is being posted using a patman containing this patch, > > so you should be able to see the Message-Id of this patch and see that > > it contains my local Change-Id, which ends in 2b9 if you want to > > check. > > > > [1] > > https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2019-August/006739.html > > > > Signed-off-by: Douglas Anderson > > --- > > > > Changes in v2: > > - Add a "v" before the version part of the Message-Id > > - Reorder the parts of the Message-Id as per Johannes. > > > > tools/patman/README | 8 +- > > tools/patman/commit.py | 3 ++ > > tools/patman/patchstream.py | 57 +++-- > > 3 files changed, 65 insertions(+), 3 deletions(-) > > Sadly this seems to cause a test failure (patman --test). Can you please > check? It's been so long since I worked on patman that I totally forgot about patman --test. Doh! I've posted v3 and tests pass now. Hopefully it looks OK? -Doug ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
Hi Doug, On Tue, 3 Sep 2019 at 13:15, Douglas Anderson wrote: > > As per the centithread on ksummit-discuss [1], there are folks who > feel that if a Change-Id is present in a developer's local commit that > said Change-Id could be interesting to include in upstream posts. > Specifically if two commits are posted with the same Change-Id there's > a reasonable chance that they are either the same commit or a newer > version of the same commit. Specifically this is because that's how > gerrit has trained people to work. > > There is much angst about Change-Id in upstream Linux, but one thing > that seems safe and non-controversial is to include the Change-Id as > part of the string of crud that makes up a Message-Id. > > Let's give that a try. > > In theory (if there is enough adoption) this could help a tool more > reliably find various versions of a commit. This actually might work > pretty well for U-Boot where (I believe) quite a number of developers > use patman, so there could be critical mass (assuming that enough of > these people also use a git hook that adds Change-Id to their > commits). I was able to find this git hook by searching for "gerrit > change id git hook" in my favorite search engine. > > In theory one could imagine something like this could be integrated > into other tools, possibly even git-send-email. Getting it into > patman seems like a sane first step, though. > > NOTE: this patch is being posted using a patman containing this patch, > so you should be able to see the Message-Id of this patch and see that > it contains my local Change-Id, which ends in 2b9 if you want to > check. > > [1] > https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2019-August/006739.html > > Signed-off-by: Douglas Anderson > --- > > Changes in v2: > - Add a "v" before the version part of the Message-Id > - Reorder the parts of the Message-Id as per Johannes. > > tools/patman/README | 8 +- > tools/patman/commit.py | 3 ++ > tools/patman/patchstream.py | 57 +++-- > 3 files changed, 65 insertions(+), 3 deletions(-) Sadly this seems to cause a test failure (patman --test). Can you please check? Regards, SImon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
Hi Doug, > > Actually, the important part for me is to be to be able to have change- > > ids locally (e.g. for working with gerrit), and not have that leak out > > to the community (that doesn't like them). > > > > As a maintainer in the community, I'll also need to change the > > .git/hooks/commit-msg script that comes with gerrit to not add a Change- > > Id if the commit comes with a Link: tag already, but that should be > > easy. > > Do you have any idea how to encourage adoption of your git hook? > Would it make sense to do something like check it in to the Linux > kernel somewhere? Not sure, that might backfire completely into getting modified to be a hook that simply *strips* it, rather than preserving it in the message ID? I suspect one thing that might help would be to advertise such a hook widely where the users are most likely to be, with gerrit? I for one mostly added this because I need to use gerrit sometimes, and (1) stripping the change IDs manually is annoying, and (2) stripping the change IDs means I can't actually track my own patches Also, I did in the end modify my commit-msg hook to abort if it finds a Link: @@ ... @@ if grep -i '^Change-Id:' "$MSG" >/dev/null then return fi + if grep -i '^Link:' "$MSG" >/dev/null + then + return + fi id=`_gen_ChangeId` and have another hook: $ cat .git/hooks/applypatch-msg #!/bin/sh . git-sh-setup # the sfid stuff is sometimes added by my spam filter ... perl -pi -e 's|^Message-Id:\s*]+)>?(\s*\(sfid-.*)?$|Link: https://lore.kernel.org/r/$1|g;' "$1" test -x "$GIT_DIR/hooks/commit-msg" && exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} : (EOF) that adds the link to patches I pick up from others (since I'm also a maintainer). Combined, this means I no longer have to worry about change IDs getting upstream into my pull requests (that I send out as a kernel maintainer, if I edit patches I've applied) while I still create them for things I author locally. This relies on the fact that I even send out my own patches to the list, and then apply them from there ... at least usually, to give others any idea. Anyway, what's the point of all that discussion? I *mostly* did this out of necessity, to avoid having to manually edit out the change-IDs when I send patches or when I push code out to kernel.org after editing patches I've applied from others, but I can still create them locally by default for the cases where I have to use gerrit. Not sure if this is the case for many people though, I could just have used different kernel trees for all those different roles, it's just harder for me to manage. Ultimately, to drive adoption, I see two ways (1) convince people (other than Linus etc.) that commit tags are useful, and those who are convinced can use this stuff to maintain it across the kernel workflow (assuming the maintainer uses a script such as the apply-msg above, but that seems to be picking up adoption) (2) show it to those who have a need to work with gerrit or similar like me, for whom it covers not sending out the frowned-upon change-IDs to the Linux community. For (1), I guess this should also come with the right commit-msg hook and the sendemail-validate, since they don't already have the commit-msg hook from gerrit. johannes ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
Johannes, On Thu, Sep 5, 2019 at 12:48 PM Johannes Berg wrote: > > On Tue, 2019-09-03 at 13:15 -0700, Douglas Anderson wrote: > > > > Let's give that a try. > > > > In theory (if there is enough adoption) this could help a tool more > > reliably find various versions of a commit. > > It's not quite as good as this (yet), but a very simple version of it > for git-send-email could be this: > > --- save as .git/hooks/sendemail-validate --- > #!/bin/sh > > set -e > > changeid=$(sed 's/^Change-Id: \(I.*\)$/\1/;t;d' $1) > date=$(date +%s) > sed 's/^Change-Id: I.*$//;T;d' -i $1 > sed "s/^From: /Message-Id: <$date-$changeid@changeid>\nFrom: /" -i $1 > #--- end script --- > > > It won't do the RFC/which patch of a series etc. but I consider that > less interesting. > > Actually, the important part for me is to be to be able to have change- > ids locally (e.g. for working with gerrit), and not have that leak out > to the community (that doesn't like them). > > As a maintainer in the community, I'll also need to change the > .git/hooks/commit-msg script that comes with gerrit to not add a Change- > Id if the commit comes with a Link: tag already, but that should be > easy. Do you have any idea how to encourage adoption of your git hook? Would it make sense to do something like check it in to the Linux kernel somewhere? -Doug ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
On Tue, 3 Sep 2019 at 14:15, Douglas Anderson wrote: > > As per the centithread on ksummit-discuss [1], there are folks who > feel that if a Change-Id is present in a developer's local commit that > said Change-Id could be interesting to include in upstream posts. > Specifically if two commits are posted with the same Change-Id there's > a reasonable chance that they are either the same commit or a newer > version of the same commit. Specifically this is because that's how > gerrit has trained people to work. > > There is much angst about Change-Id in upstream Linux, but one thing > that seems safe and non-controversial is to include the Change-Id as > part of the string of crud that makes up a Message-Id. > > Let's give that a try. > > In theory (if there is enough adoption) this could help a tool more > reliably find various versions of a commit. This actually might work > pretty well for U-Boot where (I believe) quite a number of developers > use patman, so there could be critical mass (assuming that enough of > these people also use a git hook that adds Change-Id to their > commits). I was able to find this git hook by searching for "gerrit > change id git hook" in my favorite search engine. > > In theory one could imagine something like this could be integrated > into other tools, possibly even git-send-email. Getting it into > patman seems like a sane first step, though. > > NOTE: this patch is being posted using a patman containing this patch, > so you should be able to see the Message-Id of this patch and see that > it contains my local Change-Id, which ends in 2b9 if you want to > check. > > [1] > https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2019-August/006739.html > > Signed-off-by: Douglas Anderson > --- > > Changes in v2: > - Add a "v" before the version part of the Message-Id > - Reorder the parts of the Message-Id as per Johannes. > > tools/patman/README | 8 +- > tools/patman/commit.py | 3 ++ > tools/patman/patchstream.py | 57 +++-- > 3 files changed, 65 insertions(+), 3 deletions(-) Reviewed-by: Simon Glass ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
On Thu, 2019-09-05 at 21:48 +0200, Johannes Berg wrote: > > As a maintainer in the community, I'll also need to change the > .git/hooks/commit-msg script that comes with gerrit to not add a Change- > Id if the commit comes with a Link: tag already, but that should be > easy. This, I should mention, is for the case where I apply a patch from somebody else (and while at it I use the script that adds a Link: tag to lore.kernel.org or some other archive recording the message-id), but then I modify the commit slightly and amend it. This would invoke the commit-msg hook and add a Change-Id, but that's not desired here. johannes ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] patman: Use the Change-Id, version, and prefix in the Message-Id
On Tue, 2019-09-03 at 13:15 -0700, Douglas Anderson wrote: > > Let's give that a try. > > In theory (if there is enough adoption) this could help a tool more > reliably find various versions of a commit. It's not quite as good as this (yet), but a very simple version of it for git-send-email could be this: --- save as .git/hooks/sendemail-validate --- #!/bin/sh set -e changeid=$(sed 's/^Change-Id: \(I.*\)$/\1/;t;d' $1) date=$(date +%s) sed 's/^Change-Id: I.*$//;T;d' -i $1 sed "s/^From: /Message-Id: <$date-$changeid@changeid>\nFrom: /" -i $1 #--- end script --- It won't do the RFC/which patch of a series etc. but I consider that less interesting. Actually, the important part for me is to be to be able to have change- ids locally (e.g. for working with gerrit), and not have that leak out to the community (that doesn't like them). As a maintainer in the community, I'll also need to change the .git/hooks/commit-msg script that comes with gerrit to not add a Change- Id if the commit comes with a Link: tag already, but that should be easy. johannes ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot