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: d036d667b7
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 055930bc89
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jun 22, 2018

  1. t3200: unset core.logallrefupdates when testing reflog creation

    This test checks that the "-l" option creates a reflog. But
    in fact we'd create one even without it, since the default
    in a non-bare repository is to do so. Let's unset the config
    so we can be sure our "-l" option is kicking in.
    
    Note that we can't do this with test_config, since that
    would leave the variable unset after our test finishes,
    confusing downstream tests (the helper is not not smart
    enough to restore the previous value, and just always runs
    test_unconfig).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    peff authored and gitster committed Jun 22, 2018
    Configuration menu
    Copy the full SHA
    6b15595 View commit details
    Browse the repository at this point in the history
  2. t: switch "branch -l" to "branch --create-reflog"

    In preparation for deprecating "-l", let's make sure we're
    using the recommended option ourselves.
    
    This patch just mechanically converts "branch -l" to "branch
    --create-reflog".  Note that with the exception of the
    actual "--create-reflog" test, we could actually remove "-l"
    entirely from most of these callers. That's because these
    days core.logallrefupdates defaults to true in a non-bare
    repository.
    
    I've left them in place, though, since they serve to
    document the expectation of the test, even if they are
    technically noops.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    peff authored and gitster committed Jun 22, 2018
    Configuration menu
    Copy the full SHA
    7687f19 View commit details
    Browse the repository at this point in the history
  3. branch: deprecate "-l" option

    The "-l" option is short for "--create-reflog". This has
    caused much confusion over the years. Most people expect it
    to work as "--list", because that would match the other
    "mode" options like -d/--delete and -m/--move, as well as
    the similar -l/--list option of git-tag.
    
    Adding to the confusion, using "-l" _appears_ to work as
    "--list" in some cases:
    
      $ git branch -l
      * master
    
    because the branch command defaults to listing (so even
    trying to specify --list in the command above is redundant).
    But that may bite the user later when they add a pattern,
    like:
    
      $ git branch -l foo
    
    which does not return an empty list, but in fact creates a
    new branch (with a reflog, naturally) called "foo".
    
    It's also probably quite uncommon for people to actually use
    "-l" to create a reflog. Since 0bee591 (Enable reflogs by
    default in any repository with a working directory.,
    2006-12-14), this is the default in non-bare repositories.
    So it's rather unfortunate that the feature squats on the
    short-and-sweet "-l" (which was only added in 3a4b3f2
    (Create/delete branch ref logs., 2006-05-19), meaning there
    were only 7 months where it was actually useful).
    
    Let's deprecate "-l" in hopes of eventually re-purposing it
    to "--list".
    
    Note that we issue the warning only when we're not in list
    mode. This means that people for whom it works as a happy
    accident, namely:
    
      $ git branch -l
      master
    
    won't see the warning at all. And when we eventually switch
    to it meaning "--list", that will just continue to work.
    
    We do the issue the warning for these important cases:
    
      - when we are actually creating a branch, in case the user
        really did mean it as "--create-reflog"
    
      - when we are in some _other_ mode, like deletion. There
        the "-l" is a noop for now, but it will eventually
        conflict with any other mode request, and the user
        should be told that this is changing.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    peff authored and gitster committed Jun 22, 2018
    Configuration menu
    Copy the full SHA
    055930b View commit details
    Browse the repository at this point in the history
Loading