Re: Criteria for Acceptable Git to ChangeLog
[[[ To any NSA and FBI agents reading my email: please consider]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] I'm sorry it took me so long to read this. The example you chose involves changes only clearly inside the brace-pairs of the entities. That is the easy case; naturally it works. Here's an example that diff -p does not handle right. *** old.c 2018-06-03 20:43:53.505781957 -0400 --- old2.c 2018-06-03 20:44:40.776000965 -0400 *** union that *** 17,23 static struct this foo; int ! main (int argc, char **argv) { /* A comment */ /* Another comment */ --- 17,23 static struct this foo; int ! main (int argc, char **argv, char **env) { /* A comment */ /* Another comment */ Making a substitute for -p that will be correct essentially all the time is not rocket science. People who want stop manually writing about the entities changed, please do that work to give us a real and full automatic substitute. -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)
Re: Criteria for Acceptable Git to ChangeLog
I did a few experiments and it seems to me, that GNU diff's -p option already does what you want. Can you check the following example to see if it does what you require (the entities are in the lines marked with ** at the end of this mail). Example: File old.c: struct this { int x; long y; short z; }; union that { char a; unsigned char b; signed char c; }; static struct this foo; int main (int argc, char **argv) { /* A comment */ /* Another comment */ return 0; } And File new.c: struct this { int x; long y; short z; char n; }; union that { char a; unsigned char b; signed char c; void *ppp; }; static struct this foo; int main (int argc, char **argv) { /* A comment */ /* Another comment */ int xx; return 0; } When compared using diff -p old.c new.c gives: *** old.c Thu May 17 16:39:13 2018 --- new.c Thu May 17 16:39:34 2018 *** struct this *** 3,8 --- 3,10 int x; long y; short z; + + char n; }; *** union that *** 11,16 --- 13,19 char a; unsigned char b; signed char c; + void *ppp; }; *** main (int argc, char **argv) *** 21,25 --- 24,29 { /* A comment */ /* Another comment */ + int xx; return 0; } signature.asc Description: Digital signature
Re: Criteria for Acceptable Git to ChangeLog
[[[ To any NSA and FBI agents reading my email: please consider]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I'm not sure how to understand "not in global scope". > Could you clarify that? > I mean a varible which is not local to a function, and is not declared static. I would say, rather, that any variable definition which is not inside of a function is an entity. This would not include extern declarations -- they are not definitions. > I hadn't thought about c++ much. classes are not a problem. They are just > special cases of structs. However things like templates can make the > parsing rather tricky. I don't know what templates look like, but if they are no inside of some other entity, surely they should be treated as entities. > In most cases, an entity is a maximal syntactic construct. > However, if something is not maximal but has an > openbrace in column zero, it is also an entity. > I don't know what the term "maximal syntactic construct" means. Can > you explain. A syntactic construct is maximal if it is not contained in some other syntactic construct. "Maximal" is a common concept in mathematics. -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) Skype: No way! See https://stallman.org/skype.html.
Re: Criteria for Acceptable Git to ChangeLog
On Tue, May 15, 2018 at 10:50:23PM -0400, Richard Stallman wrote: > * functions > * variables not in global scope I'm not sure how to understand "not in global scope". Could you clarify that? I mean a varible which is not local to a function, and is not declared static. Anyway, entities in C include functions, file-scope structures, file-scope unions, file-scope variables, and macros. In C++ they would also include class definitions -- and is there anything else? I hadn't thought about c++ much. classes are not a problem. They are just special cases of structs. However things like templates can make the parsing rather tricky. In most cases, an entity is a maximal syntactic construct. However, if something is not maximal but has an openbrace in column zero, it is also an entity. I don't know what the term "maximal syntactic construct" means. Can you explain. J' -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. signature.asc Description: Digital signature
Re: Criteria for Acceptable Git to ChangeLog
[[[ To any NSA and FBI agents reading my email: please consider]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > * files I don't think of a file as an entity. Rather, a file contains entities. > * functions > * variables not in global scope I'm not sure how to understand "not in global scope". Could you clarify that? Anyway, entities in C include functions, file-scope structures, file-scope unions, file-scope variables, and macros. In C++ they would also include class definitions -- and is there anything else? > I don't think it's necessary to identify, for example the variable "i" in > for (int i = 0; i < 10; ++i) I agree on that. In most cases, an entity is a maximal syntactic construct. However, if something is not maximal but has an openbrace in column zero, it is also an entity. -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) Skype: No way! See https://stallman.org/skype.html.
Re: Criteria for Acceptable Git to ChangeLog
On Sat, May 12, 2018 at 05:19:55PM -0400, Richard Stallman wrote: I think we need something that will generate, from the repo, the list of entities changed -- reliably enough that errors are rare and not a problem. Let us restrict the discussion to C for the time being. I think in this case "entities" are : * files * functions * variables not in global scope I don't think it's necessary to identify, for example the variable "i" in for (int i = 0; i < 10; ++i) Do you have a different understanding of what entities are ? As for the descriptions of the changes in each entity, that is important when the change in an entity is complex enough to want description. We could put that sort of info in commit messages, by saying something about how the change works. I am of the opinion that a commit message/changelog description should say *why* a change was made, rather than to elaborate or summarize on *what* change was made. After all, what change was made can be determined from the repository, and if any explanation is necessary they should be put in as comments in the code. J' -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. signature.asc Description: Digital signature
Re: Criteria for Acceptable Git to ChangeLog
[[[ To any NSA and FBI agents reading my email: please consider]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > So I don't think this discussion is going to move further unless we > start talking about the minimum acceptable criteria for a scm-to-change-log > program should be. I think we need something that will generate, from the repo, the list of entities changed -- reliably enough that errors are rare and not a problem. As for the descriptions of the changes in each entity, that is important when the change in an entity is complex enough to want description. We could put that sort of info in commit messages, by saying something about how the change works. -- Dr Richard Stallman President, Free Software Foundation (https://gnu.org, https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) Skype: No way! See https://stallman.org/skype.html.