attr: reformat git_attr_set_direction() function

Move the 'git_attr_set_direction()' up to be closer to the variables
that it modifies as well as a small formatting by renaming the variable
'new' to 'new_direction' so that it is more descriptive.

Update the comment about how 'direction' is used to read the state of
the world.  It should be noted that callers of
'git_attr_set_direction()' should ensure that other threads are not
making calls into the attribute system until after the call to
'git_attr_set_direction()' completes.  This function essentially acts as
reset button for the attribute system and should be handled with care.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2017-01-27 18:02:07 -08:00
committed by Junio C Hamano
parent 0787dafdcc
commit f0dd042148
2 changed files with 22 additions and 30 deletions

3
attr.h
View File

@@ -72,7 +72,8 @@ enum git_attr_direction {
GIT_ATTR_CHECKOUT,
GIT_ATTR_INDEX
};
void git_attr_set_direction(enum git_attr_direction, struct index_state *);
void git_attr_set_direction(enum git_attr_direction new_direction,
struct index_state *istate);
extern void attr_start(void);