twinbasic / twinbasic

274 stars 24 forks source link

Git support considerations #35

Open bclothier opened 3 years ago

bclothier commented 3 years ago

Is your feature request related to a problem? Please describe. VB6 and VBA projects has presented several challenges for good source code control. One key contribution to the problem is that there are several binaries associated with the code. For example, forms are encoded in .frx binrary format which has the following problems with git:

1) It cannot be directly reviewed by other humans 2) The order it writes out the contents is indeterministic, so it can potentially generate fake difference which make it hard to tell what really changed vs. just "noise" 3) Binary files cannot be diff'd for its content.

Describe the solution you'd like All binaries files* should have a text file representation that is consistent and always reproduces exactly the same sequence of properties so that the diff is small and focus on what actually has changed (as opposed to some bogus change arising from transposing 2 lines or something like that).

Those text files should be then committed to a git repository (or any preferred SCC system) and can be then used to rebuild a twinBASIC project file completely.

Additional context Another painful aspect of managing a .vbp file is that the references are full path. Ideally, we should avoid any references that requires full path and be always relative to a certain root to avoid the problems associated with not finding the linked files on a different system.

A9G-Data-Droid commented 3 years ago

I noticed today that all of the "files" in a twin project are inside that one .twinproj project file. This file is also seen as binary format by the default git diff. In the future, I would like all files to be physically separate on disk with folder support.

For now, the workaround is to make a file named .gitattributes in your root folder with the following contents:

[attr]textfile text diff

*.twinproj textfile

This will give you text diffs on your project.

WaynePhillipsEA commented 3 years ago

Indeed, the twinproj file is a container, not a text file. Please look at #232 for the proper solution for your source control needs.

DaveInCaz commented 3 years ago

I use VSCode but I don't use it for source control. (I happen to use command line Mercurial + also Tortoise). Having all the project files inside a container format by default seems like a significant inconvenience. Given that most languages (that I'm familiar with) just keep individual files separately (including VB6) how come that isn't the default for TB?

Kr00l commented 3 years ago

You can attach a whole project into an e-mail with just 1 file. I see it more as an advantage..

DaveInCaz commented 3 years ago

@Kr00l I like the option of bundling it all together, sure. But that does seem to narrow down the available workflows quite a lot. IMHO.

(If this just came down to setting an option for it to default to one approach vs. the other then I doubt there would be any problems.)

WaynePhillipsEA commented 3 years ago

The twinproj format does allow us to optionally support external files; we just haven't done some of the additional work in this area to enable it. See #62

Once external files are supported, the twinproj file can basically be used like a traditional project file (like vbp) OR a full all-in-one solution. The choice will be yours.