Git development
 help / color / mirror / Atom feed
* A bug in git-add with GIT_DIR?
@ 2018-12-20  8:37 Orgad Shaneh
  2018-12-20 15:18 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Orgad Shaneh @ 2018-12-20  8:37 UTC (permalink / raw)
  To: git

Hi,

I played around with t5403-post-checkout-hook, and noticed that its
state is not exactly what I'd expect it to be.

The test setup is:
echo Data for commit0. >a &&
echo Data for commit0. >b &&
git update-index --add a &&
git update-index --add b &&
tree0=$(git write-tree) &&
commit0=$(echo setup | git commit-tree $tree0) &&
git update-ref refs/heads/master $commit0 &&
git clone ./. clone1 &&
git clone ./. clone2 &&
GIT_DIR=clone2/.git git branch new2 &&
echo Data for commit1. >clone2/b &&
GIT_DIR=clone2/.git git add clone2/b &&
GIT_DIR=clone2/.git git commit -m new2

Now, the line before the last one executes git add clone2/b with GIT_DIR set.

I'd expect that to add b inside clone2, but instead it adds an
inexistent clone2/clone2/b, and if I stop at this line, then the
status shows:

On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   clone2/b

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   b
        deleted:    clone2/b

Is this the intended behavior? It looks like that's not what the test
meant to do anyway...

And if I change it to (cd clone2 && git add b), then the commits look
reasonable, but step 6 fails.

- Orgad

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

end of thread, other threads:[~2018-12-20 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20  8:37 A bug in git-add with GIT_DIR? Orgad Shaneh
2018-12-20 15:18 ` Jeff King
2018-12-20 15:21   ` Orgad Shaneh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox