Simplify mru.[ch] and related code by reusing the double-linked list
implementation from list.h instead of a custom one.
This commit is an intermediate step. Our final goal is to get rid of
mru.[ch] at all and inline all logic.
Signed-off-by: Olga Telezhnaia
Simplify mru.c, mru.h and related code by reusing the double-linked list
implementation from list.h instead of a custom one.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Create header for pretty.c to make formatting interface more structured.
This is a middle point, this file would be merged futher with other
files which contain formatting stuff.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Write some docs for functions in pretty.h.
Take it as a first draft, they would be changed later.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
pretty.h | 44
Create header for pretty.c to make formatting interface more structured.
This is a middle point, this file would be merged further with other
files which contain formatting stuff.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Write some docs for functions in pretty.h.
Take it as a first draft, they would be changed later.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
pretty.h | 44
Start using oid_object_info_extended(). So, if info from this function
is enough, we do not need to get and parse whole object (as it was before).
It's good for 3 reasons:
1. Some Git commands potentially will work faster.
2. It's much easier to add support for objectsize:disk and deltabase.
(I
Start using oid_object_info_extended(). So, if info from this function
is enough, we do not need to get and parse whole object (as it was before).
It's good for 3 reasons:
1. Some Git commands potentially will work faster.
2. It's much easier to add support for objectsize:disk and deltabase.
(I
Add %(objectsize:disk) support. It is still not working for deref:
I am thinking how to support it in a more elegant way.
Signed-off-by: Olga Telezhnaia
---
ref-filter.c | 21 -
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git
Add %(deltabase) support. It is still not working for deref:
I am thinking how to support it in a more elegant way.
Signed-off-by: Olga Telezhnaia
---
ref-filter.c | 12
1 file changed, 12 insertions(+)
diff --git a/ref-filter.c b/ref-filter.c
index
Add tests for %(objectsize:disk) atom.
Signed-off-by: Olga Telezhnaia
---
t/t6300-for-each-ref.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 295d1475bde01..570bb606045d7 100755
---
We could remove this because we have already checked that
at verify_ref_format function in ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 2 --
1 file
Start moving all formatting stuff from cat-file to ref-filter.
Start from simple moving, it would be integrated into
all ref-filter processes further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
No further need in mark_query parameter.
All logic related to expand_atom_into_fields is not needed here also,
we are doing that in ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Make function global for further using in cat-file.
Also added return value for handling errors.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 4 ++--
ref-filter.h | 3
Move logic related to getting object info from cat-file to ref-filter.
It will help to reuse whole formatting logic from ref-filter further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Not sure, but looks like there is no need in that checking.
There is a checking before whether it is null and we die in such case.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Moving from using expand_data to ref_array_item structure.
That helps us to reuse functions from ref-filter easier.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c |
Make valid_atom as a function parameter,
there could be another variable further.
Need that for further reusing of formatting logic in cat-file.c.
We do not need to allow users to pass their own valid_atom variable in
global functions like verify_ref_format because in the end we want to
have same
Continue migrating formatting logic from cat-file to ref-filter.
Reuse parse_ref_filter_atom for unifying all processes in ref-filter
and further reducing of expand_atom_into_fields function.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Need that for further reusing of formatting logic in cat-file.
Have plans to get rid of using expand_data in cat-file at all,
and use it only in ref-filter for collecting, formatting and printing
needed data.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Remove expand_atom_into_fields function and create same logic
in terms of ref-filter style.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 45
Add flag to ref_format struct so that we could pass needed info
to cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 4 ++--
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 103
Start using ref_format struct instead of simple char*.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Remove connection between expand_data variable
in cat-file and in ref-filter.
It will help further to get rid of using expand_data in cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Split expand_atom function into 2 different functions,
expand_atom_into_fields prepares variable for further filling,
(new) expand_atom creates resulting string.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Add is_cat flag, further it helps to get rid of cat_file_data field
in ref_format.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 8
Move logic related to skip_object_info into ref-filter,
so that cat-file does not use that field at all.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 7 +--
Add is_cat flag, further it helps to get rid of cat_file_data field
in ref_format.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 8
No further need in mark_query parameter.
All logic related to expand_atom_into_fields is not needed here also,
we are doing that in ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Rename some variables for easier reading.
They point not to values, but to arrays.
Added "s" ending so that it could be obvious.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Remove connection between expand_data variable
in cat-file and in ref-filter.
It will help further to get rid of using expand_data in cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Moving from using expand_data to ref_array_item structure.
That helps us to reuse functions from ref-filter easier.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c |
Remove expand_atom_into_fields function and create same logic
in terms of ref-filter style.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 45
Split expand_atom function into 2 different functions,
expand_atom_into_fields prepares variable for further filling,
(new) expand_atom creates resulting string.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Add flag to ref_format struct so that we could pass needed info
to cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 4 ++--
Rename variable for easier reading.
It points not to values, but to arrays.
Added "s" ending so that it could be obvious.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c |
Start using ref_format struct instead of simple char*.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Start moving all formatting stuff from cat-file to ref-filter.
Start from simple moving, it would be integrated into
all ref-filter processes further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Continue migrating formatting logic from cat-file to ref-filter.
Reuse parse_ref_filter_atom for unifying all processes in ref-filter
and further reducing of expand_atom_into_fields function.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Need that for further reusing of formatting logic in cat-file.
Have plans to get rid of using expand_data in cat-file at all,
and use it only in ref-filter for collecting, formatting and printing
needed data.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Make valid_atoms as a function parameter,
there could be another variable further.
Need that for further reusing of formatting logic in cat-file.c.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Move logic related to getting object info from cat-file to ref-filter.
It will help to reuse whole formatting logic from ref-filter further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Move logic related to skip_object_info into ref-filter,
so that cat-file does not use that field at all.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 7 +--
Make function global for further using in cat-file.
Also added return value for handling errors.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 4 ++--
ref-filter.h | 3
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 103
Not sure, but looks like there is no need in that checking.
There is a checking before whether it is null and we die in such case.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
We could remove this because we have already checked that
at verify_ref_format function in ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 2 --
1 file
Remove populate_value from header file. We needed that
for interim step, now it could be returned back.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 2 +-
cat-file options are now filled by general logic.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 31 ++-
1 file changed, 14 insertions(+),
Add is_cat flag, further it helps to get rid of cat_file_data field
in ref_format.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 8
Split expand_atom function into 2 different functions,
expand_atom_into_fields prepares variable for further filling,
(new) expand_atom creates resulting string.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Remove connection between expand_data variable
in cat-file and in ref-filter.
It will help further to get rid of using expand_data in cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Delete all items related to split_on_whitespace from ref-filter
and add new function for handling the logic.
Now cat-file could invoke that function to implementing its logic.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Stop using valid_cat_file_atom, making the code more general.
Further commits will contain some tests, docs and
support of new features.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 103
Make function global for further using in cat-file.
In the end of patch series this function becomes internal again,
so this is a part of middle step. cat-file would use more general
functions further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Add some tests for new formatting atoms from ref-filter.
Some of new atoms are supported automatically,
some of them are expanded into empty string
(because they are useless for some types of objects),
some of them could be supported later in other patches.
Signed-off-by: Olga Telezhnaia
Reuse code from ref-filter to print resulting message.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 52 +---
Add tests for new formatting atoms: rest, deltabase, objectsize:disk.
rest means nothing and we expand it into empty string.
We need this atom for cat-file command.
Have plans to support deltabase and objectsize:disk further
(as it is done in cat-file), now also expand it to empty string.
Remove expand_atom_into_fields function and create same logic
in terms of ref-filter style.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 45
Make valid_atom as a function parameter,
there could be another variable further.
Need that for further reusing of formatting logic in cat-file.c.
We do not need to allow users to pass their own valid_atom variable in
global functions like verify_ref_format because in the end we want to
have same
Need that for further reusing of formatting logic in cat-file.
Have plans to get rid of using expand_data in cat-file at all,
and use it only in ref-filter for collecting, formatting and printing
needed data.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Start moving formatting stuff related to data preparation
from cat-file to ref-filter.
Start from simple moving, it would be integrated into
all ref-filter processes further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Make a temporary solution for commands that could use
objectsize:disk atom.
It's better to fill it with value or give an error if there is no value
for this atom, but as a first solution we do dothing.
It means that if objectsize:disk is used, we put an empty string there.
Signed-off-by: Olga
Move logic related to getting object info from cat-file to ref-filter.
It will help to reuse whole formatting logic from ref-filter further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Moving from using expand_data to ref_array_item structure.
That helps us to reuse functions from ref-filter easier.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c |
Start using ref_format struct instead of simple char*.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Update the docs for cat-file command. Some new formatting atoms added
because of reusing ref-filter code.
We do not support cat-file atoms in general formatting logic
(there is just the support for cat-file), that is why some of the atoms
are still explained in cat-file docs.
We need to move these
Continue migrating formatting logic from cat-file to ref-filter.
Reuse parse_ref_filter_atom for unifying all processes in ref-filter
and further reducing of expand_atom_into_fields function.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Move logic related to skip_object_info into ref-filter,
so that cat-file does not use that field at all.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 7 +--
Add return flag to format_ref_array_item, show_ref_array_item,
get_ref_array_info and populate_value for further using.
Need it to handle situations when item is broken but we can not invoke
die() because we are in batch mode and all items need to be processed.
Signed-off-by: Olga Telezhnaia
Remove connection between expand_data variable
in cat-file and in ref-filter.
It will help further to get rid of using expand_data in cat-file.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Add is_cat flag, further it helps to get rid of cat_file_data field
in ref_format.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 1 +
ref-filter.c | 8
Add tests for new formatting atoms: rest, deltabase, objectsize:disk.
rest means nothing and we expand it into empty string.
We need this atom for cat-file command.
Have plans to support deltabase and objectsize:disk further
(as it is done in cat-file), now also expand it to empty string.
Move mark_atom_in_object_info() from cat-file to ref-filter and
start using it in verify_ref_format().
It also means that we start reusing verify_ref_format() in cat-file.
Start from simple moving of mark_atom_in_object_info(),
it would be removed later by integrating all needed processes into
Moving from using expand_data to ref_array_item structure.
That helps us to reuse functions from ref-filter easier.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c |
Make a temporary solution for commands that could use
objectsize:disk atom.
It's better to fill it with value or give an error if there is no value
for this atom, but as a first solution we do dothing.
It means that if objectsize:disk is used, we put an empty string there.
Signed-off-by: Olga
Need that for further reusing of formatting logic in cat-file.
Have plans to get rid of using expand_data in cat-file at all,
and use it only in ref-filter for collecting, formatting and printing
needed data.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Continue migrating formatting logic from cat-file to ref-filter.
Reuse parse_ref_filter_atom() for unifying all processes in ref-filter
and further removing of mark_atom_in_object_info().
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Remove populate_value() from header file. We needed that
for interim step, now it could be returned back.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 2 +-
Make valid_atom as a function parameter,
there could be another variable further.
Need that for further reusing of formatting logic in cat-file.c.
We do not need to allow users to pass their own valid_atom variable in
global functions like verify_ref_format() because in the end we want to
have
Delete all items related to split_on_whitespace from ref-filter
and add new function for handling the logic.
Now cat-file could invoke that function to implementing its logic.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Reuse code from ref-filter to print resulting message.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 51 ---
Stop using valid_cat_file_atom, making the code more general.
Further commits will contain some tests, docs and
support of new features.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Update the docs for cat-file command. Some new formatting atoms added
because of reusing ref-filter code.
We do not support cat-file atoms in general formatting logic
(there is just the support for cat-file), that is why some of the atoms
are still explained in cat-file docs.
We need to move these
Move logic related to getting object info from cat-file to ref-filter.
It will help to reuse whole formatting logic from ref-filter further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Start using ref_format struct instead of simple char*.
Need that for further reusing of formatting logic from ref-filter.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
Add return flag to format_ref_array_item(), show_ref_array_item(),
get_ref_array_info() and populate_value() for further using.
Need it to handle situations when item is broken but we can not invoke
die() because we are in batch mode and all items need to be processed.
Signed-off-by: Olga
Add some tests for new formatting atoms from ref-filter.
Some of new atoms are supported automatically,
some of them are expanded into empty string
(because they are useless for some types of objects),
some of them could be supported later in other patches.
Signed-off-by: Olga Telezhnaia
cat-file options are now filled by general logic.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 31 ++-
1 file changed, 14 insertions(+),
Split expand_atom() into 2 different functions,
mark_atom_in_object_info() prepares variable for further filling,
(new) expand_atom() creates resulting string.
Need that for further reusing of formatting logic from ref-filter.
Both functions will be step-by-step removed by the end of this patch.
Remove mark_atom_in_object_info() and create same logic
in terms of ref-filter style.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 45
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 9 +
1 file changed, 5 insertions(+), 4
Rename objectname field to oid in struct ref_array_item.
Next commit will add objectname field that will contain
string representation of object id.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
Move logic related to skip_object_info into ref-filter,
so that cat-file does not use that field at all.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
builtin/cat-file.c | 7 +--
Make function global for further using in cat-file.
In the end of patch series this function becomes internal again,
so this is a part of middle step. cat-file would use more general
functions further.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Continue migrating formatting logic from cat-file to ref-filter.
Reuse parse_ref_filter_atom() for unifying all processes in ref-filter
and further removing of mark_atom_in_object_info().
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Get rid of goto command in ref-filter for better readability.
Signed-off-by: Olga Telezhnaia
Mentored-by: Christian Couder
Mentored by: Jeff King
---
ref-filter.c | 9 +
1 file changed, 5 insertions(+), 4
1 - 100 of 180 matches
Mail list logo