Skip to content

[TCE-1173] Version always bumped even when no commit matches log-path filter #100

Description

@jackie-linz

Test case

  it "should not bump version if no commit matches log-path filter" do
    tmp = InTmp.new

    begin
      git = GitVersion::Git.new("dev", "master", "feature:", "breaking:", tmp.@tmpdir, "dir1-", "dir1/")

      tmp.exec %(git init)
      tmp.exec %(git checkout -b master)

      # Create dir1 and tag dir1-1.0.0
      base_dir = "dir1"
      tmp.exec %(mkdir #{base_dir} && touch #{base_dir}/dummy_file)
      tmp.exec %(git add #{base_dir}/)
      tmp.exec %(git commit --no-gpg-sign -m "feature: 1")
      tmp.exec %(git tag "dir1-1.0.0")

      # Create dir2 and tag dir2-1.0.0
      base_dir = "dir2"
      tmp.exec %(mkdir #{base_dir} && touch #{base_dir}/dummy_file)
      tmp.exec %(git add #{base_dir}/)
      tmp.exec %(git commit --no-gpg-sign -m "feature: 2")
      tmp.exec %(git tag "dir2-1.0.0")

      # Commit feature in dir2
      base_dir = "dir2"
      tmp.exec %(mkdir -p #{base_dir} && touch #{base_dir}/dummy_file_2)
      tmp.exec %(git add #{base_dir}/)
      tmp.exec %(git commit --no-gpg-sign -m "feature: 3")

      # git-version should not bump version for dir1
      version = git.get_new_version
      hash = git.current_commit_hash
      version.should eq("dir1-1.0.0")
    ensure
      tmp.cleanup
    end
  end

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    jira-issueIssue tracked on JIRA

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions