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

Don't detatch Git HEAD when advance-branches is enabled for a branch #3405

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Mar 31, 2024

  1. Implement advance-branches for jj commit

    ## Feature Description
    
    If enabled in the user or repository settings, the local branches pointing to the
    parents of the revision targeted by `jj commit` will be advanced to the newly
    created commit. Support for `jj new` will be added in a future change.
    
    This behavior can be enabled by default for all branches by setting
    the following in the config.toml:
    
    ```
    [experimental-advance-branches]
    enabled-branches = ["glob:*"]
    ```
    
    Specific branches can also be disabled:
    ```
    [experimental-advance-branches]
    enabled-branches = ["glob:*"]
    disabled-branches = ["main"]
    ```
    
    Branches that match a disabled pattern will not be advanced, even if they also
    match an enabled pattern.
    
    This implements feature request #2338.
    emesterhazy committed Mar 31, 2024
    Configuration menu
    Copy the full SHA
    006171d View commit details
    Browse the repository at this point in the history
  2. Allow advance_branches tests to be parameterized

    In a future commit these tests will run with both `jj commit` and `jj new` since
    both will have the same semantics for advancing the branch pointer.
    
    Parameterizing the tests allows us to run both variants without duplicating the
    test bodies. Since the commit IDs are different when `jj describe` + `jj new`
    is used instead of `jj commit`, this commit also drops the commit IDs from the
    test snapshots. This is fine because the commit IDs are not important for these
    tests.
    emesterhazy committed Mar 31, 2024
    Configuration menu
    Copy the full SHA
    4e83afd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8a218d2 View commit details
    Browse the repository at this point in the history
  4. Don't detatch Git HEAD when advance-branches is enabled for a branch

    When setting the working copy commit, if a single branch points to a parent of
    the working copy and advance-branches is enabled for that branch, set Git HEAD
    to the branch instead of detatching at the parent commit.
    emesterhazy committed Mar 31, 2024
    Configuration menu
    Copy the full SHA
    2cd9919 View commit details
    Browse the repository at this point in the history