Skip to content

Improved submodule support - #15176

Merged
sergiou87 merged 24 commits into
developmentfrom
submodule-interstitial-poc
Aug 31, 2022
Merged

sergiou87 merged 24 commits into
developmentfrom
submodule-interstitial-poc

Conversation

@sergiou87

Copy link
Copy Markdown
Member

Description

This PR improves submodule support on GitHub Desktop by making sure it renders something useful to users instead of the Subproject commit a901a6a0d95895e34c031c7ae8d3ab6d345a67fd.

Screenshots

submodule-changes-with-interstitial.mov

In the video you can see:

  1. A new submodule with non-committed changes (desktop-notifications): you can partially select it because you can commit its addition to the repo, but not the non-committed changes within it
  2. An existing submodule that has both a change in the commit it points to, and non-committed changes within it (desktop-trampoline): you can partially select it because you can commit the change in the commit it points to, but not the nont-committed changes within it
  3. An existing submodule that only has a change in the commit it points to (sp-ios-tools): can be selected and committed normally
  4. An existing submodule that only has non-committed changes within it (test-repo): it can’t be selected at all because it only has non-committed changes 😢

For 1, 2 and 4, you will get a tooltip if you hover over the checkbox, explaining why selection is either disabled or partial

Release notes

Notes: [Improved] Improve submodule support

@sergiou87
sergiou87 marked this pull request as ready for review August 29, 2022 16:35
Comment thread app/src/ui/changes/changes-list.tsx Outdated

const disableSelection = isCommitting || rebaseConflictState !== null
const checkboxTooltip = isUncommittableSubmodule
? 'This submodule cannot be checked in because it contains changes have not been committed.'

@tidy-dev tidy-dev Aug 31, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
? 'This submodule cannot be checked in because it contains changes have not been committed.'
? 'This submodule cannot be checked in because it contains changes that have not been committed.'

Other thoughts are is the terminology "checked in" ideal - can't articulate what it is but it feels off to me - maybe it it is because in the UI we just use the word commit? Maybe this should be "This submodule change cannot be added to a commit in this repository, because..." or "This submodule change cannot be committed, because..."

Similarly for next tooltip, "Only changes that have been committed within the submodule will be added to this repository" or "committed to this repository"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I used checked in in an attempt to differentiate the actions in the main repo vs the actions in the submodule repo. I think "This submodule change cannot be added to a commit in this repository, because…" should be clear enough 🤔 Thanks for your suggestions!!

readonly shortSHA: string | JSX.Element

/** Long SHA to display within the tooltip. */
readonly longSHA: string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a thought since this is a formatting component -> feel free to ignore. We could pass in just longSHA: string | Commit. If is a string, we shorten it here using shortenSha method and if it is a commit we use commit.shortSha and commit.sha.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Or make longSHA? and commit? properties and use the defined one :D)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Well, the problem is the short SHA is either a string or a JSX.Element, if you need something custom (like we do in the submodule interstitial to use a Ref component to wrap the SHA).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That could be done either as another component extending this or as boolean asRef and still keep all the formatting to his component or components.

@tidy-dev tidy-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✨ Tested it out (on my mac) and everything worked as expected. Thanks for the tooltip changes and adding the feature flag.

(Feel free to ignore the tool tip commit sha component suggestions)

}

private renderSubmoduleInfo() {
// TODO: only for GH submodules?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just remembered - I meant to ask if this is needed - does it work just fine for non GH submodules?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I only tested this with GH and bitbucket repos and it worked fine, but maybe it doesn't with other hosting services? 🤔

@sergiou87

Copy link
Copy Markdown
Member Author

Thanks for the quick review! I'll explore the tooltipped component suggestion in another PR, and also submit some unit tests for the new submodule status stuff.

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.

2 participants