shortlog: take the first populated line of the description
PATCH 1/1 shortlog: take the first populated line of the description
Way back the perl version of shortlog would take the first populated line of the commit body. The builtin version mearly takes the first line. This leads to empty shortlog entries when there is some viable text in the commit.
Reinstate this behaviour igoring all lines with nothing but whitespace.
---
This seems to be an improvement, returning to the original behaviour. I cannot think of any good reason not to take the first
populated line for a shortlog. The alternative less agressive
compromise might be to skip only completly empty lines at the start, but I am not sure that adds any value.
I seem to get a lot of these in converted SVN commits.
Comments?
-apw
--- builtin-shortlog.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
builtin-shortlog.c +3 -2
@@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log,else free (buffer); +/* Skip any leading whitespace, including any blank lines. */ +while (*oneline &&isspace (*oneline)) + oneline++; eol =strchr (oneline,'\n' );if (!eol) eol = oneline +strlen (oneline); -while (*oneline &&isspace (*oneline) && *oneline !='\n' ) - oneline++;if (!prefixcmp (oneline,"[PATCH" )) {char *eob =strchr (oneline,']' );if (eob && (!eol || eob < eol))
Quoted 17 lines · Andy Whitcroft
Way back the perl version of shortlog would take the first populated line of the commit body. The builtin version mearly takes the first line. This leads to empty shortlog entries when there is some viable text in the commit.
Reinstate this behaviour igoring all lines with nothing but whitespace.
Signed-off-by Andy Whitcroft <[email protected]>---
This seems to be an improvement, returning to the original behaviour. I cannot think of any good reason not to take the first
populated line for a shortlog. The alternative less agressive
compromise might be to skip only completly empty lines at the start, but I am not sure that adds any value.
Quoted 3 lines
I seem to get a lot of these in converted SVN commits.
Comments?
Maybe it is the SVN conversion that needs fixing?
Nicolas
Quoted 7 lines · Nicolas Pitre
On Wed, 5 Mar 2008, Andy Whitcroft wrote:
...Quoted 5 lines
... I cannot think of any good reason not to take the first
populated line for a shortlog. The alternative less agressive
compromise might be to skip only completly empty lines at the start, but I am not sure that adds any value.
Quoted 5 lines
Quoted 3 lines
I seem to get a lot of these in converted SVN commits.
Comments?
Maybe it is the SVN conversion that needs fixing?
I thought about saying the same, but I am of two minds.
It is likely that you would want to clean-up when importing, especially when you are planning to abandon the other system and switch to git. But you may want to have an import that is as close to the original as possible, excess blank lines in the log messages and all.
I think Andy's fix to make the output side take away unnecessary blank lines is unconditionally good.
I've added these three lines at the end of the log message.
This is often useful when dealing with commits imported from foreign SCMs that do not tidy up the log message of useless blank lines at the beginning.
Quoted 15 lines · Junio C Hamano
Quoted 7 lines · Nicolas Pitre
On Wed, 5 Mar 2008, Andy Whitcroft wrote:
...Quoted 5 lines
... I cannot think of any good reason not to take the first
populated line for a shortlog. The alternative less agressive
compromise might be to skip only completly empty lines at the start, but I am not sure that adds any value.Quoted 5 lines
Quoted 3 lines
I seem to get a lot of these in converted SVN commits.
Comments?
Maybe it is the SVN conversion that needs fixing?
Quoted 7 lines
I thought about saying the same, but I am of two minds.
It is likely that you would want to clean-up when importing, especially when you are planning to abandon the other system and switch to git. But you may want to have an import that is as close to the original as possible, excess blank lines in the log messages and all.
I don't think excess blank lines at the _beginning_ of the commit log has any value worth preserving though.
Quoted 2 lines
I think Andy's fix to make the output side take away unnecessary blank lines is unconditionally good.
It is not "bad" in itself. However that feels like papering over another problem which IMHO has greater merits to be fixed. We have given special semantics to the first line of a commit log in many other places now, so unless all those places are also made aware of substandard commit logs too, I think it would be more productive to make sure those logs are semi sensible upon entering Git in the first place instead.
Nicolas
Quoted 5 lines · Nicolas Pitre
Quoted 2 lines · Junio C Hamano
I think Andy's fix to make the output side take away unnecessary blank lines is unconditionally good.
Quoted 7 lines
It is not "bad" in itself. However that feels like papering over another problem which IMHO has greater merits to be fixed. We have given special semantics to the first line of a commit log in many other places now, so unless all those places are also made aware of substandard commit logs too, I think it would be more productive to make sure those logs are semi sensible upon entering Git in the first place instead.
My understanding of the current status when I wrote that message was that everybody at commit.c layer (that is, everybody except shortlog) strips such garbage. Do you have a specific broken one in mind?
I suspect --pretty=format:%s might be broken; I didn't check.
Hi,
Quoted 9 lines · Andy Whitcroft
builtin-shortlog.c +1
-0@@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log,else free (buffer); +/* Skip any leading whitespace, including any blank lines. */
builtin-shortlog.c static void insert_one_record(struct shortlog *log, · line 81
Quoted 10 lines
builtin-shortlog.c +2
-2+while (*oneline &&isspace (*oneline)) + oneline++; eol =strchr (oneline,'\n' );if (!eol) eol = oneline +strlen (oneline); -while (*oneline &&isspace (*oneline) && *oneline !='\n' ) - oneline++;if (!prefixcmp (oneline,"[PATCH" )) {char *eob =strchr (oneline,']' );if (eob && (!eol || eob < eol))
Why do you move the code around? Makes it harder to read your patch. Besides, you now strip empty lines at the beginning of the commit messages, right? Who produces such a thing?
Ciao,
Dscho
Quoted 12 lines · Johannes Schindelin
Hi,
Quoted 8 lines · Andy Whitcroft
builtin-shortlog.c +0
-0@@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log,else free (buffer);
Quoted 15 lines
builtin-shortlog.c static void insert_one_record(struct shortlog *log, · line 81
Quoted 11 lines
builtin-shortlog.c +3
-2+/* Skip any leading whitespace, including any blank lines. */ +while (*oneline &&isspace (*oneline)) + oneline++; eol =strchr (oneline,'\n' );if (!eol) eol = oneline +strlen (oneline); -while (*oneline &&isspace (*oneline) && *oneline !='\n' ) - oneline++;if (!prefixcmp (oneline,"[PATCH" )) {char *eob =strchr (oneline,']' );if (eob && (!eol || eob < eol))Why do you move the code around? Makes it harder to read your patch. Besides, you now strip empty lines at the beginning of the commit messages, right? Who produces such a thing?
I've not moved the code as such. I added a loop to drop the leading whitespace. That made the second loop redundant as its job is already done, so I killed it.
The point of the patch is to strip the empty lines at the start of the commit. I am ending up with them in my repo mostly due to imcompetant users of SVN I suspect. The main driver is that I have those and the original non-C version coped and the builtin does not.
Now if people think that its a stupid idea I might suggest it could be optional?
-apw
Hi,
Quoted 28 lines · Andy Whitcroft
Quoted 10 lines · Johannes Schindelin
Quoted 8 lines · Andy Whitcroft
builtin-shortlog.c +0
-0@@ -70,11 +70,12 @@ static void insert_one_record(struct shortlog *log,else free (buffer);Quoted 15 lines
builtin-shortlog.c static void insert_one_record(struct shortlog *log, · line 81
Quoted 11 lines
builtin-shortlog.c +3
-2+/* Skip any leading whitespace, including any blank lines. */ +while (*oneline &&isspace (*oneline)) + oneline++; eol =strchr (oneline,'\n' );if (!eol) eol = oneline +strlen (oneline); -while (*oneline &&isspace (*oneline) && *oneline !='\n' ) - oneline++;if (!prefixcmp (oneline,"[PATCH" )) {char *eob =strchr (oneline,']' );if (eob && (!eol || eob < eol))Why do you move the code around? Makes it harder to read your patch. Besides, you now strip empty lines at the beginning of the commit messages, right? Who produces such a thing?
Quoted 1 line
I've not moved the code as such.
Well, it sure looks like that. Maybe you want to make it look like that even more?
Quoted 7 lines
The point of the patch is to strip the empty lines at the start of the commit. I am ending up with them in my repo mostly due to imcompetant users of SVN I suspect. The main driver is that I have those and the original non-C version coped and the builtin does not.
Now if people think that its a stupid idea I might suggest it could be optional?
No, I think with an explanation like this in the commit message, it is good as-is.
Ciao,
Dscho