ui-blob.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

This also prevents from potential misuse of the global pointers
match_path and matched_sha1 after the referenced values have been
overwritten on the stack.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-plain.c: Do not access match variable in print_*()

Move all code setting the match variable to walk_tree().

This allows for easily moving this variable into a context structure
without having to pass the context to print_*().

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-plain.c: Use a context structure in walk_tree()

Do not misuse global variables to save the context. Instead, use the
context pointer which was designed to share information between a
read_tree_fn and the caller.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-tree.c: Pass current revision to print_object()

No longer access the global curr_rev variable in print_object().

This will make it easier to squash the curr_rev variable into a context
structure without having to pass the context to the print_object()
function.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-tree.c: Declare the state variable globally

This allows for removing the header variable in a following patch. We
can use the state variable to check whether the tail needs to be printed
instead.

Note that the state variable will be moved into a context structure
later.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-tree.c: Drop the header variable

Instead, use the value of the state variable to determine whether the
footer needs to be drawn.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ui-tree.c: Use a context structure in walk_tree()

Use the context pointer to pass context information instead of misusing
global variables, as we already did in "ui-blob.c" and in "ui-plain.c".

In addition to the fixes to walk_tree(), pass the same structure to
ls_tree() and ls_item() which is read_tree_recursive()-based as well.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
cgit.c: Remove parameter from guess_defbranch()

We use resolve_ref() since commit 8d7c2ec2, so this is no longer needed.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
ZX2C4 specific patches.