Skip to content
  • Duy Nguyen's avatar
    diff*: fix worktree setup · 4f38f6b5
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    This fixes "git diff", "git diff-files" and "git diff-index" to work
    correctly under worktree setup. Because diff* family works in many modes
    and not all of them require worktree, Junio made a nice summary
    (with a little modification from me):
    
     * diff-files is about comparing with work tree, so it obviously needs a
      work tree;
    
     * diff-index also does, except "diff-index --cached" or "diff --cached TREE"
    
     * no-index is about random files outside git context, so it obviously
       doesn't need any work tree;
    
     * comparing two (or more) trees doesn't;
    
     * comparing two blobs doesn't;
    
     * comparing a blob with a random file doesn't;
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    4f38f6b5