Gentoo Archives: gentoo-user

From: Ian Zimmerman <itz@××××××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] OT: git, how to compare a repo with a loose tree
Date: Fri, 08 Dec 2017 02:58:44
Message-Id: 20171208025830.wsgp4fwkbhqhcnmv@matica.foolinux.mooo.com
I would like to use "git diff" to show differences between the
current state of a git repository and a normal directory tree somewhere
on the filesystem, ie. one without a .git subdirectory.  This is proving
surprisingly hard to do.

git diff has a documented mode to compare general "paths" as they call
it: the --no-index option.  But when I try it like this inside a git repo,

 git diff --no-index . /somedir

git apparently "forgets" that the current directory is a repo, and just
basically apes diff -r.  This means it doesn't know which files are
tracked, and in particular it reports every freaking file under ./.git
as deleted.  And there is no exclude option that I see.  Argh!  How can
I get around this?

If it matters: I'm fine with assuming the repo is clean ie. no
uncommitted changes, so the current state can be represented as any of:
working tree, "index" or HEAD.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.

Replies

Subject Author
Re: [gentoo-user] OT: git, how to compare a repo with a loose tree Michael Orlitzky <mjo@g.o>