From: Karthik Nayak Date: Mon, 10 Mar 2025 11:41:26 GMT Subject: Re: [PATCH 1/2] reflog: drop usage of global variables Message-ID: In-Reply-To: Junio C Hamano writes: > Karthik Nayak writes: > >> The 'builtin/reflog.c' file uses the 'the_repository' global variable >> directly and also via 'git_config()'. Since this is a builtin command >> which has access to the 'struct repository', drop usage of the global >> variable and use the available repository struct. >> >> With this, remove the 'USE_THE_REPOSITORY_VARIABLE' macro from the file. > > I suspect that this is not quite right. > > $ cd w/git.git/; make > $ ./git-reflog list -h > usage: git reflog list > $ cd .. # not a repository > $ git.git/git-reflog list -h > fatal: not a git repository (or any of the parent directories): .git > $ git.git/git-reflog -h > usage: git reflog [show] ... > > but I also suspect that it is mostly due to the original program > structure that uses OPT_SUBCOMMAND() that the subcommands fail to > respond to "-h" unlike the top-level command, so this may not be a > regression. I do think however that this change is making it harder > to fix. > Hmm. But this is the existing behavior, no? # Inside a git directory $ eza .git b4.template branches COMMIT_EDITMSG config description FETCH_HEAD filter-repo HEAD hooks index info objects refs reftable rr-cache $ git reflog -h usage: git reflog [show] [] [] or: git reflog list or: git reflog expire [--expire=