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] [<log-options>] [<ref>]
or: git reflog list
or: git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all
[--single-worktree] | <refs>...]
or: git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
or: git reflog exists <ref> $ git reflog list -h
usage: git reflog list
$ ~/code/git/build/bin-wrappers/git reflog -h
usage: git reflog [show] [<log-options>] [<ref>]
or: git reflog list
or: git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all
[--single-worktree] | <refs>...]
or: git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
or: git reflog exists <ref>
or: git reflog drop [--all | <refs>...] $ ~/code/git/build/bin-wrappers/git reflog list -h
usage: git reflog list
# Outside a git repository
$ eza .git
".git": No such file or directory (os error 2)
$ git reflog -h
usage: git reflog [show] [<log-options>] [<ref>]
or: git reflog list
or: git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all
[--single-worktree] | <refs>...]
or: git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
or: git reflog exists <ref> $ git reflog list -h
fatal: not a git repository (or any of the parent directories): .git
$ ~/code/git/build/bin-wrappers/git reflog -h
usage: git reflog [show] [<log-options>] [<ref>]
or: git reflog list
or: git reflog expire [--expire=<time>] [--expire-unreachable=<time>]
[--rewrite] [--updateref] [--stale-fix]
[--dry-run | -n] [--verbose] [--all
[--single-worktree] | <refs>...]
or: git reflog delete [--rewrite] [--updateref]
[--dry-run | -n] [--verbose] <ref>@{<specifier>}...
or: git reflog exists <ref>
or: git reflog drop [--all | <refs>...] $ ~/code/git/build/bin-wrappers/git reflog list -h
fatal: not a git repository (or any of the parent directories): .git
Seems like the behavior is the same with as with (git 2.48.1).
Show 12 quoted lines
> In any case, when you are adding a new feature, I would strongly
> prefer you did *not* take it hostage to unrelated internal clean-up
> with a dubious value. For the library-ish parts of the system
> (e.g. reflog.c at the top-level), not depending on the_repository is
> absolutely the good thing to do, but the top level cmd_foo() are not
> meant to be called as helper functions repeatedly with arbirary
> repository instance, and a churn like this one, only to mollify the
> USE_THE_REPOSITORY_VARIABLE macro, does not deserve to take a more
> interesting (in the sense that it improves the life of end users)
> change hostage by pretending to be its prerequisite clean-up.
>
> Thanks.