diff --git a/.gitattributes b/.gitattributes index 9e9a0f8..5635875 100644 --- a/.gitattributes +++ b/.gitattributes @@ -38,37 +38,22 @@ Makefile text eol=lf encoding=utf-8 # Force binary files to be binary -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp +*.webp binary +*.gif binary +*.jpg binary +*.png binary +*.pdf binary +*.doc binary +*.DOC binary +*.docx binary +*.DOCX binary +*.dot binary +*.DOT binary +*.PDF binary +*.rtf binary +*.RTF binary + -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary ############################################################################### # diff behavior for common document formats # diff --git a/.gitconfig b/.gitconfig index 46ee228..0b6dbaa 100644 --- a/.gitconfig +++ b/.gitconfig @@ -11,7 +11,4 @@ alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ / | grep -v ^'alias ' | sort [commit] gpgSign = true -[submodule] - active = * - recurse = true diff --git a/Icon.ico b/Icon.ico deleted file mode 100644 index 5d06b9f..0000000 Binary files a/Icon.ico and /dev/null differ diff --git a/docs/libraries.md b/docs/libraries.md index ab14d36..6636e93 100644 --- a/docs/libraries.md +++ b/docs/libraries.md @@ -95,34 +95,77 @@ Libraries are best dealt with as [Git submodules]. [build libraries]:https://git-scm.com/book/en/v2/Git-Tools-Submodules -Git submodules leak complexity and surprising and inconvenient behaviour -all over the place if one is trying to make a change that affects multiple -modules simultaneously. But having your libraries separate from your git -repository results in non portable surprises and complexity. Makes it hard -for anyone else to build your project, because they will have to, by hand, -tell your project where the libraries are on their system. +Git submodules leak complexity and surprising and inconvenient +behaviour all over the place if one is trying to make a change that affects +multiple modules simultaneously. But having your libraries separate from +your git repository results in non portable surprises and complexity. Makes +it hard for anyone else to build your project, because they will have to, by +hand, tell your project where the libraries are on their system. -When one is developing code, you normally have a git branch. But -the git commit of the master project in which the submodule is -contained does not notice its subproject has changed, unless the -subproject head has changed. And the subject project head will not -change if it points to a name, rather than to a particular commit. For -ones changes to a submodule to be reflected in the master project in -any consistent or predictable way, the submodule has to be in -detached head mode, with the head pointing directly to a commit, -rather than pointing to a branch that points to a commit. +When one is developing code, you normally have a git branch. But the git +commit of the master project in which the submodule is contained does +not notice its subproject has changed, unless the subproject head has +changed. And the subject project head will not change if it points to a +name, rather than to a particular commit. For ones changes to a submodule +to be reflected in the master project in any consistent or predictable way, +the submodule has to be in detached head mode, with the head pointing +directly to a commit, rather than pointing to a branch that points to a +commit. -Git commands in master project do not look inside the subproject. -They just look at the subproject's head. +You will import a submodule from someone else's project, but eventually you and your team are going to make minor changes to it to customize it to your project. In which case you will need your own remote team repo, in place of the original other team's repo. -This means that signing off on changes to a submodule is -irrelevant. One signs off on the master project, which includes the -hash of that submodule commit. +Construct the copied remote repositories so that their default branch is your tracking branch, not the upstream branch. -When one is changing submodules for the use of a particular -project, making related changes in the master project and -submodules, one should not track the changes by creating and -updating branch names in the submodule, but by creating and +``` bash +git init --bare -b «our_branch» +``` + +Then, in your local repository where you created the new branch, reset +the remote in your local repository to the new remote by editing `.gitconfig` +and push «our_branch» from your local in which you created your team's new +submodule branch to the remote. + +or +``` bash +git clone --bare «their_remote» -b«their_stable_branch_or_release_tag» +cd «our_new_remote» +git symbolic-ref HEAD refs/heads/«our_new_branch» +``` + +If you fail to set your remote to your team's default branch, then your +local repositories will keep getting reset back to their team's branch, and +chaos ensues. + + +When moving the remote of a submodule in your local repository (usually from their team's remote to your team's remote) you update `.gitmodules` in your superproject, and in each submodule that has submodules of its own, then + +```bash +git submodule update --init --recursive --force +git submodule foreach --recursive 'git status && git switch «our_branch» && git status && git remote -v && git switch --detach' +``` + +Your submodule remotes propagate from `.gitmodules` file of your superproject, and their branch propagates from the superproject *and* from the remote default branch. + +And the branch will *also* propagate from `.gitmodules` if `branch = ...` is set. + +Because git is a distributed archive, it is perfectly possible, and often +necessary, to work with all these set to different values, *provided* that +everyone is mindful that they are set to different values, and the +consequences and implications of them being set to different values. Which +consequences and implications get complicated, unobvious, difficult to +predict, and surprising when you are working with submodules. + +Git commands in master project do not look inside the subproject. They +just look at the subprojects head. + +This means that signing off on changes to a submodule is irrelevant. One +signs off on the master project, which includes the hash of that submodule +commit. + +When one is changing submodules for the use of a particular project, +making related changes in the master project and submodules, one should +not track the changes by creating and updating branch names in the +submodule, but by creating and updating branch names in the containing module, so that the commits in the submodule have no name in the submodule, the submodule is always in detached head state, albeit the head may be @@ -146,37 +189,25 @@ the primary project module,and when you have done with a submodule, git switch --detach ``` -Within the submodule, commits are nameless with detached head, except -when you are working on them, the name in primary module naming a -group of related commits in several submodules, which commits do not -usually receive independent names of their own, even though the commits -have to be made within the submodule, not in the containing module -which names the complete set of interrelated commits. +From the point of view of the containing superproject, submodule +commits are nameless with detached head, except when you are working +on them, the name in primary module naming a group of related commits + in several submodules, which commits do not receive independent names + of their own, even though the commits have to be made within the + submodule, not in the containing module which names the complete set of + interrelated commits. The submodule commits may well belong to different branches and tags in -the superproject, but in the submodules, they are nameless in that all the -submodule commits wind up attached to the same branch, your submodule tracking -branch. +the superproject, but the submodules know nothing of superproject +names, and the superproject knows nothing of submodules names. -In this case, working on submodules as part of a single larger project, you should set - -```bash -git config --local submodule.recurse true -``` - -In the primary project, so that you conveniently push and pull a -group of related changes as one thing, and the build for the whole -project should treat the submodule libraries as having a -dependency on module/.git/modules/submodule/HEAD, rather than -checking every single file in the submodules every time to see -if one has changed, for there could be an enormous number of -them. The primary build should invoke the submodule build, which -*will* check each file in the submodule for changes, only when the -submodule detached head has changed. And therefore, you want it -to change, you want the submodule head to be nameless and -detached, whenever you modify a submodule as part of a larger -project where you test your changes by rebuilding the whole -project to make sure all your related changes fit together. + The primary build should invoke the submodule build, which *will* check + each file in the submodule for changes, only when the submodule + detached head has changed. And therefore, you want it to change, you + want the submodule head to be nameless and detached, whenever you + modify a submodule as part of a larger project where you test your + changes by rebuilding the whole project to make sure all your related + changes fit together. When tracking an upstream submodule that has submodules of its own, which have their own upstreams @@ -189,17 +220,33 @@ git pull upstream --recurse-submodules=on-demand «their-latest-release» Make sure things still work. Get everything working. (You do have unit test, right?) + +When you are working a submodule, your branch has to have a name, or +when you push it and pull it, strange things will happen. But the +superproject pushes and pulls by commit, not by name, so when you are +done, + then: +git submodule foreach --recursive 'git push` + ```bash git submodule foreach --recursive 'git switch --detach' -git submodule foreach --recursive 'git push origin HEAD:«your-tracking-branch»' +git submodule foreach --recursive 'git push` ``` + +As its own thing, a submodule has branches with names. As a component +of a superproject, it has nameless commits. + +If you are in a submodule directory of the superproject, and you push and +pull, what you are pushing and pulling had better have a name, or else +unpleasant surprises will happen. If you are in the superproject directory +and pushing and pulling the whole thing, that commit better be detached. + You pull a named release of the project that is a submodule of your project from `upstream`, diddling with it to make it work with your project, then -you push it to `origin` as a nameless commit, though you probably gave the -various commits you made while working on it temporary and local names -with `switch -c yet-another-idea` +you push it to `origin` under its own name, the you detach it from its name, +so the superproject will know that the submodule has been changed. All of which, of course, presupposes you have already set unit tests, upstream, origin, and your tracking branch appropriately. @@ -209,8 +256,7 @@ repository, on your remote submodule repository they need to have a name to be pushed to, hence you need to have a tracking branch in each of your remote images of each of your submodules, and that tracking branch will need to point to the root of a tree of all the nameless commits that the -names and commits -in your superproject that contains this submodules point to. +names and commits in your superproject that contains this submodules point to. You want `.gitmodules` in your local image of the repository to reflect the location and fork of your new remote repository, with @@ -225,10 +271,33 @@ you rely someone else's compiled code, things break and you get accidental and deliberate backdoors, which is a big concern when you are doing money and cryptography. -GitSubmodules is hierarchical, but source code has strange loops. The Bob -module uses the Alice module and the Carol module, but Alice uses Bob -and Carol, and Carol uses Alice and Bob. How do you make sure that all -your modules are using the same commit of Alice? +When your submodules are simply your copy of someone else code, it gets + little bit messy. When you change them, it gets messier. + +And visual studio's handling of submodules is just broken and buggy. A +command that works in git-bash will produce unexpected surprising, and +unpleasant results in visual studio's git. I really need to give up on +visual studio, it is closed source code, and turning bad. + +When one developer makes minor changes in submodule to make it work +with the whole project on which several developers are working on, no +end of mysterious grief ensues, because strange and curiously difficult to +identify differences appear between builds that Git would normally ensure +are the same build. Submodules are a halfway house between completely +absorbing the other party's code into your code, and using it as a prebuilt +library. Instead, we have walls dividing the project into pieces, which is a +lot less grief than on big pile of code, but managing those walls winds up +taking a lot of time, and mistakes get made because a git commit in a +project with submodules that have changed does not mean quite the same +thing, nor have quite the same behaviour, as git commit in a project with +unchanging submodules. But then truly integrating a project that is the +product of a great deal of time by a great many of people, and managing it + thereafter, is likely to take up a great deal more time. + +Git Submodules is hierarchical, but source code has strange loops. The +Bob module uses the Alice module and the Carol module, but Alice uses +Bob and Carol, and Carol uses Alice and Bob. How do you make sure that +all your modules are using the same commit of Alice? Well, if modules have strange loops you make one of them the master, and the rest of them direct submodules of that master, brother subs to each diff --git a/rho.ico b/docs/rho.ico similarity index 100% rename from rho.ico rename to docs/rho.ico diff --git a/wallet.manifest b/msvc/wallet.manifest similarity index 100% rename from wallet.manifest rename to msvc/wallet.manifest diff --git a/wallet.rc b/msvc/wallet.rc similarity index 94% rename from wallet.rc rename to msvc/wallet.rc index 6b72f9f..9e1a334 100644 --- a/wallet.rc +++ b/msvc/wallet.rc @@ -2,7 +2,7 @@ // The visual studio resource editor will screw it up. #pragma code_page(65001) // UTF-8 // this icon is used with wxFrame::SetIcon() -AAArho ICON "rho.ico" +AAArho ICON "../docs/rho.ico" // set this to 1 if you don't want to use manifest resource (manifest resource // is needed to enable visual styles on Windows XP - see docs/msw/winxp.txt diff --git a/wallet.vcxproj b/msvc/wallet.vcxproj similarity index 73% rename from wallet.vcxproj rename to msvc/wallet.vcxproj index c8e4738..49c8256 100644 --- a/wallet.vcxproj +++ b/msvc/wallet.vcxproj @@ -43,15 +43,19 @@ true - GSL\include;wxWidgets\include\msvc;wxWidgets\include;libsodium\src\libsodium\include;mpir;$(IncludePath) - wxWidgets\lib\vc_x64_lib\;libsodium\Build\Debug\X64;mpir\lib\x64\Debug;$(LibraryPath) + $(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath) + $(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\Build\Debug\X64;$(SolutionDir)mpir\lib\x64\Debug;$(LibraryPath) + $(SolutionDir)build\$(Configuration)\ + $(SolutionDir)build\$(Configuration)\ false - GSL\include;wxWidgets\include\msvc;wxWidgets\include;libsodium\src\libsodium\include;mpir;$(IncludePath) - wxWidgets\lib\vc_x64_lib\;libsodium\Build\Release\X64;mpir\lib\x64\Release;$(LibraryPath) + $(SolutionDir)wxWidgets\include\msvc;$(SolutionDir)wxWidgets\include;$(SolutionDir)libsodium\src\libsodium\include;$(SolutionDir)mpir;$(IncludePath) + $(SolutionDir)wxWidgets\lib\vc_x64_lib\;$(SolutionDir)libsodium\Build\Release\X64;$(SolutionDir)mpir\lib\x64\Release;$(LibraryPath) + $(SolutionDir)build\$(Configuration)\ + $(SolutionDir)build\$(Configuration)\ @@ -119,60 +123,59 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - + + + + + NotUsing NotUsing - + NotUsing NotUsing - - - - - + + + + + NotUsing NotUsing - + NotUsing NotUsing - + Create Create - - - /utf-8 %(AdditionalOptions) + + - + - + diff --git a/winConfig.bat b/msvc/winConfig.bat similarity index 91% rename from winConfig.bat rename to msvc/winConfig.bat index 2c905e2..fb3fff9 100644 --- a/winConfig.bat +++ b/msvc/winConfig.bat @@ -94,28 +94,28 @@ IF %ERRORLEVEL% NEQ 0 ( echo on cd ..\..\.. -msbuild wallet.vcxproj -p:Configuration=Debug;Platform=x64 -m +msbuild wallet.sln -p:Configuration=Debug;Platform=x64 -m echo off IF %ERRORLEVEL% NEQ 0 ( PAUSE GOTO:EOF ) echo on -msbuild wallet.vcxproj -p:Configuration=Release;Platform=x64 -m +msbuild wallet.sln -p:Configuration=Release;Platform=x64 -m echo off IF %ERRORLEVEL% NEQ 0 ( PAUSE GOTO:EOF ) echo on -.\x64\Debug\wallet.exe --complete --test +.\build\Debug\wallet.exe --complete --test echo off IF %ERRORLEVEL% NEQ 0 ( echo failed unit test on debug build ) ELSE ( echo passed unit test on debug build) echo on -.\x64\Release\wallet.exe --complete --test +.\build\Release\wallet.exe --complete --test echo off IF %ERRORLEVEL% NEQ 0 ( echo failed unit test on release build diff --git a/ILog.cpp b/src/ILog.cpp similarity index 100% rename from ILog.cpp rename to src/ILog.cpp diff --git a/ILog.h b/src/ILog.h similarity index 100% rename from ILog.h rename to src/ILog.h diff --git a/ISqlit3Impl.cpp b/src/ISqlit3Impl.cpp similarity index 99% rename from ISqlit3Impl.cpp rename to src/ISqlit3Impl.cpp index 75716eb..cebd543 100644 --- a/ISqlit3Impl.cpp +++ b/src/ISqlit3Impl.cpp @@ -14,7 +14,7 @@ #include // for shared_ptr, unique_ptr #include #include "ISqlite3.h" -#include "sqlite3/sqlite3.h" +#include "sqlite3.h" static auto error_message(int rc, sqlite3* pdb) { return std::string("Sqlite3 Error: ") + sqlite3_errmsg(pdb) + ". Sqlite3 error number=" + std::to_string(rc); diff --git a/ISqlite3.h b/src/ISqlite3.h similarity index 100% rename from ISqlite3.h rename to src/ISqlite3.h diff --git a/app.cpp b/src/app.cpp similarity index 100% rename from app.cpp rename to src/app.cpp diff --git a/app.h b/src/app.h similarity index 100% rename from app.h rename to src/app.h diff --git a/db_accessors.h b/src/db_accessors.h similarity index 100% rename from db_accessors.h rename to src/db_accessors.h diff --git a/display_wallet.cpp b/src/display_wallet.cpp similarity index 100% rename from display_wallet.cpp rename to src/display_wallet.cpp diff --git a/display_wallet.h b/src/display_wallet.h similarity index 100% rename from display_wallet.h rename to src/display_wallet.h diff --git a/frame.cpp b/src/frame.cpp similarity index 100% rename from frame.cpp rename to src/frame.cpp diff --git a/frame.h b/src/frame.h similarity index 100% rename from frame.h rename to src/frame.h diff --git a/introspection_of_standard_C_types.h b/src/introspection_of_standard_C_types.h similarity index 100% rename from introspection_of_standard_C_types.h rename to src/introspection_of_standard_C_types.h diff --git a/localization.cpp b/src/localization.cpp similarity index 100% rename from localization.cpp rename to src/localization.cpp diff --git a/localization.h b/src/localization.h similarity index 100% rename from localization.h rename to src/localization.h diff --git a/mpir_and_base58.cpp b/src/mpir_and_base58.cpp similarity index 100% rename from mpir_and_base58.cpp rename to src/mpir_and_base58.cpp diff --git a/mpir_and_base58.h b/src/mpir_and_base58.h similarity index 100% rename from mpir_and_base58.h rename to src/mpir_and_base58.h diff --git a/rho.xpm b/src/rho.xpm similarity index 100% rename from rho.xpm rename to src/rho.xpm diff --git a/ristretto255.cpp b/src/ristretto255.cpp similarity index 100% rename from ristretto255.cpp rename to src/ristretto255.cpp diff --git a/ristretto255.h b/src/ristretto255.h similarity index 100% rename from ristretto255.h rename to src/ristretto255.h diff --git a/rotime.cpp b/src/rotime.cpp similarity index 100% rename from rotime.cpp rename to src/rotime.cpp diff --git a/rotime.h b/src/rotime.h similarity index 100% rename from rotime.h rename to src/rotime.h diff --git a/secrets.cpp b/src/secrets.cpp similarity index 100% rename from secrets.cpp rename to src/secrets.cpp diff --git a/secrets.h b/src/secrets.h similarity index 100% rename from secrets.h rename to src/secrets.h diff --git a/slash6.cpp b/src/slash6.cpp similarity index 100% rename from slash6.cpp rename to src/slash6.cpp diff --git a/slash6.h b/src/slash6.h similarity index 100% rename from slash6.h rename to src/slash6.h diff --git a/sqlite3/sqlite3.h b/src/sqlite3.h similarity index 100% rename from sqlite3/sqlite3.h rename to src/sqlite3.h diff --git a/stdafx.cpp b/src/stdafx.cpp similarity index 100% rename from stdafx.cpp rename to src/stdafx.cpp diff --git a/stdafx.h b/src/stdafx.h similarity index 100% rename from stdafx.h rename to src/stdafx.h diff --git a/testbed.cpp b/src/testbed.cpp similarity index 100% rename from testbed.cpp rename to src/testbed.cpp diff --git a/unit_test.cpp b/src/unit_test.cpp similarity index 100% rename from unit_test.cpp rename to src/unit_test.cpp diff --git a/welcome_to_rhocoin.cpp b/src/welcome_to_rhocoin.cpp similarity index 100% rename from welcome_to_rhocoin.cpp rename to src/welcome_to_rhocoin.cpp diff --git a/welcome_to_rhocoin.h b/src/welcome_to_rhocoin.h similarity index 100% rename from welcome_to_rhocoin.h rename to src/welcome_to_rhocoin.h diff --git a/wallet.sln b/wallet.sln index 268ac46..45b6602 100644 --- a/wallet.sln +++ b/wallet.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.32014.148 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wallet", "wallet.vcxproj", "{B1EC18D5-FA70-4A59-8CAE-EDC65A358314}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wallet", "msvc/wallet.vcxproj", "{B1EC18D5-FA70-4A59-8CAE-EDC65A358314}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F7D488C-DC53-4ECE-87E2-4FEA32C153EF}" EndProject