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_backend: write trees involved in conflict in git commit header #3265

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

martinvonz
Copy link
Member

We haven't used custom Git commit headers for two main reasons:

  1. I don't want commits created by jj to be different from any other commits. I don't want Git projects to get annoyed by such commit and reject them.

  2. I've been concerned that tools don't know how to handle such headers, perhaps even resulting in crashes.

The first argument doesn't apply to commits with conflicts because such commits would never be accepted by a project whether or not they use custom commit headers. The second argument is less relevant for conflicted commits because most tools will be confused by such commits anyway.

Storing conflict information in commit headers means that we can transfer them via the regular Git wire protocol. We already include the tree objects nested inside the root-level tree, so they will also be transferred.

So, let's start by writing the information redundantly to the commit header and to the existing storage. That way we can roll it back if we realize there's a problem with using commit headers.

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

lib/src/git_backend.rs Outdated Show resolved Hide resolved
lib/src/git_backend.rs Show resolved Hide resolved
lib/src/git_backend.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

thanks.

lib/src/git_backend.rs Outdated Show resolved Hide resolved
We haven't used custom Git commit headers for two main reasons:

1. I don't want commits created by jj to be different from any other
   commits. I don't want Git projects to get annoyed by such commit
   and reject them.

2. I've been concerned that tools don't know how to handle such
   headers, perhaps even resulting in crashes.

The first argument doesn't apply to commits with conflicts because
such commits would never be accepted by a project whether or not they
use custom commit headers. The second argument is less relevant for
conflicted commits because most tools will be confused by such commits
anyway.

Storing conflict information in commit headers means that we can
transfer them via the regular Git wire protocol. We already include
the tree objects nested inside the root-level tree, so they will also
be transferred.

So, let's start by writing the information redundantly to the commit
header and to the existing storage. That way we can roll it back if we
realize there's a problem with using commit headers.
@martinvonz martinvonz enabled auto-merge (rebase) March 11, 2024 03:43
@martinvonz martinvonz merged commit 4d42604 into main Mar 11, 2024
16 checks passed
@martinvonz martinvonz deleted the push-tpvsyoltmnlq branch March 11, 2024 03:51
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