You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the instructions from this wiki, I cloned my repo Foo into the TbTb default projects folder: /MY/MATLAB/USER/PATH/projects/Foo
As I usually work on the branch dev, I specified the field "flavor": "dev"
in the Foo.json file.
The surprising behavior
After launching MATLAB, the command tbUseProject('Foo'); automatically creates a copy of my repo and renames it by appending the branch name to the folder name, yielding the new folder: /MY/MATLAB/USER/PATH/projects/Foo_dev
This behavior surprised me because it has the following consequences:
If I want to make an edit to my project on the fly, without pushing my changes to GitHub, these edits should be brought to the Foo_dev folder and not to the Foo folder.
If I type tbUseProject('Foo_dev');, TbTb complains because no file Foo_dev.json exists. If I create such file and keep the line "flavor": "dev", then TbTb will create the folder /MY/MATLAB/USER/PATH/projects/Foo_dev_dev, which is clearly not useful to me.
To keep things consistent, it seems to me that any project living in the projects folder should be callable by tbUseProject. The solution to item 2 above is to omit the line specifying the flavor in the Foo_dev.json file.
A suggestion for improvement
But there is a more high-level question about what the intended workflow for TbTb and different branches from the same git project is. Creating one folder per branch doesn't seem ideal to me; especially if each branch requires a different .json file. Instead I could imagine an optional second argument that could be given to the tbUseProject() function, which would specify the branch (or any tree-ish) that the user intends to use during his TbTb session. TbTb would then checkout the appropriate branch, directly in the Foo folder. This suggested second argument could be designed to take priority over the field flavor from the .json file. Other situations that could occur are:
If no second argument is specified, then TbTb uses the flavor from the .json file -- but note that I am also suggesting to change the current behavior in this scenario; that is, no Foo_dev folder would get created.
If no second argument is specified, and no flavor field exists in the .json file, TbTb behaves as it currently does.
The text was updated successfully, but these errors were encountered:
I apologize I somehow missed this issue when it was posted.
I agree that the way "flavor" handles branches is not ideal. I can't remember right now why we did it that way when we designed the system.
What we do in our lab when we develop is just have one .json file and then switch branches outside of TbTb, using git directly. This works pretty well for us but I agree that having a way to do it in the calls tbUse and tbUseProject makes sense.
One possibility would be to change the behavior of flavor to do what you expected, and then make it passable as a key-value pair to the function calls. (Actually, I think it already is parsed there as a key-value pair). The other would be to add a new field called, say, "branch" and have that do what you expect.
I will think about this and try to implement something. It is not going to be real soon, though, as I'm piled up with other things.
My setup
Following the instructions from this wiki, I cloned my repo
Foo
into the TbTb default projects folder:/MY/MATLAB/USER/PATH/projects/Foo
As I usually work on the branch
dev
, I specified the field"flavor": "dev"
in the
Foo.json
file.The surprising behavior
After launching MATLAB, the command
tbUseProject('Foo');
automatically creates a copy of my repo and renames it by appending the branch name to the folder name, yielding the new folder:/MY/MATLAB/USER/PATH/projects/Foo_dev
This behavior surprised me because it has the following consequences:
Foo_dev
folder and not to theFoo
folder.tbUseProject('Foo_dev');
, TbTb complains because no fileFoo_dev.json
exists. If I create such file and keep the line"flavor": "dev"
, then TbTb will create the folder/MY/MATLAB/USER/PATH/projects/Foo_dev_dev
, which is clearly not useful to me.To keep things consistent, it seems to me that any project living in the
projects
folder should be callable bytbUseProject
. The solution to item 2 above is to omit the line specifying the flavor in theFoo_dev.json
file.A suggestion for improvement
But there is a more high-level question about what the intended workflow for TbTb and different branches from the same git project is. Creating one folder per branch doesn't seem ideal to me; especially if each branch requires a different
.json
file. Instead I could imagine an optional second argument that could be given to thetbUseProject()
function, which would specify the branch (or any tree-ish) that the user intends to use during his TbTb session. TbTb would thencheckout
the appropriate branch, directly in theFoo
folder. This suggested second argument could be designed to take priority over the fieldflavor
from the.json
file. Other situations that could occur are:flavor
from the.json
file -- but note that I am also suggesting to change the current behavior in this scenario; that is, noFoo_dev
folder would get created.flavor
field exists in the.json
file, TbTb behaves as it currently does.The text was updated successfully, but these errors were encountered: