[RFC PATCH 5/5] ref-filter: add docs for new options

2018-11-08 Thread Olga Telezhnaya
Add documentation for formatting options objectsize:disk and deltabase. Signed-off-by: Olga Telezhnaia --- Documentation/git-for-each-ref.txt | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Documentation/git-for-each-ref.txt

[RFC PATCH 1/5] ref-filter: add objectsize:disk option

2018-11-08 Thread Olga Telezhnaya
Add new formatting option objectsize:disk to know exact size that object takes up on disk. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index

[RFC PATCH 3/5] ref-filter: add deltabase option

2018-11-08 Thread Olga Telezhnaya
Add new formatting option: deltabase. If the object is stored as a delta on-disk, this expands to the 40-hex sha1 of the delta base object. Otherwise, expands to the null sha1 (40 zeroes). We have same option in cat-file command. Hopefully, in the end I will remove formatting code from cat-file

[RFC PATCH 2/5] ref-filter: add tests for objectsize:disk

2018-11-08 Thread Olga Telezhnaya
Test new formatting atom. Signed-off-by: Olga Telezhnaia --- t/t6300-for-each-ref.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 97bfbee6e8d69..097fdf21fe196 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@

[RFC PATCH 4/5] ref-filter: add tests for deltabase

2018-11-08 Thread Olga Telezhnaya
Test new formatting option deltabase. Signed-off-by: Olga Telezhnaia --- t/t6300-for-each-ref.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index 097fdf21fe196..0ffd63071392e 100755 --- a/t/t6300-for-each-ref.sh +++

[PATCH v2 3/3] ref-filter: free item->value and item->value->s

2018-10-18 Thread Olga Telezhnaya
Release item->value. Initialize item->value->s dynamically and then release its resources. Release some local variables. Final goal of this patch is to reduce number of memory leaks. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 96 +--- 1

[PATCH v2 1/3] ref-filter: free memory from used_atom

2018-10-18 Thread Olga Telezhnaya
Release memory from used_atom variable for reducing number of memory leaks. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 4 1 file changed, 4 insertions(+) diff --git a/ref-filter.c b/ref-filter.c index e1bcb4ca8a197..70f1d13ab3beb 100644 --- a/ref-filter.c +++ b/ref-filter.c @@

[PATCH v2 2/3] ls-remote: release memory instead of UNLEAK

2018-10-18 Thread Olga Telezhnaya
Use ref_array_clear() to release memory instead of UNLEAK macros. Signed-off-by: Olga Telezhnaia --- builtin/ls-remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 1a25df7ee15b4..6a0cdec30d2d7 100644 ---

[PATCH 2/3] ls-remote: release memory instead of UNLEAK

2018-10-09 Thread Olga Telezhnaya
Use ref_array_clear() to release memory instead of UNLEAK macros. Signed-off-by: Olga Telezhnaia --- builtin/ls-remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 1a25df7ee15b4..6a0cdec30d2d7 100644 ---

[PATCH 3/3] ref-filter: free item->value and item->value->s

2018-10-09 Thread Olga Telezhnaya
Release item->value. Initialize item->value->s dynamically and then release its resources. Release some local variables. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 95 +--- 1 file changed, 53 insertions(+), 42 deletions(-) diff --git

[PATCH 1/3] ref-filter: free memory from used_atom

2018-10-09 Thread Olga Telezhnaya
Release memory from used_atom variable. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ref-filter.c b/ref-filter.c index e1bcb4ca8a197..1b71d08a43a84 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1996,6 +1996,9 @@ void

[PATCH v3 5/5] ref-filter: use oid_object_info() to get object

2018-07-17 Thread Olga Telezhnaya
Use oid_object_info_extended() to get object info instead of read_object_file(). It will help to handle some requests faster (e.g., we do not need to parse whole object if we need to know %(objectsize)). It could also help us to add new atoms such as %(objectsize:disk) and %(deltabase).

[PATCH v3 3/5] ref-filter: initialize eaten variable

2018-07-17 Thread Olga Telezhnaya
Initialize variable `eaten` before its using. We may initialize it in parse_object_buffer(), but there are cases when we do not reach this invocation. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ref-filter.c

[PATCH v3 1/5] ref-filter: add info_source to valid_atom

2018-07-17 Thread Olga Telezhnaya
Add the source of object data to prevent parsing of unneeded data. The goal is to improve performance by avoiding calling expensive functions when we don't need the information they provide or when we could get it by using a cheaper function. It is stored in valid_atoms because it depends on the

[PATCH v3 4/5] ref-filter: merge get_obj and get_object

2018-07-17 Thread Olga Telezhnaya
Inline get_obj(): it would be easier to edit the code without this split. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 36 +++- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 8db7ca95b12c0..2b401a17c4689

[PATCH v3 2/5] ref-filter: fill empty fields with empty values

2018-07-17 Thread Olga Telezhnaya
Atoms like "align" or "end" do not have string representation. Earlier we had to go and parse whole object with a hope that we could fill their string representations. It's easier to fill them with an empty string before we start to work with whole object. It is important to mention that we fill

[PATCH v2 4/4] ref-filter: use oid_object_info() to get object

2018-07-13 Thread Olga Telezhnaya
Use oid_object_info_extended() to get object info instead of read_object_file(). It will help to handle some requests faster (e.g., we do not need to parse whole object if we need to know %(objectsize)). It could also help us to add new atoms such as %(objectsize:disk) and %(deltabase).

[PATCH v2 1/4] ref-filter: add info_source to valid_atom

2018-07-13 Thread Olga Telezhnaya
Add the source of object data to prevent parsing of unneeded data. The goal is to improve performance by avoiding calling expensive functions when we don't need the information they provide or when we could get it by using a cheaper function. It is stored in valid_atoms because it depends on the

[PATCH v2 3/4] ref-filter: merge get_obj and get_object

2018-07-13 Thread Olga Telezhnaya
Inline get_obj(): it would be easier to edit the code without this split. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 36 +++- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 27733ef013bed..f04169f0ea0e3

[PATCH v2 2/4] ref-filter: fill empty fields with empty values

2018-07-13 Thread Olga Telezhnaya
Atoms like "align" or "end" do not have string representation. Earlier we had to go and parse whole object with a hope that we could fill their string representations. It's easier to fill them with an empty string before we start to work with whole object. It is important to mention that we fill

[PATCH 4/4] ref-filter: use oid_object_info() to get object

2018-07-09 Thread Olga Telezhnaya
Use oid_object_info_extended() to get object info instead of read_object_file(). It will help to handle some requests faster (e.g., we do not need to parse whole object if we need to know %(objectsize)). It could also help us to add new atoms such as %(objectsize:disk) and %(deltabase).

[PATCH 1/4] ref-filter: add info_source to valid_atom

2018-07-09 Thread Olga Telezhnaya
Add the source of object data to prevent parsing of unneeded data. The goal is to improve performance by avoiding calling expensive functions when we don't need the information they provide or when we could get it by using a cheaper function. It is stored in valid_atoms because it depends on the

[PATCH 3/4] ref-filter: merge get_obj and get_object

2018-07-09 Thread Olga Telezhnaya
Inline get_obj(): it would be easier to edit the code without this split. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 36 +++- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/ref-filter.c b/ref-filter.c index 27733ef013bed..f04169f0ea0e3

[PATCH 2/4] ref-filter: add empty values to technical fields

2018-07-09 Thread Olga Telezhnaya
Atoms like "align" or "end" do not have string representation. Earlier we had to go and parse whole object with a hope that we could fill their string representations. It's easier to fill them with an empty string before we start to work with whole object. Signed-off-by: Olga Telezhnaia ---

[PATCH RFC v2 1/4] ref-filter: start using oid_object_info

2018-05-18 Thread Olga Telezhnaya
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

[PATCH RFC v2 2/4] ref-filter: add objectsize:disk formatting option

2018-05-18 Thread Olga Telezhnaya
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

[PATCH RFC v2 3/4] ref-filter: add tests for objectsize:disk

2018-05-18 Thread Olga Telezhnaya
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 ---

[PATCH RFC v2 4/4] ref-filter: add deltabase formatting option

2018-05-18 Thread Olga Telezhnaya
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

[PATCH RFC] ref-filter: start using oid_object_info

2018-05-14 Thread Olga Telezhnaya
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

[PATCH v6 1/6] ref-filter: add shortcut to work with strbufs

2018-03-29 Thread Olga Telezhnaya
Add function strbuf_addf_ret() that helps to save a few lines of code. Function expands fmt with placeholders, append resulting message to strbuf *sb, and return error code ret. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 13 + 1 file changed, 13

[PATCH v6 4/6] ref-filter: change parsing function error handling

2018-03-29 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parse_ref_filter_atom() by adding strbuf parameter for error message. The function returns the position in the used_atom[] array (as before) for the given atom, or

[PATCH v6 2/6] ref-filter: start adding strbufs with errors

2018-03-29 Thread Olga Telezhnaya
This is a first step in removing die() calls from ref-filter formatting logic, so that it could be used by other commands that do not want to die during formatting process. die() calls related to bugs in code will not be touched in this patch. Everything would be the same for

[PATCH v6 3/6] ref-filter: add return value && strbuf to handlers

2018-03-29 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of handlers by adding return value and strbuf parameter for errors. Return value equals 0 upon success and -1 upon failure. Upon failure, error message is appended to

[PATCH v6 6/6] ref-filter: libify get_ref_atom_value()

2018-03-29 Thread Olga Telezhnaya
Finish removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of get_ref_atom_value() and underlying functions by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure.

[PATCH v6 5/6] ref-filter: add return value to parsers

2018-03-29 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parsers by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure. Upon failure, error message is

[PATCH v5 4/6] ref-filter: change parsing function error handling

2018-03-21 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parse_ref_filter_atom() by adding strbuf parameter for error message. The function returns the position in the used_atom[] array (as before) for the given atom, or

[PATCH v5 2/6] ref-filter: start adding strbufs with errors

2018-03-21 Thread Olga Telezhnaya
This is a first step in removing die() calls from ref-filter formatting logic, so that it could be used by other commands that do not want to die during formatting process. die() calls related to bugs in code will not be touched in this patch. Everything would be the same for

[PATCH v5 1/6] strbuf: add shortcut to work with error messages

2018-03-21 Thread Olga Telezhnaya
Add function strbuf_error() that helps to save few lines of code. Function expands fmt with placeholders, append resulting error message to strbuf *err, and return error code ret. Signed-off-by: Olga Telezhnaia --- strbuf.h | 13 + 1 file changed, 13

[PATCH v5 5/6] ref-filter: add return value to parsers

2018-03-21 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parsers by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure. Upon failure, error message is

[PATCH v5 6/6] ref-filter: libify get_ref_atom_value()

2018-03-21 Thread Olga Telezhnaya
Finish removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of get_ref_atom_value() and underlying functions by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure.

[PATCH v5 3/6] ref-filter: add return value && strbuf to handlers

2018-03-21 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of handlers by adding return value and strbuf parameter for errors. Return value equals 0 upon success and -1 upon failure. Upon failure, error message is appended to

[PATCH v4 4/5] ref-filter: add return value to parsers

