Skip to content

Conversation

pmiossec
Copy link
Member

and hide the tab

Fixes #11388

Screenshots

Before

Crash

After

We don't see the tab anymore:
image

Test methodology

  • Manual

Test environment(s)

  • Git Extensions 33.33.33
  • Build 6dd05e51f3540f6d9d0ee2c8b12e780230c8c1c6 (Dirty)
  • Git 2.42.0.windows.2
  • Microsoft Windows NT 10.0.22621.0
  • .NET 6.0.25
  • DPI 96dpi (no scaling)
  • Portable: False

Merge strategy

I agree that the maintainer squash merge this PR (if the commit message is clear).


✒️ I contribute this code under The Developer Certificate of Origin.

Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

bool showGpgInfoTab = revision?.IsArtificial != true && AppSettings.ShowGpgInformation.Value;

if (showGpgInfoTab)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please invert

@@ -1263,6 +1263,24 @@ private void FillCommitInfo(GitRevision? revision)

private async Task FillGpgInfoAsync(GitRevision? revision)
{
// Don't show the "GPG" tab for artificial commits
bool showGpgInfoTab = revision?.IsArtificial != true && AppSettings.ShowGpgInformation.Value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool showGpgInfoTab = revision?.IsArtificial != true && AppSettings.ShowGpgInformation.Value;
bool showGpgInfoTab = revision?.IsArtificial is false && AppSettings.ShowGpgInformation.Value;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about null?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what is false means. null is not false, i.e. do not show the tab if we do not have a real revision.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unconvinced. These two expressions aren't equivalent:
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we are discussing about the logic but more on the business which is: does it make sense to display the tab when the there is no revision selected (i.e. empty repo)? I think that's not really important....

It has been decided to show the "File tree" in this case (code I borrowed) but as @mstv says, maybe it's better to not show the GPG tab in this case. Or you prefer @RussKie?

I tend to share @mstv point of view so I will change for "is false".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== and is are equivalent - as it should be.
If it does not work here, add parens.

image

            sb.AppendLine("\tnull\tfalse\ttrue");
            foreach (bool? value in new bool?[] { null, false, true })
            {
                sb.AppendLine($"{value?.ToString() ?? "null"} is\t{value is null}\t{value is false}\t{value is true}")
                  .AppendLine($"{value?.ToString() ?? "null"} ==\t{value == null}\t{value == false}\t{value == true}")
                  .AppendLine($"{value?.ToString() ?? "null"} is !\t{value is not null}\t{value is not false}\t{value is not true}")
                  .AppendLine($"{value?.ToString() ?? "null"} !=\t{value != null}\t{value != false}\t{value != true}");
            }

            MessageBox.Show(sb.ToString());

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we have had this discussion before...

Just to clarify:

revision?.IsArtificial is false is equivalent to revision is not null && revision?.IsArtificial == false

== and is are equivalent - as it should be.

...unless you override the operator ==...

@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Nov 25, 2023
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Nov 25, 2023
@pmiossec pmiossec force-pushed the fix_gpg_artificials branch from 0572667 to 5ac8966 Compare November 25, 2023 10:37
@RussKie RussKie merged commit 0fc9a06 into gitextensions:release/4.0 Nov 26, 2023
@RussKie RussKie linked an issue Nov 26, 2023 that may be closed by this pull request
@RussKie RussKie added this to the 4.2.1 milestone Nov 26, 2023
mstv pushed a commit to mstv/gitextensions that referenced this pull request Nov 26, 2023
@pmiossec pmiossec deleted the fix_gpg_artificials branch November 27, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NBug] fatal: bad object 2222222222222222222222222222222222222222
4 participants