forcedotcom / SalesforceMobileSDK-Package

BSD 3-Clause "New" or "Revised" License
22 stars 20 forks source link

Fresh install issue with git submodules #296

Closed oktalk closed 2 months ago

oktalk commented 2 months ago

Getting the following warning from a fresh install. :

warning: adding embedded git repository: mobile_sdk/SalesforceMobileSDK-Android
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint:   git submodule add <url> mobile_sdk/SalesforceMobileSDK-Android
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint:   git rm --cached mobile_sdk/SalesforceMobileSDK-Android
hint:
hint: See "git help submodule" for more information.
hint: Disable this message with "git config advice.addEmbeddedRepo false"
warning: adding embedded git repository: mobile_sdk/SalesforceMobileSDK-iOS

Steps to reproduce:

Run the following:

sudo npm install forcereact -g # forcereact version 12.0.1
forcereact createwithtemplate --templaterepouri=ReactNativeTypeScriptTemplate --platform=ios,android --appname=MyAppName --packagename=com.packagename --organization=Organization --outputdir=appDirectory
cd appDirectory
git status # fatal: not a git repository
git init
git add -A
# warning from above
oktalk commented 2 months ago

Not sure if this is the fix, but here is what I did to stop the warning (URLs taken from .gitmodules inside each repo):

git submodule add https://github.com/forcedotcom/SalesforceMobileSDK-Shared.git mobile_sdk/SalesforceMobileSDK-Android
git submodule add https://github.com/ccgus/fmdb mobile_sdk/SalesforceMobileSDK-iOS
wmathurin commented 2 months ago

Mobile SDK is pulled into the application using git, which causes the warning above. But both repos will behave as you expect, each one adding, committing and pushing only their repos. To get rid of the warning, one can do: git config advice.addEmbeddedRepo false.