git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: Git-Alias is callable from outside a git repo

From
rsbecker@nexbridge.com <rsbecker@nexbridge.com>
Date
Aug 10, 2022, 19:14 UTC
Message-ID
<000c01d8aced$6f67f460$4e37dd20$@nexbridge.com>
In-Reply-To
<20220810170319.mxd6h2p5tm6y5xx3@imap.mailbox.org>
On August 10, 2022 1:03 PM, Niklas wrote:
Show 19 quoted lines
>Steps to reproduce:
>
>1. Having the following global .gitconfig
>
>[alias]
>     f = "!echo "test""
>
>2. Calling `git f` in a folder which does not belong to a git repo
>
>Expected Behavior:
>
>Seeing some message like like
>`fatal: not a git repository (or any parent up to mount point /)`
>
>Actual Behavior:
>
>Prints "test"
>
>Git 2.37.1 under Arch Linux

I do not think this is a bug. There are git commands that do not require repositories, like git version. Git has know knowledge of what your alias is going to do without executing it. If your alias wanted to run git version or git hash-object, it would not need a repository to do so. --Randall

Previous: NiklasNext: Johannes Schindelin
Message 2 of 3 in “Bug: Git-Alias is callable from outside a git repo”
  1. NiklasAug 10, 2022
  2. rsbecker@nexbridge.comAug 10, 2022
  3. Johannes SchindelinAug 12, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.