`gbp clone` deletes specified clone path if clone fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
git-buildpackage (Ubuntu) |
New
|
Medium
|
Unassigned |
Bug Description
`gbp clone` on a directory will remove the directory if the clone fails:
/tmp/tmp.XXXXXXXX$ gbp clone ssh://<email address hidden>/myrepo.git .
gbp:error: Git command failed: Error running git clone: ssh: Could not resolve hostname example.invalid: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
/tmp/tmp.XXXXXXXX$ cd .
cd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
/tmp/tmp.XXXXXXXX$
Normal `git` does not have this problem:
/tmp/tmp.XXXXXXXX$ git clone ssh://<email address hidden>/myrepo.git~ .
Cloning into '.'...
ssh: Could not resolve hostname example.invalid: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
/tmp/tmp.XXXXXXXX$ cd .
/tmp/tmp.XXXXXXXX$
NOTE: This does NOT cause meaningful data loss because `git` refuses to clone into a non-empty directory:
/tmp/tmp.XXXXXXXX$ mkdir foo
/tmp/tmp.XXXXXXXX$ touch foo/bar
/tmp/tmp.XXXXXXXX$ gbp clone ssh://<email address hidden>/myrepo.git foo
gbp:error: Git command failed: Error running git clone: fatal: destination path 'foo' already exists and is not an empty directory.
/tmp/tmp.XXXXXXXX$ cd foo
/tmp/tmp.
gbp:error: Git command failed: Error running git clone: fatal: destination path 'foo' already exists and is not an empty directory.
/tmp/tmp.
bar
/tmp/tmp.
/tmp/tmp.
ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: git-buildpackage 0.6.32
ProcVersionSign
Uname: Linux 4.2.0-30-generic x86_64
NonfreeKernelMo
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Mar 1 02:27:13 2016
JournalErrors:
No journal files were found.
-- No entries --
PackageArchitec
SourcePackage: git-buildpackage
UpgradeStatus: Upgraded to wily on 2015-10-29 (124 days ago)