ToolboxHub / ToolboxToolbox

Declarative dependency management for Matlab.
The Unlicense
27 stars 11 forks source link

is it possible to change the default git branch from master to something else? #111

Closed irisgroen closed 3 years ago

irisgroen commented 3 years ago

Hi,

This may be related to #96, I'm not exactly sure, but I'm wondering if there's a potential solution to the following:

I have a configuration .json in which I add a remote git repository that does not have a 'master' branch, instead the default branch is called 'main'. I know I can check out other branches than master by adding it as a flavor (see below). However when I call tbUse I still get an error message:

Error: "JSONio" had status 1, message "Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched."

So my impression is that ToolboxToolbox by default checks the master branch and throws the error. Is there are way to override this default by changing my configuration file? I think it is still updating (because of the flavor) so that's not the issue, rather that having the error be consistently there may give others using my configuration files the impression something is wrong and may make me miss other relevant error messages.

Many thanks for your help!

[
    {
        "flavor": "main",
        "hook": "",
        "name": "JSONio",
        "pathPlacement": "append",
        "printLocalHookOutput": 0,
        "subfolder": "",
        "toolboxRoot": "",
        "type": "git",
        "update": "",
        "url": "https://github.com/gllmflndn/JSONio"
    }
]
DavidBrainard commented 3 years ago

Hi,

I'm not able to reproduce the issue. I added your config file above to the registry as JSONTestIssue.json. I had to change the 0 in "printLocalHookOutput" to "" to avoid an error (can't use numbers). It then ran as expected without printing an error or warning. I am using a Macintosh. My output is below. I ran the tbUse command twice, once for initial install and once to see what happened after install. No error message or warning either time.

Maybe try deleting the toolbox from your system and trying again? It installs this toolbox in folder "JSONio_main". If this doesn't work, we'll have to delve further about what's different across our systems.

Best,

David

tbUse('JSONTestIssue') Local copy of ToolboxToolbox is up to date. Updating "ToolboxRegistry". Already up to date. Obtaining "JSONio". Cloning into '/Users/dhb/Documents/MATLAB/toolboxes/JSONio_main'... remote: Enumerating objects: 76, done.
remote: Counting objects: 12% (1/8)
remote: Counting objects: 25% (2/8)
remote: Counting objects: 37% (3/8)
remote: Counting objects: 50% (4/8)
remote: Counting objects: 62% (5/8)
remote: Counting objects: 75% (6/8)
remote: Counting objects: 87% (7/8)
remote: Counting objects: 100% (8/8)
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 14% (1/7)
remote: Compressing objects: 28% (2/7)
remote: Compressing objects: 42% (3/7)
remote: Compressing objects: 57% (4/7)
remote: Compressing objects: 71% (5/7)
remote: Compressing objects: 85% (6/7)
remote: Compressing objects: 100% (7/7)
remote: Compressing objects: 100% (7/7), done.
Unpacking objects: 1% (1/76) Unpacking objects: 2% (2/76) Unpacking objects: 3% (3/76) Unpacking objects: 5% (4/76) Unpacking objects: 6% (5/76) Unpacking objects: 7% (6/76) Unpacking objects: 9% (7/76) Unpacking objects: 10% (8/76) Unpacking objects: 11% (9/76) Unpacking objects: 13% (10/76) Unpacking objects: 14% (11/76) Unpacking objects: 15% (12/76) Unpacking objects: 17% (13/76) Unpacking objects: 18% (14/76) Unpacking objects: 19% (15/76) Unpacking objects: 21% (16/76) Unpacking objects: 22% (17/76) Unpacking objects: 23% (18/76) Unpacking objects: 25% (19/76) Unpacking objects: 26% (20/76) Unpacking objects: 27% (21/76) Unpacking objects: 28% (22/76) Unpacking objects: 30% (23/76) Unpacking objects: 31% (24/76) Unpacking objects: 32% (25/76) Unpacking objects: 34% (26/76) Unpacking objects: 35% (27/76) Unpacking objects: 36% (28/76) Unpacking objects: 38% (29/76) Unpacking objects: 39% (30/76) Unpacking objects: 40% (31/76) Unpacking objects: 42% (32/76) Unpacking objects: 43% (33/76) Unpacking objects: 44% (34/76) Unpacking objects: 46% (35/76) remote: Total 76 (delta 1), reused 6 (delta 1), pack-reused 68
Unpacking objects: 47% (36/76) Unpacking objects: 48% (37/76) Unpacking objects: 50% (38/76) Unpacking objects: 51% (39/76) Unpacking objects: 52% (40/76) Unpacking objects: 53% (41/76) Unpacking objects: 55% (42/76) Unpacking objects: 56% (43/76) Unpacking objects: 57% (44/76) Unpacking objects: 59% (45/76) Unpacking objects: 60% (46/76) Unpacking objects: 61% (47/76) Unpacking objects: 63% (48/76) Unpacking objects: 64% (49/76) Unpacking objects: 65% (50/76) Unpacking objects: 67% (51/76) Unpacking objects: 68% (52/76) Unpacking objects: 69% (53/76) Unpacking objects: 71% (54/76) Unpacking objects: 72% (55/76) Unpacking objects: 73% (56/76) Unpacking objects: 75% (57/76) Unpacking objects: 76% (58/76) Unpacking objects: 77% (59/76) Unpacking objects: 78% (60/76) Unpacking objects: 80% (61/76) Unpacking objects: 81% (62/76) Unpacking objects: 82% (63/76) Unpacking objects: 84% (64/76) Unpacking objects: 85% (65/76) Unpacking objects: 86% (66/76) Unpacking objects: 88% (67/76) Unpacking objects: 89% (68/76) Unpacking objects: 90% (69/76) Unpacking objects: 92% (70/76) Unpacking objects: 93% (71/76) Unpacking objects: 94% (72/76) Unpacking objects: 96% (73/76) Unpacking objects: 97% (74/76) Unpacking objects: 98% (75/76) Unpacking objects: 100% (76/76) Unpacking objects: 100% (76/76), done. Already on 'main' Your branch is up to date with 'origin/main'. Resetting path to factory state. Adding "ToolboxToolbox" to path at "/Users/dhb/Documents/MATLAB/ToolboxToolbox". Adding "JSONio_main" to path at "/Users/dhb/Documents/MATLAB/toolboxes/JSONio_main". Checking for "JSONio_main" local hook. Checking for "JSONTestIssue" local hook. Looks good: 1 resolved toolboxes deployed OK.

