OpenAPITools / OpenAPITools/openapi-generator

[BUG] git_push.sh can incorrectly set git config without recovery method

Open
#7,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

If git_push.sh is run without supplying any one of git_host git_user_id git_repo_id
then a dummy string is substituted and this dummy string is used to set the git remote.

If on a subsequent run these parameters are supplied correctly then the git remote is not updated.

openapi-generator version

4.3.1

OpenAPI declaration file content or url

Occurs regardless of input file

Generation Details

git_push.sh appears in many (all?) supplied examples and is created when generating python, python-flask and many other languages.

Steps to reproduce

$ /bin/sh ./git_push.sh

remote: The project you were looking for could not be found.
fatal: repository 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git/' not found

$ /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"

remote: The project you were looking for could not be found.
fatal: repository 'https://agile.nat.bt.com/gitlab/GIT_USER_ID/GIT_REPO_ID.git/' not found
$ git remote -v
origin https://github.com/GIT_USER_ID/GIT_REPO_ID.git (fetch)
origin https://github.com/GIT_USER_ID/GIT_REPO_ID.git (push)

Related issues/PRs

None found

Suggest a fix

If any one of git_host git_user_id git_repo_id are not supplied then output an ERROR message and stop rather than the current behaviour of outputting an INFO message and continuing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the git_push.sh script in the supplied examples and reviewing how git_host, git_user_id, and git_repo_id are handled. Reproduce the two command examples, then verify that missing parameters stop with an ERROR and that a later valid run does not retain the dummy remote; check the resulting git remote -v output.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.