Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Jun 22, 2012

  1. Tim Henigan

    diff-no-index: exit(1) if 'diff --quiet <repo file> <external file>' …

    …finds changes
    When running 'git diff --quiet <file1> <file2>', if file1 or file2
    is outside the repository, it will exit(0) even if the files differ.
    It should exit(1) when they differ.
    This happens because 'diff_no_index' looks at the 'found_changes'
    member from 'diff_options' to determine if changes were made.  This
    is the wrong thing to do, since it is only set if xdiff is actually
    run and it finds a change (the diff machinery will optimize out the
    xdiff call when it is not necessary) and in that case HAS_CHANGED
    flag needs to be taken into account.
    Use diff_result_code() that knows all these details for the correct
    exit value instead.
    Signed-off-by: Tim Henigan <>
    Signed-off-by: Junio C Hamano <>
    authored June 21, 2012 gitster committed June 22, 2012
Something went wrong with that request. Please try again.