ToolboxHub / ToolboxToolbox

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

git pull results in a long series of inappropriate hints in the command window #112

Closed JWinawer closed 3 years ago

JWinawer commented 3 years ago

These days when I use the tbUse command for github repositories, I get a lot of outputs in the command window like this:

'hint: Pulling without specifying how to reconcile divergent branches is
 hint: discouraged. You can squelch this message by running one of the following
 hint: commands sometime before your next pull:
 hint: 
 hint:   git config pull.rebase false  # merge (the default strategy)
 hint:   git config pull.rebase true   # rebase
 hint:   git config pull.ff only       # fast-forward only
 hint: 
 hint: You can replace "git config" with "git config --global" to set a default
 hint: preference for all repositories. You can also pass --rebase, --no-rebase,
 hint: or --ff-only on the command line to override the configured default per
 hint: invocation.
 Already up to date.
 '

However, I have set my git config correctly. If I simply do a "git pull" in the terminal, I do not get these messages. It seems that the toolboxtoolbox is not finding my git config values. And it seems that the reason for this is that when it finally does the pull command, the command it uses is this:

fullCommand =

'cd "/Users/jaw288/Documents/MATLAB/toolboxes/ToolboxRegistry" && env -i /usr/bin/git pull'

It's the env -i which causes git to ignore my config settings. If the command were simply

'cd "/Users/jaw288/Documents/MATLAB/toolboxes/ToolboxRegistry" && /usr/bin/gi pull'

then it would respect my config settings and not cause these outputs (and also use the correct settings).

DavidBrainard commented 3 years ago

This is a new one for me. Can you tell me a little more about the state of your repos that is triggering the warning messages?

In any case, I think I could pretty easily change the command contingent on a preference which could be set in the startup file. Would that work for you? I'm a little nervous about just doing it by default because it might mess up something someone else is doing. That said, I am not sure why TbTb should be configured to ignore the environment the user has set up.

JWinawer commented 3 years ago

I am not sure it has anything to do with the repos.

For example, if I test the call 'env i git pull' in my ToolboxToolbox directory from the terminal, I get the same output:

(base) jwm:ToolboxToolbox jaw288$ git remote -v
origin  https://github.com/ToolboxHub/ToolboxToolbox.git (fetch)
origin  https://github.com/ToolboxHub/ToolboxToolbox.git (push)
(base) jwm:ToolboxToolbox jaw288$ env -i git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
(base) jwm:ToolboxToolbox jaw288$ 

So I think the issue is with the '-env i' call preceding the git pull, not with the configuration of the repository. There might have been some updates to git itself which triggers this warning. maybe it's my version of git?

It's git version 2.30.1 (Apple Git-130)

Jon

DavidBrainard commented 3 years ago

I don't see that behavior with the version of git on my machine. But my version is a little older.

dhb@n2range-0026 ToolboxToolbox % git --version git version 2.24.3 (Apple Git-128)

I'll poke at this and see if I can update git and reproduce the issue.

JWinawer commented 3 years ago

Apparently, this warning was added in 2.27, ie between yours and mine. https://stackoverflow.com/questions/62653114/how-to-deal-with-this-git-warning-pulling-without-specifying-how-to-reconcile

And by the way, if you want to know why I even brought this up: It's because a call to tbUse can generate many of these messages (depending on the config file), making it very hard to parse the output and figure out if, for example, there was a problem or not with one of the updates.

DavidBrainard commented 3 years ago

I updated to 2.32 (using home-brew, "brew install git" followed by "brew link --force git", followed instructions here: https://stackoverflow.com/questions/8957862/how-to-upgrade-git-to-latest-version-on-macos), and do not get the behavior above. Maybe they took the warning back out again? Can you got to 2.32 and see if you still have the problem?

Last login: Thu Jul 22 11:41:22 on ttys002 dhb@n2range-0026 ~ % which git /usr/local/bin/git dhb@n2range-0026 ~ % git --version git version 2.32.0 dhb@n2range-0026 ~ % cd ~/Documents/MATLAB/ToolboxToolbox dhb@n2range-0026 ToolboxToolbox % git pull Already up to date. dhb@n2range-0026 ToolboxToolbox % env -i git pull Already up to date. dhb@n2range-0026 ToolboxToolbox %

JWinawer commented 3 years ago

I updated and did the same as you but get the same long output warnings as I got before. This happened on two computers.

(base) jwm:~ jaw288$ git --version

git version 2.32.0

(base) jwm:~ jaw288$ cd ~/Documents/MATLAB/ToolboxToolbox/

(base) jwm:ToolboxToolbox jaw288$ env -i git pull

hint: Pulling without specifying how to reconcile divergent branches is

hint: discouraged. You can squelch this message by running one of the following

hint: commands sometime before your next pull:

hint:

hint: git config pull.rebase false # merge (the default strategy)

hint: git config pull.rebase true # rebase

hint: git config pull.ff only # fast-forward only

hint:

hint: You can replace "git config" with "git config --global" to set a default

hint: preference for all repositories. You can also pass --rebase, --no-rebase,

hint: or --ff-only on the command line to override the configured default per

hint: invocation.

Already up to date.

(base) jwm:ToolboxToolbox jaw288$

However, I can make the hints go away by running this command

git config pull.rebase false

But I have to run it separately in each toolbox. Perhaps, though (and this is just a guess), now that I set the global parameter to be false, with

git config --global pull.rebase false

new toolboxes in the future will have the right default?

Anyway, in the meantime I can suppress the output one toolbox at a time.

On Thu, Jul 22, 2021 at 12:09 PM David Brainard @.***> wrote:

I updated to 2.32 (using home-brew, "brew install git" followed by "brew link --force git", followed instructions here: https://stackoverflow.com/questions/8957862/how-to-upgrade-git-to-latest-version-on-macos https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_8957862_how-2Dto-2Dupgrade-2Dgit-2Dto-2Dlatest-2Dversion-2Don-2Dmacos&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=W4u2U_DhoNoJOD0UdsYQiqH56Bg3zFfOtNa0RCuuEIs&m=0kA8TURnIQKVolhLRPA-9AtpyWLv4kQIkp4Gbv7OoJI&s=K_tgVOS9CcH0w74QrqQxvFJF4k9LqDCdcfJHPcIQuBU&e=), and do not get the behavior above. Maybe they took the warning back out again? Can you got to 2.32 and see if you still have the problem?

Last login: Thu Jul 22 11:41:22 on ttys002 @. ~ % which git /usr/local/bin/git @. ~ % git --version git version 2.32.0 @. ~ % cd ~/Documents/MATLAB/ToolboxToolbox @. ToolboxToolbox % git pull Already up to date. @. ToolboxToolbox % env -i git pull Already up to date. @. ToolboxToolbox %

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ToolboxHub_ToolboxToolbox_issues_112-23issuecomment-2D885035121&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=W4u2U_DhoNoJOD0UdsYQiqH56Bg3zFfOtNa0RCuuEIs&m=0kA8TURnIQKVolhLRPA-9AtpyWLv4kQIkp4Gbv7OoJI&s=7X0T0hpkq2_SCIIcgBuo-7W3-slaKfgwsDUMeEkzmYk&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAQFPXTEI5SLJ5S7OLQO3OTTZA7DFANCNFSM5A2EQEGA&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=W4u2U_DhoNoJOD0UdsYQiqH56Bg3zFfOtNa0RCuuEIs&m=0kA8TURnIQKVolhLRPA-9AtpyWLv4kQIkp4Gbv7OoJI&s=eRgJ0MACfHsoxy7x-1R_BpN_t0sRp_pMTc0-MUlYTNM&e= .

-- Jonathan Winawer Associate Professor of Psychology and Neural Science

New York University 6 Washington Place New York, NY, 10003 (212) 998-7922 (phone) (212) 995-4018 (fax) @.*** http://psych.nyu.edu/winawer/

DavidBrainard commented 3 years ago

Check out the NoEnv branch of ToolboxToolbox and add these two lines to startup.m:

noIngoreEnv = true; setpref('ToolboxToolbox', 'noIgnoreEnv', noIngoreEnv);

With these, ToolboxToolbox should run git commands without the 'env -I' prefix.

Let me know how it goes. I tested a little but not extensively. If this works for you I'll run a few more tests and then merge into the master branch.

JWinawer commented 3 years ago

Ues, it appears resolved. Thanks!

On Mon, Jul 26, 2021 at 4:03 PM David Brainard @.***> wrote:

Check out the NoEnv branch of ToolboxToolbox and add these two lines to startup.m:

noIngoreEnv = true; setpref('ToolboxToolbox', 'noIgnoreEnv', noIngoreEnv);

With these, ToolboxToolbox should run git commands without the 'env -I' prefix.

Let me know how it goes. I tested a little but not extensively. If this works for you I'll run a few more tests and then merge into the master branch.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ToolboxHub_ToolboxToolbox_issues_112-23issuecomment-2D886987938&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=W4u2U_DhoNoJOD0UdsYQiqH56Bg3zFfOtNa0RCuuEIs&m=6vFVDnKnKCVHQHUC1r3FybyercpIiiq_zp2wA9oF6AE&s=q_jsroGltkOn2OzuwGtWrALADt39nHEneFJQf1hX9SM&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAQFPXSDWDMENY43U4PTVQLTZW5QPANCNFSM5A2EQEGA&d=DwMCaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=W4u2U_DhoNoJOD0UdsYQiqH56Bg3zFfOtNa0RCuuEIs&m=6vFVDnKnKCVHQHUC1r3FybyercpIiiq_zp2wA9oF6AE&s=8HY_1CVENDj-LPlTsu0JvHcDMyEKO_PhrBK3B6cZKQw&e= .

-- Jonathan Winawer Associate Professor of Psychology and Neural Science

New York University 6 Washington Place New York, NY, 10003 (212) 998-7922 (phone) (212) 995-4018 (fax) @.*** http://psych.nyu.edu/winawer/

DavidBrainard commented 3 years ago

All the unit tests pass with and without the ignore pref set, so I have merged this into the master branch.