2018-03-20 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parsers by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure (there could be more error codes

[PATCH v4 2/5] ref-filter: add return value && strbuf to handlers

2018-03-20 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of handlers by adding return value and strbuf parameter for errors. Return value equals 0 upon success and -1 upon failure (there could be more error codes further if

[PATCH v4 5/5] ref-filter: get_ref_atom_value() error handling

2018-03-20 Thread Olga Telezhnaya
Finish removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of get_ref_atom_value() and underlying functions by adding return value and strbuf parameter for error message. Return value equals 0 upon success and -1 upon failure

[PATCH v4 1/5] ref-filter: start adding strbufs with errors

2018-03-20 Thread Olga Telezhnaya
This is a first step in removing die() calls from ref-filter formatting logic, so that it could be used by other commands that do not want to die during formatting process. die() calls related to bugs in code will not be touched in this patch. Everything would be the same for

[PATCH v4 3/5] ref-filter: change parsing function error handling

2018-03-20 Thread Olga Telezhnaya
Continue removing die() calls from ref-filter formatting logic, so that it could be used by other commands. Change the signature of parse_ref_filter_atom() by adding strbuf parameter for error message. The function returns the position in the used_atom[] array (as before) for the given atom, or

[PATCH v3 4/5] ref-filter: add return value to parsers

2018-03-19 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parsers by adding return value and strbuf parameter for error message. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 177

[PATCH v3 2/5] ref-filter: add return value && strbuf to handlers

2018-03-19 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of handlers by adding return value and strbuf parameter for errors. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 71

[PATCH v3 3/5] ref-filter: change parsing function error handling

2018-03-19 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parse_ref_filter_atom() by adding strbuf parameter for error message. Return value means the same except negative values: they indicate errors (previous version could return

[PATCH v3 5/5] ref-filter: get_ref_atom_value() error handling

2018-03-19 Thread Olga Telezhnaya
Finish removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of get_ref_atom_value() and underlying functions by adding return value and strbuf parameter for error message. Some die() calls are left; all of them are not for users, but for

[PATCH v3 1/5] ref-filter: start adding strbufs with errors

2018-03-19 Thread Olga Telezhnaya
This is a first step in removing any printing from ref-filter formatting logic, so that it could be more general. Everything would be the same for show_ref_array_item() users. But, if you want to deal with errors by your own, you could invoke format_ref_array_item(). It means that you need to

[PATCH v2 4/5] ref-filter: add return value to parsers

2018-03-14 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parsers by adding return value and strbuf parameter for error message. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 177

[PATCH v2 2/5] ref-filter: add return value && strbuf to handlers

2018-03-14 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of handlers by adding return value and strbuf parameter for errors. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 71

[PATCH v2 1/5] ref-filter: start adding strbufs with errors

2018-03-14 Thread Olga Telezhnaya
This is a first step in removing any printing from ref-filter formatting logic, so that it could be more general. Everything would be the same for show_ref_array_item() users. But, if you want to deal with errors by your own, you could invoke format_ref_array_item(). It means that you need to

[PATCH v2 5/5] ref-filter: get_ref_atom_value() error handling

2018-03-14 Thread Olga Telezhnaya
Finish removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of get_ref_atom_value() and underlying functions by adding return value and strbuf parameter for error message. It's important to mention that grab_objectname() returned 1 if it

[PATCH v2 3/5] ref-filter: change parsing function error handling

2018-03-14 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parse_ref_filter_atom() by changing return value, adding previous return value to function parameter and also adding strbuf parameter for error message. Signed-off-by: Olga

[RFC 4/4] ref-filter: add return value to parsers

2018-03-13 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parsers by adding return value and strbuf parameter for error message. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 177

[RFC 3/4] ref-filter: change parsing function error handling

2018-03-13 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of parse_ref_filter_atom() by changing return value, adding previous return value to function parameter and also adding strbuf parameter for error message. Signed-off-by: Olga

[RFC 1/4] ref-filter: start adding strbufs with errors

2018-03-13 Thread Olga Telezhnaya
This is a first step in removing any printing from ref-filter formatting logic, so that it could be more general. Everything would be the same for show_ref_array_item() users. But, if you want to deal with errors by your own, you could invoke format_ref_array_item(). It means that you need to

[RFC 2/4] ref-filter: add return value && strbuf to handlers

2018-03-13 Thread Olga Telezhnaya
Continue removing any printing from ref-filter formatting logic, so that it could be more general. Change the signature of handlers by adding return value and strbuf parameter for errors. Signed-off-by: Olga Telezhnaia --- ref-filter.c | 71

[PATCH v2 2/2] ref-filter: get rid of goto

2018-02-20 Thread Olga Telezhnaya
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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

[PATCH v2 1/2] ref-filter: get rid of duplicate code

2018-02-20 Thread Olga Telezhnaya
Make one function from 2 duplicate pieces and invoke it twice. Signed-off-by: Olga Telezhnaia Mentored-by: Christian Couder Mentored by: Jeff King --- ref-filter.c | 45 + 1 file

[PATCH 2/2] ref-filter: get rid of goto

2018-02-20 Thread Olga Telezhnaya
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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

[PATCH 1/2] ref-filter: get rid of duplicate code

2018-02-20 Thread Olga Telezhnaya
Make one function from 2 duplicate pieces and invoke it twice. Signed-off-by: Olga Telezhnaia Mentored-by: Christian Couder Mentored by: Jeff King --- ref-filter.c | 45 + 1 file

[PATCH v3 13/23] ref-filter: get rid of mark_atom_in_object_info()

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 06/23] cat-file: split expand_atom() into 2 functions

2018-02-12 Thread Olga Telezhnaya
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.

[PATCH v3 22/23] cat-file: tests for new atoms added

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 23/23] cat-file: update of docs

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 12/23] cat-file: start reusing populate_value()

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 14/23] ref_filter: add is_atom_used function

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 20/23] ref-filter: unifying formatting of cat-file opts

2018-02-12 Thread Olga Telezhnaya
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 | 33 - 1 file changed, 16 insertions(+),

[PATCH v3 17/23] ref-filter: make valid_atom general again

2018-02-12 Thread Olga Telezhnaya
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 ---

[PATCH v3 04/23] ref-filter: make valid_atom as function parameter

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 18/23] cat-file: reuse printing logic from ref-filter

2018-02-12 Thread Olga Telezhnaya
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 ---

[PATCH v3 05/23] cat-file: move struct expand_data into ref-filter

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 10/23] ref-filter: make populate_value() global

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 21/23] for-each-ref: tests for new atoms added

2018-02-12 Thread Olga Telezhnaya
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.

[PATCH v3 02/23] ref-filter: add return value to some functions

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 15/23] cat-file: move skip_object_info into ref-filter

2018-02-12 Thread Olga Telezhnaya
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 +--

[PATCH v3 11/23] ref-filter: rename field in ref_array_item stuct

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 09/23] cat-file: start use ref_array_item struct

2018-02-12 Thread Olga Telezhnaya
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 |

[PATCH v3 07/23] cat-file: start migrating formatting to ref-filter

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 16/23] ref-filter: make cat_file_info independent

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 19/23] ref-filter: make populate_value() internal again

2018-02-12 Thread Olga Telezhnaya
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 +-

[PATCH v3 08/23] ref-filter: reuse parse_ref_filter_atom()

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 01/23] ref-filter: get rid of goto

2018-02-12 Thread Olga Telezhnaya
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

[PATCH v3 03/23] cat-file: reuse struct ref_format

2018-02-12 Thread Olga Telezhnaya
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 ---

[PATCH RFC v2 17/25] ref-filter: make cat_file_info independent

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 14/25] ref-filter: add is_cat flag

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 09/25] cat-file: start use ref_array_item struct

2018-02-05 Thread Olga Telezhnaya
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 |

[PATCH RFC v2 23/25] for-each-ref: tests for new atoms added

2018-02-05 Thread Olga Telezhnaya
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.

[PATCH RFC v2 07/25] cat-file: start migrating formatting to ref-filter

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 21/25] ref-filter: unifying formatting of cat-file opts

2018-02-05 Thread Olga Telezhnaya
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(+),

[PATCH RFC v2 20/25] ref-filter: make populate_value() internal again

2018-02-05 Thread Olga Telezhnaya
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 +-

[PATCH RFC v2 04/25] ref-filter: make valid_atom as function parameter

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 15/25] ref_filter: add is_atom_used function

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 19/25] cat-file: reuse printing logic from ref-filter

2018-02-05 Thread Olga Telezhnaya
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 ---

[PATCH RFC v2 18/25] ref-filter: make valid_atom general again

2018-02-05 Thread Olga Telezhnaya
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 ---

[PATCH RFC v2 25/25] cat-file: update of docs

2018-02-05 Thread Olga Telezhnaya
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

[PATCH RFC v2 10/25] ref-filter: make populate_value() global

2018-02-05 Thread Olga Telezhnaya
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

  1   2   >