• Jeff King's avatar
    trace: avoid unnecessary quoting · 1fbdab21
    Jeff King authored
    Trace output which contains arbitrary strings (e.g., the
    arguments to commands which we are running) is always passed
    through sq_quote_buf(). That function always adds
    single-quotes, even if the output consists of vanilla
    characters. This can make the output a bit hard to read.
    
    Let's avoid the quoting if there are no characters which a
    shell would interpret. Trace output doesn't necessarily need
    to be shell-compatible, but:
    
      - the shell language is a good ballpark for what humans
        consider readable (well, humans versed in command line
        tools)
    
      - the run_command bits can be cut-and-pasted to a shell,
        and we'll keep that property
    
      - it covers any cases which would make the output
        visually ambiguous (e.g., embedded whitespace or quotes)
    Signed-off-by: 's avatarJeff King <peff@peff.net>
    Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    1fbdab21
quote.h 3.17 KB