• J
    git-diff: squelch "empty" diffs · fb13227e
    Junio C Hamano 提交于
    After starting to edit a working tree file but later when your edit ends
    up identical to the original (this can also happen when you ran a
    wholesale regexp replace with something like "perl -i" that does not
    actually modify many of the paths), "git diff" between the index and the
    working tree outputs many "empty" diffs that show "diff --git" headers
    and nothing else, because these paths are stat-dirty.  While it was a
    way to warn the user that the earlier action of the user made the index
    ineffective as an optimization mechanism, it was felt too loud for the
    purpose of warning even to experienced users, and also resulted in
    confusing people new to git.
    
    This replaces the "empty" diffs with a single warning message at the
    end.  Having many such paths hurts performance, and you can run
    "git-update-index --refresh" to update the lstat(2) information recorded
    in the index in such a case.  "git-status" does so as a side effect, and
    that is more familiar to the end-user, so we recommend it to them.
    
    The change affects only "git diff" that outputs patch text, because that
    is where the annoyance of too many "empty" diff is most strongly felt,
    and because the warning message can be safely ignored by downstream
    tools without getting mistaken as part of the patch.  For the low-level
    "git diff-files" and "git diff-index", the traditional behaviour is
    retained.
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    fb13227e
diff.h 7.0 KB