Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ae75cefd94075045edeb1d23283a47e4e48a9360
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a1f34d5955035dc64f2e25da0ba2cc0a0c73c21c
Choose a head ref
  • 6 commits
  • 9 files changed
  • 2 contributors

Commits on Nov 27, 2024

  1. Merge branch 'bf/set-head-symref' into bf/fetch-set-head-config

    * bf/set-head-symref:
      fetch set_head: handle mirrored bare repositories
      fetch: set remote/HEAD if it does not exist
      refs: add create_only option to refs_update_symref_extended
      refs: add TRANSACTION_CREATE_EXISTS error
      remote set-head: better output for --auto
      remote set-head: refactor for readability
      refs: atomically record overwritten ref in update_symref
      refs: standardize output of refs_read_symbolic_ref
      t/t5505-remote: test failure of set-head
      t/t5505-remote: set default branch to main
    gitster committed Nov 27, 2024
    Configuration menu
    Copy the full SHA
    761e62a View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2024

  1. fetch: add configuration for set_head behaviour

    In the current implementation, if refs/remotes/$remote/HEAD does not
    exist, running fetch will create it, but if it does exist it will not do
    anything, which is a somewhat safe and minimal approach. Unfortunately,
    for users who wish to NOT have refs/remotes/$remote/HEAD set for any
    reason (e.g. so that `git rev-parse origin` doesn't accidentally point
    them somewhere they do not want to), there is no way to remove this
    behaviour. On the other side of the spectrum, users may want fetch to
    automatically update HEAD or at least give them a warning if something
    changed on the remote.
    
    Introduce a new setting, remote.$remote.followRemoteHEAD with four
    options:
    
        - "never": do not ever do anything, not even create
        - "create": the current behaviour, now the default behaviour
        - "warn": print a message if remote and local HEAD is different
        - "always": silently update HEAD on every change
    
    Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ferdinandyb authored and gitster committed Dec 2, 2024
    Configuration menu
    Copy the full SHA
    b7f7d16 View commit details
    Browse the repository at this point in the history

Commits on Dec 5, 2024

  1. fetch set_head: move warn advice into advise_if_enabled

    Advice about what to do when getting a warning is typed out explicitly
    twice and is printed as regular output. The output is also tested for.
    Extract the advice message into a single place and use a wrapper
    function, so if later the advice is made more chatty the signature only
    needs to be changed in once place. Remove the testing for the advice
    output in the tests.
    
    Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ferdinandyb authored and gitster committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    ad739f5 View commit details
    Browse the repository at this point in the history
  2. fetch set_head: add warn-if-not-$branch option

    Currently if we want to have a remote/HEAD locally that is different
    from the one on the remote, but we still want to get a warning if remote
    changes HEAD, our only option is to have an indiscriminate warning with
    "follow_remote_head" set to "warn". Add a new option
    "warn-if-not-$branch", where $branch is a branch name we do not wish to
    get a warning about. If the remote HEAD is $branch do not warn,
    otherwise, behave as "warn".
    
    E.g. let's assume, that our remote origin has HEAD
    set to "master", but locally we have "git remote set-head origin seen".
    Setting 'remote.origin.followRemoteHEAD = "warn"' will always print
    a warning, even though the remote has not changed HEAD from "master".
    Setting 'remote.origin.followRemoteHEAD = "warn-if-not-master" will
    squelch the warning message, unless the remote changes HEAD from
    "master". Note, that should the remote change HEAD to "seen" (which we
    have locally), there will still be no warning.
    
    Improve the advice message in report_set_head to also include silencing
    the warning message with "warn-if-not-$branch".
    
    Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ferdinandyb authored and gitster committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    9e2b700 View commit details
    Browse the repository at this point in the history
  3. remote set-head: set followRemoteHEAD to "warn" if "always"

    When running "remote set-head" manually it is unlikely, that the user
    would actually like to have "fetch" always update the remote/HEAD. On
    the contrary, it is more likely, that the user would expect remote/HEAD
    to stay the way they manually set it, and just forgot about having
    "followRemoteHEAD" set to "always".
    
    When "followRemoteHEAD" is set to "always" make running "remote
    set-head" change the config to "warn".
    
    Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ferdinandyb authored and gitster committed Dec 5, 2024
    Configuration menu
    Copy the full SHA
    012bc56 View commit details
    Browse the repository at this point in the history

Commits on Dec 19, 2024

  1. Merge branch 'bf/fetch-set-head-config'

    "git fetch" honors "remote.<remote>.followRemoteHEAD" settings to
    tweak the remote-tracking HEAD in "refs/remotes/<remote>/HEAD".
    
    * bf/fetch-set-head-config:
      remote set-head: set followRemoteHEAD to "warn" if "always"
      fetch set_head: add warn-if-not-$branch option
      fetch set_head: move warn advice into advise_if_enabled
      fetch: add configuration for set_head behaviour
    gitster committed Dec 19, 2024
    Configuration menu
    Copy the full SHA
    a1f34d5 View commit details
    Browse the repository at this point in the history
Loading