ans =

struct with fields:

          cdToFolder: ''
               extra: ''
              flavor: 'main'
                hook: [1×0 char]
          importance: ''
                java: ''
   localHookTemplate: ''
                name: 'JSONio'
       pathPlacement: 'append'
printLocalHookOutput: [1×0 char]
     requirementHook: ''
           subfolder: [1×0 char]
         toolboxRoot: [1×0 char]
    toolboxSubfolder: ''
                type: 'git'
              update: [1×0 char]
                 url: 'https://github.com/gllmflndn/JSONio'
                path: ''
              status: 0
             message: 'Already on 'main'↵Your branch is up to date with 'origin/main'.'
           operation: 'obtain'
             command: 'cd "/Users/dhb/Documents/MATLAB/toolboxes/JSONio_main" && env -i /usr/bin/git checkout main'
            strategy: [1×1 TbGitStrategy]
                isOk: 1

tbUse('JSONTestIssue') Local copy of ToolboxToolbox is up to date. Updating "ToolboxRegistry". Already up to date. Updating "JSONio_main". From https://github.com/gllmflndn/JSONio

  • branch main -> FETCH_HEAD Already up to date. Resetting path to factory state. Adding "ToolboxToolbox" to path at "/Users/dhb/Documents/MATLAB/ToolboxToolbox". Adding "JSONio_main" to path at "/Users/dhb/Documents/MATLAB/toolboxes/JSONio_main". Checking for "JSONio_main" local hook. Checking for "JSONTestIssue" local hook. Looks good: 1 resolved toolboxes deployed OK.

ans =

struct with fields:

          cdToFolder: ''
               extra: ''
              flavor: 'main'
                hook: [1×0 char]
          importance: ''
                java: ''
   localHookTemplate: ''
                name: 'JSONio'
       pathPlacement: 'append'
printLocalHookOutput: [1×0 char]
     requirementHook: ''
           subfolder: [1×0 char]
         toolboxRoot: [1×0 char]
    toolboxSubfolder: ''
                type: 'git'
              update: [1×0 char]
                 url: 'https://github.com/gllmflndn/JSONio'
                path: ''
              status: 0
             message: 'From https://github.com/gllmflndn/JSONio↵ * branch            main       -> FETCH_HEAD↵Already up to date.'
           operation: 'update'
             command: 'cd "/Users/dhb/Documents/MATLAB/toolboxes/JSONio_main" && env -i /usr/bin/git pull origin main'
            strategy: [1×1 TbGitStrategy]
                isOk: 1
irisgroen commented 3 years ago

Thanks for your quick response -- removing the toolbox and trying again indeed fixed the issue. I'm sorry I didn't think of trying that! Maybe the branch was renamed sometime after I used this git repository for the first time creating some kind of conflict. In any case, solved now.

DavidBrainard commented 3 years ago

Great. I deleted the test .json file from the registry. Note that there is a JSONio.json in the registry already, pointing at the same toolbox (I just noticed). It also appears to work fine, without the flavor field being needed.