Git development
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: <git@vger.kernel.org>
Subject: git ls-files --error-unmatch weirdness
Date: Fri, 12 Aug 2011 15:24:36 +0200	[thread overview]
Message-ID: <20110812132436.GA12147@goldbirke> (raw)

Hi,

I was looking for untracked files when noticed this:

repo$ git init
Initialized empty Git repository in /home/szeder/tmp/git/repo/.git/
repo (master)$ mkdir dir
repo (master)$ touch dir/file
repo (master)$ git add dir/file
repo (master)$ git commit -m 'first'
[master (root-commit) 2c0990c] first
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 dir/file
repo (master)$ git ls-files --others --error-unmatch
repo/dir (master)$ echo $?
0
repo (master)$ cd dir
repo/dir (master)$ git ls-files --others --error-unmatch
error: pathspec '' did not match any file(s) known to git.
Did you forget to 'git add'?
repo/dir (master)$ echo $?
1

So, the same 'git ls-files' command is OK when run at the top of the
worktree, but errors out in a subdirectory.  What's going on?  Is this
a bug?  If not, why not?


Thanks,
Gábor

             reply	other threads:[~2011-08-12 13:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 13:24 SZEDER Gábor [this message]
2011-08-12 14:17 ` git ls-files --error-unmatch weirdness Nguyen Thai Ngoc Duy
2011-08-12 17:56 ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20110812132436.GA12147@goldbirke \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox