diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-05-19 14:15:40 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-05-19 14:24:43 +0200 |
commit | 32332fccc9f1e316bcecf3ab5133331315e31871 (patch) | |
tree | 2a67ac98614cc5ff3889be8d7ae31375aecebb98 /src/clone.c | |
parent | 3c607685da2cf9a22559f53fd7670e1c4cad45e4 (diff) | |
download | libgit2-32332fccc9f1e316bcecf3ab5133331315e31871.tar.gz |
clone: don't error out if the branch already existscmn/clone-into-mirror
We set up the current branch after we fetch from the remote. This means
that the user's refspec may have already created this reference. It is
therefore not an error if we cannot create the branch because it already
exists.
This allows for the user to replicate git-clone's --mirror option.
Diffstat (limited to 'src/clone.c')
-rw-r--r-- | src/clone.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/clone.c b/src/clone.c index c627edbc0..24f1cae59 100644 --- a/src/clone.c +++ b/src/clone.c @@ -171,6 +171,10 @@ static int update_head_to_new_branch( git_reference_free(tracking_branch); + /* if it already existed, then the user's refspec created it for us, ignore it' */ + if (error == GIT_EEXISTS) + error = 0; + return error; } |