Skip to content

Conversation

mstv
Copy link
Member

@mstv mstv commented Jan 16, 2025

Fixes #10845

Proposed changes

  • WindowsJumpListManager / RepositoryDescriptionProvider: Use unique name for recent repos
    descriptive name with full path appended

Screenshots

Before

image

with

repo.gitext containing
D:\Downloads\super\submodule2\repo\
or
D:\Downloads\super\submodule1\repo\

After

image image

with .git/description containing:

  • "super_repo"
  • "sm1_repo"
  • "sm2_repo"

Test methodology

  • manual

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.

@mstv mstv self-assigned this Jan 16, 2025
Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

I see the current handling as a feature, it limits the number of submodules in the jumplist. Half the list will now be like "ICSharp" for me. But maybe better for others.

@@ -65,6 +77,34 @@ public string Get(string repositoryDir)
return dirInfo.Name;
}

public string GetDescriptiveUnique(string repositoryDir)
{
string unique = GetUnique(repositoryDir);
Copy link
Member

Choose a reason for hiding this comment

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

I mostly have unique names of my superrepos, with the worktree name (often short like ge_1, ge_2 etc). This is mostly kept here, just with a suffix (I guess I get used to that).

If a supermodule has a description, it should be used for the unique part.

If no description, then the important part is often deeper in the path, I see many that keep structures like gitclones/project1, gitclones/project2. This will then keep the unique part just visible in the tooltip so the main benefit is just being unique.

Copy link
Member

Choose a reason for hiding this comment

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

OK, except the name for submodules. Will use some before approving.

Copy link
Member Author

Choose a reason for hiding this comment

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

so the main benefit is just being unique.

That is what this PR is about.

If a supermodule has a description, it should be used for the unique part.

This should be applied to RepositoryDescriptionProvider.Get and not only if there is a description file. Then the application title would benefit from this, too.
I think of "submodule - parentmodule (branch) - Git Extensions".
In the Jump List it would appear as "submodule - parentmodule (D_path_to_parent_subfolder_submodule)".
I would add just one level of super module.

Or else:

Half the list will now be like "ICSharp" for me.

Perhaps we should add submodules to the GE-internal MRU list only, but not to the Jump List.

Copy link
Member

Choose a reason for hiding this comment

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

so the main benefit is just being unique.

That is what this PR is about.

There are many unique "ICSharp" that cannot be differentiated in a simple way as the diff is far right.
Just one "ICSharp" is more a feature for me than in general, not objecting.

If a supermodule has a description, it should be used for the unique part.

This should be applied to RepositoryDescriptionProvider.Get and not only if there is a description file. Then the application title would benefit from this, too. I think of "submodule - parentmodule (branch) - Git Extensions". In the Jump List it would appear as "submodule - parentmodule (D_path_to_parent_subfolder_submodule)". I would add just one level of super module.

Yes, that seem fine.
Supermodule instead of parent? (all levels will be too much)
It will not handle (slightly worse even) the the multiple clones, you cannot get it all.

Half the list will now be like "ICSharp" for me.

Perhaps we should add submodules to the GE-internal MRU list only, but not to the Jump List.

Exclude from both if implemented.
I have considered this for some years, but seen it as a setting that would be for primarily myself.

Copy link
Member

Choose a reason for hiding this comment

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

I have considered this for some years, but seen it as a setting that would be for primarily myself.

Interested by that also : I've started to implement it long ago but there are some edge cases on currently opened submodule repo a little hacky to fix 🫤

Copy link
Member

@gerhardol gerhardol left a comment

Choose a reason for hiding this comment

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

comment
I like the text as in the title that was just added, mostly descriptive and could be used in addition to this detailed text.
If the path could be seen in the tooltip as for VS Code would be even better but then the .gitext file have to moved.

return shortName.Length == 0 ? unique : $"{shortName} ({unique})";
}

public string GetUnique(string repositoryDir)
Copy link
Member

Choose a reason for hiding this comment

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

Why this as public?

Copy link
Member Author

Choose a reason for hiding this comment

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

for future use (I have nothing in mind)

Copy link
Member

Choose a reason for hiding this comment

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

suggest to remove from public api

@@ -107,6 +107,7 @@ public void AddToRecent(string workingDir)

// sanitise
StringBuilder sb = new(repositoryDescription);
sb.Replace(@":\", "_");
Copy link
Member

Choose a reason for hiding this comment

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

discussion:
It would be nize to have / instead of _ in the name, but this is a filename
Similar, I would like to replace \wsl$ with /wsl or so but very minor diff anyway

return shortName.Length == 0 ? unique : $"{shortName} ({unique})";
}

public string GetUnique(string repositoryDir)
Copy link
Member

Choose a reason for hiding this comment

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

suggest to remove from public api

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.

👍

@mstv mstv merged commit daaf127 into gitextensions:master Feb 20, 2025
3 of 4 checks passed
@mstv mstv deleted the fix/recent_repos branch February 20, 2025 20:51
@mstv mstv added this to the v5.3 milestone Feb 20, 2025
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.

Don't overwrite recent repositories (%appdata%\...\Recent\.gitext) with the same name
4 participants