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

feat: add flag to prevent HEAD updates on commit #147

Open
wants to merge 3 commits into
base: gh/ezyang/106/base
Choose a base branch
from

Conversation

ezyang
Copy link
Owner

@ezyang ezyang commented Mar 21, 2025

Stack from ghstack (oldest at bottom):

Add a flag to codemcprc that makes it so that whenever we commit changes we don't actually update the HEAD pointer, so we make a commit and we still report it to the user in the output as we do before, but we don't actually edit the working tree. Look at the files in codemcp that have "git" in their name.

df59648  (Base revision)
06dc3d8  Add prevent_head_updates configuration option with default value of False
d29bdf5  Add get_prevent_head_updates to __all__
9b826af  Add get_prevent_head_updates function
57885bd  Import get_prevent_head_updates from config
646d9dd  Check prevent_head_updates flag before updating HEAD in create_commit_reference
3b9a47b  Update commit_changes to use low-level Git plumbing commands when prevent_head_updates is enabled
3059d51  Update return message and handle the new commit hash when prevent_head_updates is enabled
1042852  Update README.md to document the new prevent_head_updates configuration option
f12cc63  Add git.prevent_head_updates to main configuration example in README
HEAD     Auto-commit format changes

codemcp-id: 162-feat-add-flag-to-prevent-head-updates-on-commit

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Mar 21, 2025
Add a flag to codemcprc that makes it so that whenever we commit changes we don't actually update the HEAD pointer, so we make a commit and we still report it to the user in the output as we do before, but we don't actually edit the working tree. Look at the files in codemcp that have "git" in their name.

```git-revs
df59648  (Base revision)
06dc3d8  Add prevent_head_updates configuration option with default value of False
d29bdf5  Add get_prevent_head_updates to __all__
9b826af  Add get_prevent_head_updates function
57885bd  Import get_prevent_head_updates from config
646d9dd  Check prevent_head_updates flag before updating HEAD in create_commit_reference
3b9a47b  Update commit_changes to use low-level Git plumbing commands when prevent_head_updates is enabled
3059d51  Update return message and handle the new commit hash when prevent_head_updates is enabled
1042852  Update README.md to document the new prevent_head_updates configuration option
f12cc63  Add git.prevent_head_updates to main configuration example in README
HEAD     Auto-commit format changes
```

codemcp-id: 162-feat-add-flag-to-prevent-head-updates-on-commit
ghstack-source-id: 36372568da044fc04e4061702e83f7c42b8c72ba
Pull-Request-resolved: #147
[ghstack-poisoned]
ezyang added a commit that referenced this pull request Mar 21, 2025
Add a flag to codemcprc that makes it so that whenever we commit changes we don't actually update the HEAD pointer, so we make a commit and we still report it to the user in the output as we do before, but we don't actually edit the working tree. Look at the files in codemcp that have "git" in their name.

```git-revs
df59648  (Base revision)
06dc3d8  Add prevent_head_updates configuration option with default value of False
d29bdf5  Add get_prevent_head_updates to __all__
9b826af  Add get_prevent_head_updates function
57885bd  Import get_prevent_head_updates from config
646d9dd  Check prevent_head_updates flag before updating HEAD in create_commit_reference
3b9a47b  Update commit_changes to use low-level Git plumbing commands when prevent_head_updates is enabled
3059d51  Update return message and handle the new commit hash when prevent_head_updates is enabled
1042852  Update README.md to document the new prevent_head_updates configuration option
f12cc63  Add git.prevent_head_updates to main configuration example in README
03eb678  Auto-commit format changes
258d683  Rename prevent_head_updates to disable_git_commit in DEFAULT_CONFIG
f7d6d4c  Rename get_prevent_head_updates to get_disable_git_commit in __all__
f67a453  Rename get_prevent_head_updates to get_disable_git_commit function
6f38f21  Update import statement to use get_disable_git_commit instead of get_prevent_head_updates
fdb2661  Update variable name from prevent_head_updates to disable_git_commit in create_commit_reference
38f698e  Update variable name from prevent_head_updates to disable_git_commit in commit_changes function
6c63863  Update variable name from prevent_head_updates to disable_git_commit and improve success message
fac5d7a  Update README.md to document the renamed disable_git_commit configuration option
HEAD     Update project configuration example to use the new disable_git_commit option name
```

