git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: NoName Req <nonamereq29@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Bug(feature?) on git-diff-files
Date: Thu, 11 Apr 2019 08:57:04 -0400	[thread overview]
Message-ID: <20190411125703.GA26995@sigill.intra.peff.net> (raw)
In-Reply-To: <CABgj7us=Rk3EUvd2EVVqsYKDUGS7VfAX09SpW04fB26cgntw5g@mail.gmail.com>

On Thu, Apr 11, 2019 at 03:47:58PM +0300, NoName Req wrote:

> Summary
>    `git -C (folder path) diff-files --name-only` output is not correct
> 
> Steps to Reproduce
> 1. Apply change to a clean git repository. Go to another folder (not
> within this repository) and apply the command
>    `git -C repo-path diff-files --name-only`
> The above command lists dirty files in that repository.
> 2. Now undo your changes on the repository
> 3. Issue the same command. It still lists the file.
> 
> More Information
> 
> `git -C repo-path diff`  command doesn't seem to have this problem.

Try running `git update-index --refresh` before running `diff-files`.

Unlike git-diff, git-diff-files is plumbing that is meant to be called
from scripts. So it is up to the script writer to decide when the index
should be refreshed from the actual filesystem (which makes sense, e.g.,
if you're going to do it once at the start of the script and then make a
bunch of separate diff-related calls).

Until that happens, diff-files will see only that the entry is
stat-dirty, and report it as a potential change.

-Peff

      parent reply	other threads:[~2019-04-11 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:47 Bug(feature?) on git-diff-files NoName Req
2019-04-11 12:56 ` Duy Nguyen
2019-04-12 12:41   ` NoName Req
2019-04-11 12:57 ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411125703.GA26995@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=nonamereq29@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).