test/clone,util: ensure cloning is possible in current directory "."
This commit is contained in:
parent
0f63130c23
commit
74b4d2cb40
@ -443,3 +443,40 @@ begin_test "clone with submodules"
|
||||
|
||||
)
|
||||
end_test
|
||||
|
||||
begin_test "clone in current directory"
|
||||
(
|
||||
set -e
|
||||
|
||||
reponame="clone_in_current_dir"
|
||||
setup_remote_repo "$reponame"
|
||||
clone_repo "$reponame" $reponame
|
||||
|
||||
git lfs track "*.dat" 2>&1 | tee track.log
|
||||
grep "Tracking \*.dat" track.log
|
||||
|
||||
contents="contents"
|
||||
contents_oid="$(calc_oid "$contents")"
|
||||
|
||||
printf "$contents" > a.dat
|
||||
|
||||
git add .gitattributes a.dat
|
||||
|
||||
git commit -m "initial commit" 2>&1 | tee commit.log
|
||||
grep "master (root-commit)" commit.log
|
||||
grep "2 files changed" commit.log
|
||||
grep "create mode 100644 a.dat" commit.log
|
||||
grep "create mode 100644 .gitattributes" commit.log
|
||||
|
||||
git push origin master 2>&1 | tee push.log
|
||||
|
||||
pushd $TRASHDIR
|
||||
mkdir "$reponame-clone"
|
||||
cd "$reponame-clone"
|
||||
|
||||
git lfs clone $GITSERVER/$reponame "." 2>&1 | grep "Git LFS"
|
||||
|
||||
assert_local_object "$contents_oid" 8
|
||||
popd
|
||||
)
|
||||
end_test
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/github/git-lfs/git"
|
||||
@ -243,6 +244,8 @@ func commitAtDate(atDate time.Time, committerName, committerEmail, msg string) e
|
||||
}
|
||||
|
||||
func (repo *Repo) AddCommits(inputs []*CommitInput) []*CommitOutput {
|
||||
var storageOnce sync.Once
|
||||
|
||||
if repo.Settings.RepoType == RepoTypeBare {
|
||||
repo.callback.Fatalf("Cannot use AddCommits on a bare repo; clone it & push changes instead")
|
||||
}
|
||||
@ -298,6 +301,7 @@ func (repo *Repo) AddCommits(inputs []*CommitInput) []*CommitOutput {
|
||||
}
|
||||
// this only created the temp file, move to final location
|
||||
tmpfile := cleaned.Filename
|
||||
storageOnce.Do(localstorage.ResolveDirs)
|
||||
mediafile, err := lfs.LocalMediaPath(cleaned.Oid)
|
||||
if err != nil {
|
||||
repo.callback.Errorf("Unable to get local media path: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user