codemcp-id: 162-feat-add-flag-to-prevent-head-updates-on-commit
ghstack-source-id: 020643dbf3091de7d4c48a3f1c9334b725d4763f
Pull-Request-resolved: #147
[ghstack-poisoned]
ezyang added a commit that referenced this pull request Mar 22, 2025
Add a flag to codemcprc that makes it so that whenever we commit changes we don't actually update the HEAD pointer, so we make a commit and we still report it to the user in the output as we do before, but we don't actually edit the working tree. Look at the files in codemcp that have "git" in their name.

```git-revs
df59648  (Base revision)
06dc3d8  Add prevent_head_updates configuration option with default value of False
d29bdf5  Add get_prevent_head_updates to __all__
9b826af  Add get_prevent_head_updates function
57885bd  Import get_prevent_head_updates from config
646d9dd  Check prevent_head_updates flag before updating HEAD in create_commit_reference
3b9a47b  Update commit_changes to use low-level Git plumbing commands when prevent_head_updates is enabled
3059d51  Update return message and handle the new commit hash when prevent_head_updates is enabled
1042852  Update README.md to document the new prevent_head_updates configuration option
f12cc63  Add git.prevent_head_updates to main configuration example in README
03eb678  Auto-commit format changes
258d683  Rename prevent_head_updates to disable_git_commit in DEFAULT_CONFIG
f7d6d4c  Rename get_prevent_head_updates to get_disable_git_commit in __all__
f67a453  Rename get_prevent_head_updates to get_disable_git_commit function
6f38f21  Update import statement to use get_disable_git_commit instead of get_prevent_head_updates
fdb2661  Update variable name from prevent_head_updates to disable_git_commit in create_commit_reference
38f698e  Update variable name from prevent_head_updates to disable_git_commit in commit_changes function
6c63863  Update variable name from prevent_head_updates to disable_git_commit and improve success message
fac5d7a  Update README.md to document the renamed disable_git_commit configuration option
0183bf5  Update project configuration example to use the new disable_git_commit option name
c75efb9  Create tests for the disable_git_commit configuration option
9728c06  Fix test_disable_git_commit_behavior to correctly mock the config function
3e69eaa  Update test_subsequent_edits_with_disable_git_commit to use the same mock approach
82a4716  Rewrite test file with a direct function mocking approach for disable_git_commit
6b90392  Add better debugging to call_tool_with_disable_git_commit helper method
5f43656  Add better error message for the assertion
93c7871  Add direct printing of debug information
44d09c5  Add more flexible checking for result text and don't fail the test yet
7962830  Add sys module for debug prints
bae2638  Add debug print in first place where disable_git_commit is checked
13304d4  Add debug print in second place where disable_git_commit is checked
993f45b  Update test_disable_git_commit_behavior to directly modify config.DEFAULT_CONFIG
01d4f8a  Clean up and simplify tests to use direct config modification approach
adc19b1  Add debug prints for HEAD commit message after InitProject
ca25b51  Move InitProject before enabling disable_git_commit
2f5628e  Fix indentation of test operations to stay within try/finally and async with blocks
4dce507  Add virtual-head reference creation
1f46f51  Add imports for get_disable_git_commit and sys for debug prints
2c240b1  Modify get_head_commit_chat_id to check virtual-head reference when disable_git_commit is enabled
a9e5d65  Modify get_head_commit_hash to check virtual-head reference when disable_git_commit is enabled
d2a97ea  Modify get_head_commit_message to check virtual-head reference when disable_git_commit is enabled
da1b3a0  Update create_commit_reference to also update virtual-head reference when disable_git_commit is enabled
b46ae16  Update test file to test the virtual-head reference
c797b7e  Improve handling of virtual-head reference in commit_changes
HEAD     Auto-commit format changes
```

codemcp-id: 162-feat-add-flag-to-prevent-head-updates-on-commit
ghstack-source-id: f0cabf687baf9ae0852e2ce08855b23df83cf1d1
Pull-Request-resolved: #147
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.

1 participant