[PATCH 0/7][Outreachy] stop using the_repository global variable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove `the_repository` global variable in favor of the repository
argument that gets passed in builtin commands. 

These sets of commands are commands that use only RUN_SETUP macro in "git.c".
Basically, When `-h` is passed to any of this command outside a Git repository,
the `run_builtin()` will call the `cmd_x()` function (where `x` is any
of the command from the sets of builtin commands that `the_repository` is removed
from) with `repo` set to NULL and then early in the function, `parse_options()`
or show_usage_with_options_if_asked() call will give the options help and exit,
without having to consult much of the configuration file.

As there exist some builtin commands where the `repository` variable is accessed
before options is given exit and fail, we should check if the `repository` variable
is not NULL in such scenerio.

Some, functions also uses `the_repository` global internally, so, let's
let's refactor them and pass `struct repo` as one of the argument. 

I picked some of this files based on the above explanation, how easy they are to
resolve and how easy easy to review. 

[1]: https://public-inbox.org/git/20250210181103.3609495-1-usmanakinyemi202@xxxxxxxxx/
*** BLURB HERE ***

Usman Akinyemi (7):
  builtin/verify-tag: stop using `the_repository`
  builtin/verify-commit.c: stop using `the_repository`
  builtin/send-pack.c: stop using `the_repository`
  builtin/pack-refs: stop using `the_repository`
  builtin/ls-files: stop using `the_repository`
  builtin/for-each-ref: stop using `the_repository`
  builtin/checkout-index.c: stop using `the_repository`

 builtin/checkout-index.c | 43 ++++++++++++++++++++--------------------
 builtin/for-each-ref.c   |  6 +++---
 builtin/ls-files.c       | 32 +++++++++++++++---------------
 builtin/pack-refs.c      |  9 ++++-----
 builtin/send-pack.c      |  8 ++++----
 builtin/verify-commit.c  | 14 ++++++-------
 builtin/verify-tag.c     |  8 ++++----
 7 files changed, 59 insertions(+), 61 deletions(-)

-- 
2.48.1





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux