aleksandr-m / gitflow-maven-plugin

The Git-Flow Maven Plugin supports various Git workflows, including GitFlow and GitHub Flow. This plugin runs Git and Maven commands from the command line.
https://aleksandr-m.github.io/gitflow-maven-plugin/
Apache License 2.0
488 stars 180 forks source link

git command error and strange behaviour on Windows #320

Closed CidTori closed 2 years ago

CidTori commented 2 years ago

When running mvn gitflow:release-finish (for example) in CMD on Windows (with git for Windows installed), strange things happen :

CidTori commented 2 years ago

For the record, git for-each-ref --format="%(refname:short)" refs/heads/release/** doesn't work on CMD (it gives short)...), but git for-each-ref --format="%%%%%%%%(refname:short)" refs/heads/release/** does... (Windows is fun)

aleksandr-m commented 2 years ago

Which git version? Which windows? Which plugin version do you use? How do you running maven build?

CidTori commented 2 years ago
aleksandr-m commented 2 years ago

Cannot reproduce.

The git for-each-ref --format="%(refname:short)" refs/heads/release/** works just fine in cmd and power shell.

When git tries to checkout unknown branch it will fail along with the maven goal, outputting something like release-finish: error: pathspec 'some_wrong_branch_name_here' did not match any file(s) known to git and BUILD FAILURE.

CidTori commented 2 years ago

Did you try release-finish after a successful release-start?

It seems that in my case, git for-each-ref --format="%(refname:short)" refs/heads/release/** will output a short) line for any release/ branch in my repo, but sometimes (I didn't determine the conditions yet), release-start will also fail silently and, since it didn't create a release/ branch, no short) is output with git for-each-ref --format="%(refname:short)" refs/heads/release/**.

CidTori commented 2 years ago

You can also simply try git for-each-ref --format="%(refname:short)" in any repo

CidTori commented 2 years ago

Nevermind, I found the problem : on my machine I call git through a .bat that calls git.exe, passing the CLI parameters with %*, which apparently do the % substitution somewhere. I'm closing this.