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

Unexpected behavior with the rev-parse operation

From
Toru Okugawa <castor.4bit@gmail.com>
Date
Apr 15, 2024, 13:58 UTC
Message-ID
<CANHPH1-6mbWdt_FLsrDEB_XVb4r3yTYMLLPUyDrL6tmS7jZgqQ@mail.gmail.com>
Hi,
I have encountered some unexpected behavior with the rev-parse operation.

--- What did you do before the bug happened? (Steps to reproduce your issue)

``` $ mkdir -p /tmp/example $ cd $_ $ ls -a . ..

$ git rev-parse --is-inside-work-tree fatal: not a git repository (or any of the parent directories): .git ```

What did you expect to happen? (Expected behavior)

If the current working directory is outside the work tree, the documentation says that `git rev-parse --is-inside-work-tree` will output false. https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---is-inside-work-tree

``` $ git rev-parse --is-inside-work-tree false ```

What happened instead? (Actual behavior)

It will output `fatal: not a git repository (or any of the parent directories): .git` and exit with code 128. The `--is-inside-git-dir` option works the same way.

``` $ git rev-parse --is-inside-work-tree fatal: not a git repository (or any of the parent directories): .git ```

[System Info] git version: git version 2.44.0 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 arm64 compiler info: clang: 15.0.0 (clang-1500.1.0.2.5) libc info: no libc information available $SHELL (typically, interactive shell): /opt/homebrew/bin/zsh

Thanks
Next: Eric Sunshine
Message 1 of 6 in “Unexpected behavior with the rev-parse operation”
  1. Toru OkugawaApr 15, 2024
  2. Eric SunshineApr 28, 2024
  3. Re* Unexpected behavior with the rev-parse operationJunio C Hamano, Apr 28, 2024
  4. Toru OkugawaApr 30, 2024
  5. Junio C HamanoApr 30, 2024
  6. Toru OkugawaMay 1, 2024

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.