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

After failing PlainClone .git directory nevertheless exists #741

@jkblume

Description

@jkblume

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions