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

git: Avoid resetting Git index when trees are identical #3767

Merged
merged 1 commit into from
May 29, 2024

Conversation

mlcui-corp
Copy link
Collaborator

This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents.

See #3748 for previous work on avoiding resetting HEAD when the commits are identical.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@mlcui-corp mlcui-corp requested a review from yuja May 27, 2024 06:57
lib/src/git.rs Show resolved Hide resolved
lib/src/git.rs Show resolved Hide resolved
mlcui-corp added a commit to mlcui-corp/jj that referenced this pull request May 28, 2024
This shares some common code to both the root and the non-root case, and
provides easier access to `mut_repo` in the function - as
`set_git_head_target` mutably borrows `mut_repo`.

This will be used for a cleaner implementation of jj-vcs#3767.
mlcui-corp added a commit to mlcui-corp/jj that referenced this pull request May 28, 2024
This shares some common code to both the root and the non-root case, and
provides easier access to `mut_repo` in the function - as
`set_git_head_target` mutably borrows `mut_repo`.

This will be used for a cleaner implementation of jj-vcs#3767.
@mlcui-corp mlcui-corp force-pushed the push-tmmpsusnvoku branch from aea276b to d799707 Compare May 28, 2024 05:25
@mlcui-corp mlcui-corp changed the title git: Avoid resetting HEAD when trees are identical @mlcui-corp git: Avoid resetting Git index when trees are identical May 28, 2024
@mlcui-corp mlcui-corp changed the title @mlcui-corp git: Avoid resetting Git index when trees are identical git: Avoid resetting Git index when trees are identical May 28, 2024
@mlcui-corp
Copy link
Collaborator Author

DO NOT SUBMIT until #3774 is merged.

@mlcui-corp mlcui-corp force-pushed the push-tmmpsusnvoku branch from d799707 to 3149f83 Compare May 29, 2024 05:35
mlcui-corp added a commit that referenced this pull request May 29, 2024
This shares some common code to both the root and the non-root case, and
provides easier access to `mut_repo` in the function - as
`set_git_head_target` mutably borrows `mut_repo`.

This will be used for a cleaner implementation of #3767.
This accounts for commit message-only changes which do not change the
tree ID, as well as checkouts between commits with identical tree
contents.

See jj-vcs#3748 for previous work on avoiding resetting HEAD when the
*commits* are identical.
@mlcui-corp mlcui-corp force-pushed the push-tmmpsusnvoku branch from 3149f83 to ec3d391 Compare May 29, 2024 05:48
@mlcui-corp
Copy link
Collaborator Author

Please take another look, thanks! This should be much cleaner now.

@mlcui-corp mlcui-corp requested a review from yuja May 29, 2024 05:50
@mlcui-corp mlcui-corp merged commit 4c03506 into jj-vcs:main May 29, 2024
16 checks passed
@mlcui-corp mlcui-corp deleted the push-tmmpsusnvoku branch July 1, 2024 03:18
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