GSoC student
cover GSoC student
Hi! My name is Motroni Igor and I'm a Russian student who wants to apply for the GSoC developing some cool stuff for Git. As a microproject, I've made two little changes in my Git fork.
Modified flag field type in rev_list_info struct in bisect.h. There is
no need for flag field to be signed, as it is not supposed to be used as decimal.
Just a minor commit to trigger Travis Ci build
bisect.h | 2 +- notes.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/2 Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
From: Pontifik <[email protected]>
--- bisect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bisect.h +1 -1
@@ -16,7 +16,7 @@ extern struct commit_list *filter_skipped(struct commit_list *list,struct rev_list_info {struct rev_info *revs; -int flags; +unsigned int flags;int show_timestamp;int hdr_termination;const char *header_prefix;
Signature · 1 line
2.5.0
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
Quoted 1 line · Motroni Igor
From: Pontifik <[email protected]>
Here is a good place to put reasoning for why this is a good idea. I see you have a long subject, so maybe we can shorten the first line (down to less than ~ 80 characters) and put the longer explanation here.
How about:
bisect: use unsigned for flag field
The flags are usually used as a unsigned variable, because it makes bit operations easier to follow.
Quoted 16 lines
Signed-off-by Pontifik <[email protected]>From
Documentation/SubmittingPatches:
Also notice that a real name is used in the Signed-off-by: line. Please don't hide your real name.--- bisect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bisect.h +0
-0
bisect.h extern struct commit_list *filter_skipped(struct commit_list *list, · line 19
Quoted 5 lines
bisect.h +1
-1@@ -16,7 +16,7 @@ extern struct commit_list *filter_skipped(struct commit_list *list,struct rev_list_info {struct rev_info *revs; -int flags; +unsigned int flags;
You can also drop the int here and make it just
unsigned.
Quoted 10 lines
bisect.h +0
-1int show_timestamp;int hdr_termination;const char *header_prefix; --2.5.0
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
Quoted 7 lines · Stefan Beller
Quoted 1 line · Motroni Igor
From: Pontifik <[email protected]>
Here is a good place to put reasoning for why this is a good idea. I see you have a long subject, so maybe we can shorten the first line (down to less than ~ 80 characters) and put the longer explanation here.
Quoted 6 lines
How about:
bisect: use unsigned for flag field
The flags are usually used as a unsigned variable, because it makes bit operations easier to follow.
Yep, it's definitely a good idea to shorten subject in order to put more explanations in body of a message.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Pontifik <[email protected]>From
Documentation/SubmittingPatches:Quoted 2 lines
Also notice that a real name is used in the Signed-off-by: line. Please don't hide your real name.
Yep, I didn't mean to hide my real name, but coming across lots of new stuff confused me in distinguishing whether I'm asked to enter real name or nickname :)
Quoted 10 lines
Quoted 10 lines
--- bisect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)bisect.h +0
-0@@ -16,7 +16,7 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
Quoted 6 lines
bisect.h extern struct commit_list *filter_skipped(struct commit_list *list, · line 19
Quoted 4 lines
bisect.h +1
-1struct rev_list_info {struct rev_info *revs; -int flags; +unsigned int flags;You can also drop the int here and make it just
unsigned.
In fact, I just wanted to keep this code clear to understand (as I see this). Unsigned short is also unsigned, but a reader should know that "unsigned" type stands for "unsigned int". Anyway, I'll keep this in mind in future, thanks a lot.
Quoted 10 lines
Quoted 10 lines
bisect.h +0
-1int show_timestamp;int hdr_termination;const char *header_prefix; --2.5.0
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 Just a minor commit to trigger Travis Ci build
In reply to Motroni IgorFrom: Pontifik <[email protected]>
--- notes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
notes.c +2 -2
@@ -539,8 +539,8 @@ static unsigned char determine_fanout(struct int_node *tree, unsigned char n,return fanout +1 ; } -/* hex SHA1 + 19 * '/' + NUL */ -#define FANOUT_PATH_MAX 40 + 19 + 1 +/* hex SHA1 + 19 * '/' + NUL = 60 */ +#define FANOUT_PATH_MAX 60static void construct_path_with_fanout (const unsigned char *sha1,unsigned char fanout,char *path)
Signature · 1 line
2.5.0
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
In reply to workQuoted 12 lines · work
Quoted 11 lines · Stefan Beller
Quoted 1 line · Motroni Igor
From: Pontifik <[email protected]>
Here is a good place to put reasoning for why this is a good idea. I see you have a long subject, so maybe we can shorten the first line (down to less than ~ 80 characters) and put the longer explanation here.
How about:
Quoted 7 lines
Quoted 4 lines
bisect: use unsigned for flag field
The flags are usually used as a unsigned variable, because it makes bit operations easier to follow.
Yep, it's definitely a good idea to shorten subject in order to put more explanations in body of a message.
It is also very important is to explain that you audited all clients of this field and found that none of them treat the sign bit specially (for instance, by checking the value with '< 0' or some such), therefore such a change is safe, in addition to making the code clearer.
As an example, a diligent reviewer may wonder why you changed this field to 'unsigned' but not the 'flags' variable in rev-list.c:show_bisect_vars() to which this field is assigned. This is something your re-roll of the patch should take into consideration.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
bisect.h +0
-0@@ -16,7 +16,7 @@ extern struct commit_list *filter_skipped(struct commit_list *list,Quoted 7 lines
bisect.h extern struct commit_list *filter_skipped(struct commit_list *list, · line 19
Quoted 4 lines
bisect.h +1
-1struct rev_list_info {struct rev_info *revs; -int flags; +unsigned int flags;You can also drop the int here and make it just
unsigned.
Quoted 4 lines
In fact, I just wanted to keep this code clear to understand (as I see this). Unsigned short is also unsigned, but a reader should know that "unsigned" type stands for "unsigned int". Anyway, I'll keep this in mind in future, thanks a lot.
While it's true that 'unsigned short' is indeed never negative, the clueful reader should never accidentally interpret bare 'unsigned' as anything other than the native word size. However, I think what Stefan really meant is that, in this code base, it is (somewhat) more common to declare these "flags" variables as 'unsigned' rather than 'unsigned int':
% git grep -E 'unsigned\s+flags' | wc -l 80
% git grep -E 'unsigned\s+int\s+flags' | wc -l 57
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
Quoted 59 lines · Eric Sunshine
Quoted 12 lines · work
Quoted 11 lines · Stefan Beller
Quoted 1 line · Motroni Igor
From: Pontifik <[email protected]>
Here is a good place to put reasoning for why this is a good idea. I see you have a long subject, so maybe we can shorten the first line (down to less than ~ 80 characters) and put the longer explanation here.
How about:
Quoted 7 lines
Quoted 4 lines
bisect: use unsigned for flag field
The flags are usually used as a unsigned variable, because it makes bit operations easier to follow.
Yep, it's definitely a good idea to shorten subject in order to put more explanations in body of a message.
It is also very important is to explain that you audited all clients of this field and found that none of them treat the sign bit specially (for instance, by checking the value with '< 0' or some such), therefore such a change is safe, in addition to making the code clearer.
As an example, a diligent reviewer may wonder why you changed this field to 'unsigned' but not the 'flags' variable in rev-list.c:show_bisect_vars() to which this field is assigned. This is something your re-roll of the patch should take into consideration.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
bisect.h +0
-0@@ -16,7 +16,7 @@ extern struct commit_list *filter_skipped(struct commit_list *list,Quoted 7 lines
bisect.h extern struct commit_list *filter_skipped(struct commit_list *list, · line 19
Quoted 4 lines
bisect.h +1
-1struct rev_list_info {struct rev_info *revs; -int flags; +unsigned int flags;You can also drop the int here and make it just
unsigned.Quoted 4 lines
In fact, I just wanted to keep this code clear to understand (as I see this). Unsigned short is also unsigned, but a reader should know that "unsigned" type stands for "unsigned int". Anyway, I'll keep this in mind in future, thanks a lot.
While it's true that 'unsigned short' is indeed never negative, the clueful reader should never accidentally interpret bare 'unsigned' as anything other than the native word size. However, I think what Stefan really meant is that, in this code base, it is (somewhat) more common to declare these "flags" variables as 'unsigned' rather than 'unsigned int':
Quoted 4 lines
% git grep -E 'unsigned\s+flags' | wc -l 80
% git grep -E 'unsigned\s+int\s+flags' | wc -l 57
This is what I meant. (I did not give my grep terms as reasoning as they were not as exactly as yours. Redoing the search using your more exact terms however makes me wonder if my advice was the right thing.
% git grep -E 'unsigned\s+int\s+flags' ./*.h | wc -l 16
% git grep -E 'unsigned\s+flags' ./*.h | wc -l 17
So there is no pattern that the version without int is more common. Maybe my exposure to the code was accidentally in a way such that I ever only saw the version without int.
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
Quoted 2 lines · Stefan Beller
Maybe my exposure to the code was accidentally in a way such that I ever only saw the version without int.
The older part of the code tends to spell flag words with "unsigned" without "int", which is primarily historical fault of mine.
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
Yep. Thanks for your remarks. I have made a bit more research about using old rev_list_info struct (with signed int flag) and realized, that it doesn't appear in expressions, where using signed integer will differ from unsigned one. I'll take using 'unsigned' instead of 'unsigned int' in account, so if needed, I can remake the patch in order to get it accepted.
Quoted 7 lines · Junio C Hamano
Quoted 2 lines · Stefan Beller
Maybe my exposure to the code was accidentally in a way such that I ever only saw the version without int.
The older part of the code tends to spell flag words with "unsigned" without "int", which is primarily historical fault of mine.
Re: [PATCH 1/2] Modified flag field type in rev_list_info struct in bisect.h. There is no need for flag field to be signed, as it is not supposed to be used as decimal.
[please respond inline rather than top-posting]
Quoted 8 lines · work
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Stefan Beller
Maybe my exposure to the code was accidentally in a way such that I ever only saw the version without int.
The older part of the code tends to spell flag words with "unsigned" without "int", which is primarily historical fault of mine.
Quoted 6 lines
Yep. Thanks for your remarks. I have made a bit more research about using old
rev_list_infostruct (with signed int flag) and realized, that it doesn't appear in expressions, where using signed integer will differ from unsigned one.
I'll take using 'unsigned' instead of 'unsigned int' in account, so if needed, I can remake the patch in order to get it accepted.
If I read Junio's response correctly, "unsigned int" is indeed preferred over "unsigned", so no need to change that part, but the commit message needs improvement, and other reviewer comments should be addressed.
And, yes, the expectation is that you will re-roll the patch (one or more times) in response to issues pointed out by reviewers. As a GSoC applicant, this is especially important since a big part of working on this project is being responsive to review comments, and GSoC mentors will examine your reviewer interaction when selecting applicants.