"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Problem: empty dirs
To:
gameoftrees@openbsd.org
Date:
Wed, 2 Oct 2019 09:28:35 +0100

Download raw body.

Thread
There's a problem doing a checkout when a tree contains an empty dir.

Sorry I don't have time to figure out the regress infrastructure to add a
proper test for this and wanted to send a mail before I forget, but here's
a simple reproducer:

--cut here-- -- -- --
#!/bin/sh -x
cd /tmp
rm -r repo repo.git
mkdir repo
cd repo
mkdir empty notempty; touch notempty/file
got init /tmp/repo.git
got import -r /tmp/repo.git -m init .
cd ..
rm -r repo
got checkout /tmp/repo.git
[ -r repo/notempty/file ] || echo fail
--cut here-- -- -- --

$ ./x
+ cd /tmp
+ rm -r repo repo.git
+ mkdir repo
+ cd repo
+ mkdir empty notempty
+ touch notempty/file
+ got init /tmp/repo.git
+ got import -r /tmp/repo.git -m init .
A  /tmp/repo/notempty/file
Created branch refs/heads/master with commit 19b0b5b6cb9725ed02170bbbee6c513a6c9caae1
+ cd ..
+ rm -r repo
+ got checkout /tmp/repo.git
got-read-tree: bad object data
got: bad object data
+ [ -r repo/notempty/file ]
+ echo fail
fail