Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

After failing PlainClone .git directory nevertheless exists #741

Closed
jkblume opened this issue Feb 2, 2018 · 1 comment
Closed

After failing PlainClone .git directory nevertheless exists #741

jkblume opened this issue Feb 2, 2018 · 1 comment
Labels

Comments

@jkblume
Copy link

jkblume commented Feb 2, 2018

What version of Go are you using (go version)?

go version go1.9.3 darwin/amd64

What did you do?

package main

import (
	"log"
	"os"
	"gopkg.in/src-d/go-git.v4"
	"gopkg.in/src-d/go-git.v4/plumbing"
)

func main() {
	_, err := git.PlainClone("repository", false, &git.CloneOptions{
		URL:           "https://github.com/git-fixtures/basic.git",
		ReferenceName: plumbing.ReferenceName("notexistingbranch"),
	})
	if err != nil {
		if _, err := os.Stat("repository/.git"); err != nil {
			if os.IsNotExist(err) {
				log.Print("Not Exists")
			} else {
			}
		}
		log.Print("Exists")
	}
}

What did you expect to see?

I expexted to see, that the .git directory does not exist after a failing pull

What did you see instead?

I saw that the directory exist, when the error is not nil.

@mcuadros mcuadros added the bug label Feb 3, 2018
@chrisdostert
Copy link
Contributor

chrisdostert commented Feb 4, 2018

we have downstream code to handle this; would be nice to no longer need it. If it helps whoever takes this issue, here's our current implementation: https://github.com/opspec-io/sdk-golang/blob/59be62cca3ade0a121630d60e5dd160cff35a6c5/pkg/puller.go#L80-L102

bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jun 27, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jun 28, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jun 28, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jun 28, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jun 28, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jul 6, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jul 6, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jul 17, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Jul 18, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Aug 1, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 17, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 24, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 24, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 25, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 25, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 25, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 25, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 27, 2018
bjaroszewski added a commit to bjaroszewski/go-git that referenced this issue Sep 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants