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: 39e415cfd1
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 59a255aef0
Choose a head ref
  • 2 commits
  • 5 files changed
  • 2 contributors

Commits on Aug 8, 2018

  1. sideband: highlight keywords in remote sideband output

    The colorization is controlled with the config setting "color.remote".
    
    Supported keywords are "error", "warning", "hint" and "success". They
    are highlighted if they appear at the start of the line, which is
    common in error messages, eg.
    
       ERROR: commit is missing Change-Id
    
    The Git push process itself prints lots of non-actionable messages
    (eg. bandwidth statistics, object counters for different phases of the
    process). This obscures actionable error messages that servers may
    send back. Highlighting keywords in the sideband draws more attention
    to those messages.
    
    The background for this change is that Gerrit does server-side
    processing to create or update code reviews, and actionable error
    messages (eg. missing Change-Id) must be communicated back to the user
    during the push. User research has shown that new users have trouble
    seeing these messages.
    
    The highlighting is done on the client rather than server side, so
    servers don't have to grow capabilities to understand terminal escape
    codes and terminal state. It also consistent with the current state
    where Git is control of the local display (eg. prefixing messages with
    "remote: ").
    
    The highlighting can be configured using color.remote.<KEYWORD>
    configuration settings. Since the keys are matched case insensitively,
    we match the keywords case insensitively too.
    
    Finally, this solution is backwards compatible: many servers already
    prefix their messages with "error", and they will benefit from this
    change without requiring a server update. By contrast, a server-side
    solution would likely require plumbing the TERM variable through the
    git protocol, so it would require changes to both server and client.
    
    Helped-by: Duy Nguyen <pclouds@gmail.com>
    Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    hanwen authored and gitster committed Aug 8, 2018
    Configuration menu
    Copy the full SHA
    bf1a11f View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2018

  1. sideband: do not read beyond the end of input

    The caller of maybe_colorize_sideband() gives a counted buffer
    <src, n>, but the callee checked src[] as if it were a NUL terminated
    buffer.  If src[] had all isspace() bytes in it, we would have made
    n negative, and then
    
     (1) made number of strncasecmp() calls to see if the remaining
         bytes in src[] matched keywords, reading beyond the end of the
         array (this actually happens even if n does not go negative),
         and/or
    
     (2) called strbuf_add() with negative count, most likely triggering
         the "you want to use way too much memory" error due to unsigned
         integer overflow.
    
    Fix both issues by making sure we do not go beyond &src[n].
    
    In the longer term we may want to accept size_t as parameter for
    clarity (even though we know that a sideband message we are painting
    typically would fit on a line on a terminal and int is sufficient).
    Write it down as a NEEDSWORK comment.
    
    Helped-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    gitster committed Aug 18, 2018
    Configuration menu
    Copy the full SHA
    59a255a View commit details
    Browse the repository at this point in the history
Loading