Coder Social home page Coder Social logo

Comments (6)

wwade avatar wwade commented on June 15, 2024 1
  1. I've reproduced against the latest 3.2, 3.3, 3.4 (3.2.12, 3.3.6, and 3.4.1, respectively).
  2. Here's the snippet, nb localhost is 192.168.208.1, a local docker bridge network host.
func initGerrit() error {
	var err error
	gerritClient, err = gerrit.NewClient(fmt.Sprintf("http://%s:8080", localhost), nil)
	if err != nil {
		return fmt.Errorf("initializing gerrit client: %w", err)
	}
	gerritClient.Authentication.SetBasicAuth("admin", "secret")
	data := &gerrit.ProjectInput{
		Name:              gerritProject,
		Branches:          []string{gerritBranch},
		CreateEmptyCommit: true,
	}
	if _, _, err := gerritClient.Projects.CreateProject(gerritProject, data); err != nil {
		return fmt.Errorf("creating test project: %w", err)
	}
	return nil
}

It ends up with:

creating test project: API call to http://192.168.208.1:8080/a/projects/test/ failed: 400 Bad Request

from go-gerrit.

wwade avatar wwade commented on June 15, 2024

I have a patch in hand and will submit a PR shortly:

--- a/go-gerrit/projects.go	2021-09-08 19:04:43.850861477 -0700
+++ b/go-gerrit/projects.go	2021-09-08 19:21:12.533485144 -0700
@@ -37,7 +37,7 @@
 	Owners                           []string                     `json:"owners,omitempty"`
-	UseContributorAgreements         string                       `json:"use_contributor_agreements"`
-	UseSignedOffBy                   string                       `json:"use_signed_off_by"`
-	CreateNewChangeForAllNotInTarget string                       `json:"create_new_change_for_all_not_in_target"`
-	UseContentMerge                  string                       `json:"use_content_merge"`
-	RequireChangeID                  string                       `json:"require_change_id"`
+	UseContributorAgreements         string                       `json:"use_contributor_agreements,omitempty"`
+	UseSignedOffBy                   string                       `json:"use_signed_off_by,omitempty"`
+	CreateNewChangeForAllNotInTarget string                       `json:"create_new_change_for_all_not_in_target,omitempty"`
+	UseContentMerge                  string                       `json:"use_content_merge,omitempty"`
+	RequireChangeID                  string                       `json:"require_change_id,omitempty"`
 	MaxObjectSizeLimit               string                       `json:"max_object_size_limit,omitempty"`

from go-gerrit.

andygrunwald avatar andygrunwald commented on June 15, 2024

Hey @wwade,
thanks for reporting the issue.
I have two questions:

  1. Which Gerrit version do you use?
  2. Do you have a piece of an example code in Go to reproduce the issue?

from go-gerrit.

andygrunwald avatar andygrunwald commented on June 15, 2024

Great. Thanks a lot, @wwade.

I will try to find time to reproduce this as soon as I can.

from go-gerrit.

wwade avatar wwade commented on June 15, 2024

Sure, thanks! FWIW, I think the PR is safe either way :)

from go-gerrit.

andygrunwald avatar andygrunwald commented on June 15, 2024

Thanks @wwade for raising the issue and following up with a fix.

Fixed in #94

from go-gerrit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.