Weird behaviour of git diff-index in container

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

 



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

mkdir test
cd test
git init
touch test
git add test
git commit -m 'init'
podman run --rm -it -v `pwd`:/git:z --entrypoint sh docker.io/alpine
> container# apk add git
> container# cd /git
> container# git diff-index --quiet HEAD -- ; echo $?
1
> container# git diff-index --quiet HEAD -- ; echo $?
1
> container# git status
On branch master
nothing to commit, working tree clean
> container# git diff-index --quiet HEAD -- ; echo $?
0


What did you expect to happen? (Expected behavior)
`git diff-index --quiet HEAD -- ; echo $?` should return `0`
even without executing `git status`.

What happened instead? (Actual behavior)
Without executing `git status` `git diff-index --quiet HEAD -- ; echo $?`
will repeatedly print `1`.

What's different between what you expected and what actually happened?
It is odd that `git diff-index --quiet HEAD -- ; echo $?` prints
different results depending on whether `git status` was executed.

Anything else you want to add: Perhaps this has to do with running git in a container?


[System Info]
git version:
git version 2.34.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 4.18.0-348.20.1.el8_5.x86_64 #1 SMP Thu Mar 10 20:59:28 UTC 2022 x86_64
compiler info: gnuc: 10.3
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>


[Enabled Hooks]
not run from a git repository - no hooks to show



[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