git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Weird behaviour of git diff-index in container
@ 2022-05-09 22:42 Timo Funke
  2022-05-09 23:18 ` Junio C Hamano
  2022-05-10  2:42 ` Jonathan Nieder
  0 siblings, 2 replies; 4+ messages in thread
From: Timo Funke @ 2022-05-09 22:42 UTC (permalink / raw)
  To: git@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-10 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 22:42 Weird behaviour of git diff-index in container Timo Funke
2022-05-09 23:18 ` Junio C Hamano
2022-05-10  2:42 ` Jonathan Nieder
2022-05-10 16:47   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).