Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Not a gitflow-enabled repo yet. Please run 'git flow init' first." error message on newly git flow init'ed repo. #1720

Closed
1 task done
silasfn opened this issue Jun 12, 2018 · 7 comments

Comments

@silasfn
Copy link

silasfn commented Jun 12, 2018

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
    64 bit
$ git --version --build-options
git version 2.17.1.windows.2
cpu: x86_64
built from commit: a60968cf435951d9411fc0f980a2e362d5cccea2
sizeof-long: 4
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17134.1] - 64 bit
  • What options did you set as part of the installation? Or did you choose the
    defaults?
$  cat /etc/install-options.txt
Editor Option: Notepad++
Path Option: BashOnly
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

No

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash, on MINGW64

## (on newly installed Git for Windows)
cd ~
# git clone any repo - eg:
git clone --recursive git://github.com/petervanderdoes/gitflow.git
cd gitflow
git checkout master
git checkout develop
git flow init

Which branch should be used for bringing forth production releases?
   - develop
   - master
Branch name for production releases: [master]

Which branch should be used for integration of the "next release"?
   - develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? [feature/]
Bugfix branches? [bugfix/]
Release branches? [release/]
Hotfix branches? [hotfix/]
Support branches? [support/]
Version tag prefix? []
Hooks and filters directory? [(path/to)/gitflow/.git/hooks]

git flow feature start abc-123
Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.


  • What did you expect to occur after running these commands?
    After running git flow init, I expected git flow feature start to create a feature branch

  • What actually happened instead?
    I got this error message:
    Fatal: Not a gitflow-enabled repo yet. Please run 'git flow init' first.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Seems to occur on any git repository I have cloned, including
git clone --recursive git://github.com/petervanderdoes/gitflow.git

@shiftkey
Copy link

I'd recommend reporting this to the git-flow project to see if they can help with troubleshooting why initialising isn't working: https://github.com/petervanderdoes/gitflow-avh

@silasfn
Copy link
Author

silasfn commented Jun 12, 2018

Thanks Brendan. Have reposted the issue at: petervanderdoes/gitflow-avh#372

@dscho
Copy link
Member

dscho commented Jun 16, 2018

It was my understanding that not only the original git-flow project, but also the -avh fork were abandoned by their maintainers.

If your shell-scripting fu is up to par, maybe you want ho debug this further? If you come up with a patch, I am willing to work around the absence of git-flow maintenance by taking out-of-band contributions (I would start a fork of git-flow-avh in the git-for-windows org to that end).

If it was me, I would start by editing C:\Program Files\Git\usr\bin\git-flow (as admin because that file is write-protected) and insert set -x after the first line, the run the command again and try to match the command trace against the git-flow script to figure out where the bug comes from.

@silasfn
Copy link
Author

silasfn commented Jun 17, 2018

Thanks Johannes. I was able to debug using the set -x flag.
In file C:\Program Files\Git\usr\bin\gitflow-common
Need to add a ! just before $(git config --get-regexp gitflow.prefix >/dev/null 2>&1) ... ie change to this around line 297

gitflow_is_initialized() {
	gitflow_has_master_configured                    && \
	gitflow_has_develop_configured                   && \
	[ "$(git config --get gitflow.branch.master)" != "$(git config --get gitflow.branch.develop)" ] && \
	! $(git config --get-regexp gitflow.prefix >/dev/null 2>&1)
}

My limited tests seem to work - git flow feature start test succeeded after that change, and returned an error after I removed the "gitflow.prefix" lines from my .git/config file (expected behaviour).

If you fork the branch, I'll submit a pull request ... or you can apply the above change after you fork.

@silasfn
Copy link
Author

silasfn commented Jun 17, 2018

Pull request here: petervanderdoes/gitflow-avh#374

@dscho
Copy link
Member

dscho commented Jun 21, 2018

My limited tests seem to work - git flow feature start test succeeded after that change, and returned an error after I removed the "gitflow.prefix" lines from my .git/config file (expected behaviour).

Wait, I don't understand.

$ git config --get-regexp gitflow.prefix

$ echo $?
1

So I am missing gitflow.prefix, and the git config call fails. If I call the same command with an existing config setting, it succeeds.

Ah. I think I know what it is. Does it work if you remove the $(...) parentheses, i.e.

gitflow_is_initialized() {
	gitflow_has_master_configured                    && \
	gitflow_has_develop_configured                   && \
	[ "$(git config --get gitflow.branch.master)" != "$(git config --get gitflow.branch.develop)" ] && \
	git config --get-regexp gitflow.prefix >/dev/null 2>&1
}

?

@silasfn
Copy link
Author

silasfn commented Jun 21, 2018

Thanks Johannes. Looks like that works.
(Unlike my shell scripting fu, which clearly needs some work!)

With the $(...) removed, I can run "git flow [feature || release] [start || finish] [somebranchname]" without issues. I'll update the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants