Skip to content
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

Cody Ignore: remove the Git extension shim #4115

Merged
merged 5 commits into from May 14, 2024

Conversation

valerybugakov
Copy link
Member

@valerybugakov valerybugakov commented May 9, 2024

Test plan

CI

@valerybugakov valerybugakov self-assigned this May 9, 2024
@valerybugakov valerybugakov force-pushed the vb/git-extension-shim-removal branch from 0d7802f to c99e204 Compare May 10, 2024 08:55
@valerybugakov valerybugakov changed the base branch from main to vb/remove-git-cli-resolver May 10, 2024 08:55
@valerybugakov valerybugakov force-pushed the vb/git-extension-shim-removal branch from c99e204 to 1b9f8b2 Compare May 10, 2024 09:06
@valerybugakov valerybugakov changed the base branch from vb/remove-git-cli-resolver to main May 10, 2024 09:08
@valerybugakov valerybugakov changed the base branch from main to vb/remove-git-cli-resolver May 10, 2024 09:08
Base automatically changed from vb/remove-git-cli-resolver to main May 10, 2024 09:11
@valerybugakov valerybugakov force-pushed the vb/git-extension-shim-removal branch from 76245b7 to 2da8d02 Compare May 10, 2024 09:20
@valerybugakov valerybugakov marked this pull request as ready for review May 13, 2024 02:19
@valerybugakov valerybugakov requested review from dominiccooney, olafurpg and a team May 13, 2024 02:19
@@ -0,0 +1,105 @@
import ini from 'ini'
Copy link
Member Author

Choose a reason for hiding this comment

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

No functional changes. Only moved tree-walk functions in a separate file.

import { gitRemoteUrlsFromTreeWalk } from './remote-urls-from-tree-walk'
import { mockFsCalls } from './test-helpers'

describe('gitRemoteUrlFromTreeWalk', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

No changes. Only moved to a new file.

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

LGTM this seems like a good improvement in the fallback case. I’m still not sold this is a good long term solution. The long term plan with the git extension shim was to implement it with the client. IntelliJ has a git plugin with an API that we should be using for production settings in XXL repos. For example, at Twitter we required engineers to use a fork of git that was auto-configured in everybody’s IntelliJ setup. Given the focus of Cody Ignore is Enterprise customers, then we need to make sure our solutions work even for specialized repo setups.

vscode/src/repository/remote-urls-from-tree-walk.ts Outdated Show resolved Hide resolved
@olafurpg
Copy link
Member

I left a comment in the linked issue, but will repeat here that we should not try to implement our own file watchers. File watching is very difficult to get right in XXL repos and we should rely instead on the IDEs built in file watching APIs.

@olafurpg
Copy link
Member

One option is to keep the existing got extension shim but use the “disabled” option from IntelliJ until we allow the client to implement the necessary parts of the git extension. It might not require a lot of work to pull out the information from IntelliJ, and then we don’t have to revert the removals in this PR.

/**
* Reads the .git directory or file to determine the path to the git config.
*/
async function resolveGitConfigUri(uri: vscode.Uri): Promise<vscode.Uri | undefined> {
Copy link
Member

Choose a reason for hiding this comment

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

I think it's good to have this as a fallback solution when nothing else works (git extension is disabled, client doesn't git, ..) but I think it's a slippery slope to reimplement core features of git. My experience is that big companies end up using advanced git features that we may not be handling here. Also, this doesn't work for non-git systems like Perforce (which we support for several important customers).

We should really lean on using the higher-level version-control APIs that the IDEs provide (IntelliJ's plugin is excellent, and a ton of work has gone into making it scale for even the most difficult repos)

Copy link
Member Author

Choose a reason for hiding this comment

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

One option is to keep the existing got extension shim but use the “disabled” option from IntelliJ until we allow the client to implement the necessary parts of the git extension.

I like it. We can keep only the "disabled" option until the integration is implemented.

We should really lean on using the higher-level version-control APIs that the IDEs provide

Agree with a hight level idea of leaning more towards the IDE provided functionality. We can figure out how to integrate it with the Git extension shim, when the time comes to prioritize it.

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Created a follow-up Agent: allow the client to implement the necessary parts of the git extension #4165.
  2. Reverted the git extension shim removal.
  3. Changed the protocol to git?: 'none' | 'enabled' to the need to refactor other clients.
  4. Added logic to throw errors if the git extension is used in the agent with a linked issue.

@valerybugakov valerybugakov merged commit edff06a into main May 14, 2024
19 of 21 checks passed
@valerybugakov valerybugakov deleted the vb/git-extension-shim-removal branch May 14, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cody Ignore] Fix remote URL resolution for the agent
2 participants