`gbp clone` deletes specified clone path if clone fails

Bug #1551508 reported by Luke Faraone on 2016-03-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
git-buildpackage (Ubuntu)
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.XXXXXXXX/foo$ gbp clone ssh://<email address hidden>/myrepo.git .
gbp:error: Git command failed: Error running git clone: fatal: destination path 'foo' already exists and is not an empty directory.

/tmp/tmp.XXXXXXXX/foo$ ls
bar
/tmp/tmp.XXXXXXXX/foo$ cd .
/tmp/tmp.XXXXXXXX/foo$

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: git-buildpackage 0.6.32
ProcVersionSignature: Ubuntu 4.2.0-30.35-generic 4.2.8-ckt3
Uname: Linux 4.2.0-30-generic x86_64
NonfreeKernelModules: nvidia
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 --
PackageArchitecture: all
SourcePackage: git-buildpackage
UpgradeStatus: Upgraded to wily on 2015-10-29 (124 days ago)

Luke Faraone (lfaraone) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers