Skip to content

[JENKINS-8656] Git SCM fails to build with parameterized builds with empty string #1986

Closed

Description

@jenkins-infra-bot

Create a freestyle build project with the following settings:

  • This build is parameterized
    • Name = BRANCH_SPECIFIER
    • Default Value =
  • Source Code Management
    • Git
      • Branch Specifier (blank for default): = $BRANCH_SPECIFIER

Then trigger a build with BRANCH_SPECIFIER set to default, the empty string. The build will fail with output similar to this:

GitAPI created
Pruning obsolete local branches
[workspace] $ git remote prune ssh://git@​git.socrata.com/core
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://git@​git.socrata.com/core
[workspace] $ git fetch -t ssh://git@​git.socrata.com/core +refs/heads/*:refs/remotes/origin/*
[workspace] $ git submodule init
[workspace] $ git submodule sync
[workspace] $ git config --get remote.origin.url
[workspace] $ git ls-tree HEAD
[workspace] $ git tag -l 
[workspace] $ git rev-parse origin/
ERROR: Nothing to do

An easy workaround is to set the parameter default to "" or "*".


Originally reported by natacado, imported from: Git SCM fails to build with parameterized builds with empty string
  • assignee: abayer
  • status: Closed
  • priority: Minor
  • component(s): git-plugin
  • resolution: Fixed
  • resolved: 2011-04-13T15:44:47+00:00
  • votes: 0
  • watchers: 1
  • imported: 2025-12-02
Raw content of original issue

Create a freestyle build project with the following settings:

  • This build is parameterized
    • Name = BRANCH_SPECIFIER
    • Default Value = <leave blank>
  • Source Code Management
    • Git
      • Branch Specifier (blank for default): = $BRANCH_SPECIFIER

Then trigger a build with BRANCH_SPECIFIER set to default, the empty string. The build will fail with output similar to this:

GitAPI created
Pruning obsolete local branches
[workspace] $ git remote prune ssh://git@git.socrata.com/core
Fetching changes from the remote Git repository
Fetching upstream changes from ssh://git@git.socrata.com/core
[workspace] $ git fetch -t ssh://git@git.socrata.com/core +refs/heads/*:refs/remotes/origin/*
[workspace] $ git submodule init
[workspace] $ git submodule sync
[workspace] $ git config --get remote.origin.url
[workspace] $ git ls-tree HEAD
[workspace] $ git tag -l 
[workspace] $ git rev-parse origin/
ERROR: Nothing to do

An easy workaround is to set the parameter default to "" or "*".

Activity

  1. jenkins-infra-bot commented on Feb 5, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Kohsuke Kawaguchi
    Path:
    changelog.html
    http://jenkins-ci.org/commit/core/fd93cf05df65d831cc5724acdc1a009867937a34
    Log:
    Recording the fix in HUDSON-8656.
    Yes, this is HUDSON-8656 and not JENKINS-8656.

  2. jenkins-infra-bot commented on Apr 13, 2011

    @jenkins-infra-bot
    Author
    scm_issue_link:

    Code changed in jenkins
    User: Andrew Bayer
    Path:
    src/main/java/hudson/plugins/git/GitSCM.java
    http://jenkins-ci.org/commit/git-plugin/dc575dce269020afe79bf0224c906b2520c5438d
    Log:
    [FIXED JENKINS-8656] If branch spec is an empty string, due to an empty parameter, etc, use **.

  3. jenkins-infra-bot commented on Apr 13, 2011

    @jenkins-infra-bot
    Author
    dogfood:

    Integrated in plugins_git-plugin #118
    [FIXED JENKINS-8656] If branch spec is an empty string, due to an empty parameter, etc, use **.

    Andrew Bayer : dc575dce269020afe79bf0224c906b2520c5438d
    Files :

    • src/main/java/hudson/plugins/git/GitSCM.java
  4. jenkins-infra-bot commented on Dec 2, 2025

    @jenkins-infra-bot
    Author

    [Original blocks from Jira: JENKINS-40376]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions