Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format #568

Closed
wants to merge 20 commits into from
Closed

Format #568

wants to merge 20 commits into from

Conversation

telezhnaya
Copy link
Contributor

Thanks for taking the time to contribute to Git! Please be advised that the
Git community does not use github.com for their contributions. Instead, we use
a mailing list (git@vger.kernel.org) for code submissions, code reviews, and
bug reports. Nevertheless, you can use submitGit to conveniently send your Pull
Requests commits to our mailing list.

Please read the "guidelines for contributing" linked above!

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 <olyatelezhnaya@gmail.com>
Rename objectname field to oid in struct ref_array_item.
We usually use objectname word for string representation
of object id, so oid explains the content better.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Add rest option that allows to add string into ref_array_item
and then put it into specific place of the output.
We are using it now in cat-file command: user could put anything
in the input after objectname, and it will appear in the output
in place of %(rest).

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Add tests for new formatting atom %(rest).
We need this atom for cat-file command.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Get rid of split_on_whitespace field in struct expand_data.
expand_data may be global further as we use it in ref-filter also,
so we need to remove cat-file specific fields from it.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Get rid of mark_query field in struct expand_data.
expand_data may be global further as we use it in ref-filter also,
so we need to remove cat-file specific fields from it.

All globals that I add through this patch will be deleted in the end,
so treat it just as the middle step.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Get rid of skip_object_info field in struct expand_data.
expand_data may be global further as we use it in ref-filter also,
so we need to remove cat-file specific fields from it.

All globals that I add through this patch will be deleted in the end,
so treat it just as the middle step.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Get rid of rest field in struct expand_data.
expand_data may be global further as we use it in ref-filter also,
so we need to remove cat-file specific fields from it.

All globals that I add through this patch will be deleted in the end,
so treat it just as the middle step.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Put struct expand_data into global scope to reuse it
in cat-file.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Inline function stream_blob, it simplifies further
migrating process.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Move function filter_object to diff.c, like it is done with
function textconv_object.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Correct me if I am wrong, but it was not really good idea
to implement batch_write in cmd_cat_file. Maybe it's
a good task for newbies to add flag
(whether we accept batch write or not) to write_or_die?

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
In the next commit I will move function print_object_or_die
to ref-filter, and I decided to rewrite it a little so that it
becomes much more flatten and a little bit shorter.
I also changed input parameters, it allows me to move it
to ref-filter, ref-filter knows nothing about batch_options.

The logic of the function remains the same.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Move printing function to ref-filter, it is logical because
we move all formatting/printing logic to ref-filter.
It could be much better if we embed this logic into current
flows in ref-filter, but it looks like the task for another patch.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Add new formatting option %(raw), it means that we want to print
all the file without any changes. It will help further
to migrate all cat-file formatting logic from cat-file
to ref-filter. For now, we just treat it as the empty string.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Add tests for new formatting atom %(raw).
We need this atom for cat-file command.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Start using general ref-filter formatting logic in cat-file.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Clean up cat-file after moving all formatting logic
to ref-filter.
We do not need to use struct expand_data anymore.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
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).

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Update the docs for cat-file command. Some new formatting atoms added
because of reusing ref-filter code.

Actually, %(rest) is supported for all ref-filter commands, but it
has the meaning only for cat-file, that's why I decided to leave it here.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
@submitgit
Copy link
Member

@telezhnaya sent these 20 commits (35ee755...88d51eb) as a set of patches to the mailing list with submitGit - here on public-inbox, MARC

@dscho
Copy link
Member

dscho commented Jun 3, 2019

@telezhnaya is this PR still relevant?

@telezhnaya
Copy link
Contributor Author

@dscho I hope I will return to it one day, but I am too busy right now, so I can't give any predictions. I guess you want me to close it for now and re-open when it would be ready.

@telezhnaya telezhnaya closed this Jun 3, 2019
@dscho
Copy link
Member

dscho commented Jun 3, 2019

I guess you want me to close it for now and re-open when it would be ready.

Oh no, sorry, that was not my intention! I would have suggested to close it only if it has been applied.

@telezhnaya
Copy link
Contributor Author

I guess you want me to close it for now and re-open when it would be ready.

Oh no, sorry, that was not my intention! I would have suggested to close it only if it has been applied.

Please do not worry :-) Everything is OK. Anyway, I need to change many pieces in this patch and send 2-3 additional small patches before I will re-send this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants