GitTools / GitTools/GitVersion

GitVersion unable to work with remote reference and needs local copy of branches

Open
#2,921 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C#
Stars
3.1k
Forks
659
Avg merge
13h 15m
Merged PRs (30d)
51

Description

Currently the GitVersion to support gitflow requires all the branches to be local in-order to get the correct version. This is not an issue when working on individual dev machines, but when you start using them with centralized build tool like Jenkins etc., downloading all the branches into the container becomes a challenge. As it takes lots of disk space and time (depends on how clean the graph is, i.e. people remove unwanted feature branches with discipline). My company build pipeline do not download all the branches and thus versioning breaks.

Expected Behavior

Let refer to a simple example, where master is tagged at 1.1.0

  • a commit on develop branch and build creates a version 1.2.0-alpha.#
  • a feature branch "version_test" created from develop, with commit and build should give version 1.2.0-version-test.1+##

Actual Behavior

A feature branch "version_test" created from develop, with commit and build gives version 1.1.0-version-test.1+##
The reason is the develop branch is not downloaded in to the build pipeline container, as it only gets master and "version_test" branch.

Possible Fix

If GitVersion is able to get the information from the remote repository instead dependent on branches available it would resolve the issue.

Steps to Reproduce

  1. create a simple repo with spring boot samples
  2. tag the master with 1.1.0
  3. create develop and make a commit , creating the version "Major": 1, "Minor": 2, "Patch": 0,
  4. create a feature branch "feature/version_test" and make a commit.
  5. gitversion will show a version "Major": 1, "Minor": 2, "Patch": 0,
  6. delete the develop branch from local
  7. gitversion will show a version "Major": 1, "Minor": 1, "Patch": 0,

Context

Since due to limited space for the build container, the build pipeline cannot download all the branches. This is limiting us to make the use of this wonderful tool. Only teams in our company that uses Mainline branch strategy are able to use this tool while projects that uses gitflow have to continue manually control their versions.

Your Environment

All environments

  • Version Used: 5.8.1
  • Operating System and version (Windows 10, Ubuntu 18.04): all
  • Link to your project: cannot due to confidentiality
  • Link to your CI build (if appropriate): NA

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 with the reproduction steps using a repository where develop is deleted locally while the remote still exists, and inspect the entry points that determine GitVersion's branch and version information. Done means a feature branch can resolve the develop history and produce the expected 1.2.0-version-test.1+## version without downloading every branch locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools, release
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.