-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Form Rebase: Add rebase dependent branches --update-refs
rebase option
#11335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
FYI, this form would need some redesign to make some room to rebase options. |
/cc @quinmars you could test it and give feedback. |
GitCommands/Git/GitModule.cs
Outdated
return EffectiveConfigFile.GetValue(setting); | ||
} | ||
public string GetEffectiveSetting(string setting) => EffectiveConfigFile.GetValue(setting); | ||
public bool IsEffectiveSettingEnabled(string setting) => EffectiveConfigFile.IsEnabled(setting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public bool IsEffectiveSettingEnabled(string setting) => EffectiveConfigFile.IsEnabled(setting); | |
public bool? GetEffectiveBoolSetting(string setting) => EffectiveConfigFile.GetBool(setting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like us to consider an opportunity to generalise and have something like:
public T GetEffectiveSetting<T>(string settingName)
{
...
}
public T GetSetting<T>(string settingName)
{
...
}
GitUI/Translation/English.xlf
Outdated
@@ -5993,6 +5993,10 @@ Nothing to rebase.</source> | |||
</source> | |||
<target /> | |||
</trans-unit> | |||
<trans-unit id="checkBoxUpdateRefs.Text"> | |||
<source>Update dependent refs</source> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add mnemonic?
@@ -2968,7 +2968,7 @@ private void LaunchRebase(string command) | |||
|
|||
string rebaseCmd = Commands.Rebase( | |||
GetActualRevision(LatestSelectedRevision)?.FirstParentId?.ToString(), interactive: true, preserveMerges: false, | |||
autosquash: false, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: false, supportRebaseMerges: Module.GitVersion.SupportRebaseMerges); | |||
autosquash: false, autoStash: true, ignoreDate: false, committerDateIsAuthorDate: false, supportRebaseMerges: Module.GitVersion.SupportRebaseMerges, updateRefs: false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it the default argument value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please create a struct that contains all the parameters instead? Not only it'd be more maintainable; there's a threshold on a number of parameters (I don't know it by heart) after which every new parameter becomes an overhead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RussKie Not sure that I agree with this point of view (even if I understand that there are a lot of params due to the number of options of the git rebase command) because:
- it's consistent with all the methods of the
Commands
class. I would say it's even the goal of this class to use this pattern where you have a param for each command option. - create a struct/record will have the same problem where you initialize a lot of values. You just add a level of indirection
- it's acceptable because the command is used only 3 times and I don't it will increase in the future and that's not a call that we modify often. I think we can live with that.
@RussKie I don't really get what you means by overhead.
Is it a performance one? In this case it is not a problem because it is called once and waiting for human interaction.
Or cognitive one? If that's the case, we say that the limit is around 7 +/-2. But as it is a simple mapping, with a very simple logic and without interaction between the parameters, the code logic is very easy to understand and a much bigger number is acceptable.
@pmiossec, I have tested it an it works like a charme, thank you. I have a small suggestion. When I set |
@quinmars |
1f0bd23
to
6703b46
Compare
6703b46
to
2303cb0
Compare
Except the request on change on parameters number of Point of view? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better
catch (Exception ex) | ||
{ | ||
Debug.WriteLine($"Setting '{setting}': fail to convert value '{value}' into type '{targetType}'. Error: {ex}"); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return null; | |
return default(T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why handle the exception at all?
If we try to get a setting using a wrong type, it is a bug or an invalid manipulation of the settings file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was at least for when the setting was not set. But indeed it is better to handle it before. Done.
GitUI/CommandsDialogs/SettingsDialog/Pages/GitConfigAdvancedSettingsPage.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better
82769a8
to
15230e4
Compare
catch (Exception ex) | ||
{ | ||
Debug.WriteLine($"Setting '{setting}': fail to convert value '{value}' into type '{targetType}'. Error: {ex}"); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why handle the exception at all?
If we try to get a setting using a wrong type, it is a bug or an invalid manipulation of the settings file
I'd like for this to go behind #11269. |
15230e4
to
0653ca6
Compare
2365fc1
to
57b5e2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using n earlier version of this PR for some time. Very useful - you just have to remember to remove the update-ref when rebasing temp branches.
Implementation is fine for me. Compare the handling to #11369 (for Git settings).
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few nits in addition to Igor's comments
439018b
to
25e2385
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few small outstanding items. Other than that 👍
catch (Exception ex) | ||
{ | ||
Debug.WriteLine($"Setting '{setting}': fail to convert value '{value}' into type '{targetType}'. Error: {ex}"); | ||
throw new GitConfigFormatException($"Setting '{setting}': fail to convert value '{value}' into type '{targetType}'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gentle ping
/// <summary> | ||
/// Get the config setting from git converted in an expected C# value type (bool, int, ...) | ||
/// </summary> | ||
/// <typeparam name="T">the expected type of the git setting.</typeparam> | ||
/// <param name="setting">the git setting key</param> | ||
/// <returns> | ||
/// null if the settings is not set | ||
/// the value converted in the <typeparamref name="T" /> type otherwise. | ||
/// </returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gentle ping
25e2385
to
15f4c1e
Compare
c565b3a
to
ee5ea8b
Compare
@@ -156,8 +156,31 @@ public interface IGitModule | |||
Task<IReadOnlyList<Remote>> GetRemotesAsync(); | |||
|
|||
string GetSetting(string setting); | |||
|
|||
#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move GitConfigFormatException
to Plugins/GitUIPluginInterfaces
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call - we can't have the upstream dependency refer to downstream implementations.
Did I ever mention that building public API is extremely hard? 🤣 |
https://github.blog/2022-10-03-highlights-from-git-2-38/#rebase-dependent-branches-with-update-refs and depending on user "rebase.updateRefs" setting, let the user unselect it (that will happen "--no-update-refs" to the arguments) Fixes gitextensions#11333
223c4bd
to
4fe3ff9
Compare
Thank you! |
Fixes #11333
doc: https://github.blog/2022-10-03-highlights-from-git-2-38/#rebase-dependent-branches-with-update-refs
Linked to what have already been done with #10289
Screenshots
Before
(normal rebase form)
After
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer Rebase merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.