threads / discuss / 495

tool to diff cache <-> working directory

Subject: tool to diff cache <-> working directory

## tl;dr

5 messages between May 6, 2005 and May 6, 2005.

replies: 4people: 2as markdown or json

Thomas Glanzmann· May 6, 2005, 00:23 UTC · lore

Hello, is there a tool to compare cache with working directory similiar to diff-tree, diff-cache and diff-files? Or is there a way to find out the SHA checksum of a file in a working directory without adding it to a temporary cache?

	Thomas
Junio C Hamano· May 6, 2005, 01:33 UTC · re: Thomas Glanzmann · lore

Re: tool to diff cache <-> working directory

>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:

TG> Is there a tool to compare cache with working directory TG> similiar to diff-tree, diff-cache and diff-files?

    git-diff-tree tree1 tree2           two trees
    git-diff-cache --cached tree1	cache and tree
    git-diff-cache tree1		tree and working directory
    git-diff-files                      cache and working directory

So git-diff-files is not just similar to but exactly is what you want if I read your question correctly.

TG> Or is there a way to find out the SHA checksum of a file in TG> a working directory without adding it to a temporary cache?

Yes there is a way, git-write-blob, but why would you want to do that?

Thomas Glanzmann· May 6, 2005, 02:07 UTC · re: Junio C Hamano · lore

Re: tool to diff cache <-> working directory

Hello,
>     git-diff-tree tree1 tree2           two trees
>     git-diff-cache --cached tree1	  cache and tree
>     git-diff-cache tree1		  tree and working directory
>     git-diff-files                      cache and working directory
that makes it clear. Thanks.
> So git-diff-files is not just similar to but exactly is what you
> want if I read your question correctly.
Yes, it is. :-)
> Yes there is a way, git-write-blob, but why would you want to do
> that?

I thought there would be no cache<->working directory delta generation. And I need a way to see if there are unchecked-in deltas in the working tree. So I thought about looking at the 'git-diff-cache --cached tree1' and comparing it with the self generated SHAs of the working tree. But now, that there is such a tool, I am perfectly fine.

Thanks,
	Thomas
Junio C Hamano· May 6, 2005, 02:48 UTC · re: Thomas Glanzmann · lore

Re: tool to diff cache <-> working directory

>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:

TG> I thought there would be no cache<->working directory delta generation. TG> And I need a way to see if there are unchecked-in deltas in the working TG> tree. So I thought about looking at the 'git-diff-cache --cached tree1' TG> and comparing it with the self generated SHAs of the working tree. But TG> now, that there is such a tool, I am perfectly fine.

Are you using pure GIT, without any Porcelain layer like Cogito?

Cogito has "cg-status" that shows something like "cvs -n update" output.

My (shameless plug ;-) JIT [*1*] also has "jit-status".

[References] *1* http://members.cox.net/junkio/

Thomas Glanzmann· May 6, 2005, 03:13 UTC · re: Junio C Hamano · lore

Re: tool to diff cache <-> working directory

Hello,
> Are you using pure GIT, without any Porcelain layer like Cogito?
no, I actually write a porcelain layer myself in perl. For several reasons:
	- I want something that runs on Solaris without gnu-utils
	- I want to understand the git internals.
	- I don't need branches and refs in .git
> Cogito has "cg-status" that shows something like "cvs -n update"
> output.

I just finished implementing my 'git status' command which does the following:

	(faui01) [~/work/git/git] git status
	 + 1
	 ? 2
	 - COPYING
	D* Makefile
	 * commit.c
	D  export.c
	+/-/* -> add, rm, mod
	?     -> orphan (not under revision control)
	D     -> dirty -> was explicit modified in cache but cache doesn't match working copy
I also have a ignore list for known orphans:
	(faui01) [~/work/git/git] cat .git/ignore
	\.o$
	git-cat-file
	...
	git-write-tree
	libgit.a
Sincerely,
	Thomas

← back to recent threads