Generator-jhipster: upgrade generator don't use the git repo when this one is on a parent directory

Created on 15 Jun 2016  Â·  5Comments  Â·  Source: jhipster/generator-jhipster

Overview of the issue

When i upgrade , he create a new git repo and not used my git repo wich is in the parent directory. (because jhipster project is a sub module of another one)

Motivation for or Use Case

I want to use my existing git repo

JHipster Version(s)

3.4.0 and i try to upgrate to 3.4.1

JHipster configuration, a .yo-rc.json file generated in the root folder

{
"generator-jhipster": {
"jhipsterVersion": "3.4.0",
"baseName": "h2hellUi",
"packageName": "com.highway2urhell",
"packageFolder": "com/highway2urhell",
"serverPort": "8080",
"authenticationType": "session",
"hibernateCache": "ehcache",
"clusteredHttpSession": "no",
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"buildTool": "maven",
"enableSocialSignIn": false,
"rememberMeKey": "e0d1f08bfd09708515bd76f01501a969ecaf5f96",
"useSass": false,
"applicationType": "monolith",
"testFrameworks": [
"gatling",
"cucumber",
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en",
"fr"
]
}
}

Entity configuration(s) entityName.json files generated in the .jhipster directory

NA

Browsers and Operating System

Mac osx but no link i think.

Reproduce the error

create a parent project and a git repo, add a sub directory and create a jhipster app inside the sub directory, execute the upgrader.

Related issues

NA

Suggest a Fix

https://github.com/jhipster/generator-jhipster/blob/master/generators/upgrade/index.js#L107

Maybe use
git rev-parse --git-dir
as explain here: http://stackoverflow.com/questions/2180270/check-if-current-directory-is-a-git-repository

Most helpful comment

I think the problem is that generators/upgrade/index.js#L106's assertGitRepository is checking for a .git dir in the current folder which doesn't work if the JHipster app is not at the root of the repo (which is a valid use case IMO especially with microservices).

@lordlothar99 Maybe you can use git rev-parse --is-inside-work-tree as a better check for git (git rev-parse docs).

All 5 comments

The idea is that your project has got its own Git repo.

So I understand it doesn't work for you, then I'm not sure we should do anything about it - OK for testing this and blocking the upgrade process, but I don't think we should spend time solving this.

@lordlothar99 what do you think?

I think the problem is that generators/upgrade/index.js#L106's assertGitRepository is checking for a .git dir in the current folder which doesn't work if the JHipster app is not at the root of the repo (which is a valid use case IMO especially with microservices).

@lordlothar99 Maybe you can use git rev-parse --is-inside-work-tree as a better check for git (git rev-parse docs).

Yes exactly, you guys got the fix... Do u need me to create the PR, or do u?

Oh if you know how to fix that, yes can you do the PR? Honestly I don't have the time to test at the moment

Yeah no pb, I'll create the PR asap

Le mer. 15 juin 2016 15:03, Julien Dubois [email protected] a
écrit :

Oh if you know how to fix that, yes can you do the PR? Honestly I don't
have the time to test at the moment

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/jhipster/generator-jhipster/issues/3717#issuecomment-226180302,
or mute the thread
https://github.com/notifications/unsubscribe/AC4SUqk-sV7YmFgwnIr4NKQUJD8Qpq6tks5qL_gogaJpZM4I2RnE
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  Â·  3Comments

ahmedeldeeb25 picture ahmedeldeeb25  Â·  3Comments

kaidohallik picture kaidohallik  Â·  3Comments

DanielFran picture DanielFran  Â·  3Comments

frantzynicolas picture frantzynicolas  Â·  3Comments