# tool to diff cache <-> working directory

5 messages from 2005-05-06 to 2005-05-06. Participants: Thomas Glanzmann, Junio C Hamano.
Thread: https://gitlist.dev/t/495

## Thomas Glanzmann, 2005-05-06 00:23

Subject: tool to diff cache <-> working directory
Message-ID: <20050506002347.GU20994@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050506002347.GU20994%40cip.informatik.uni-erlangen.de

```
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, 2005-05-06 01:33

Subject: Re: tool to diff cache <-> working directory
Message-ID: <7vhdhhf88u.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhdhhf88u.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050506002347.GU20994@cip.informatik.uni-erlangen.de>

```
>>>>> "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, 2005-05-06 02:07

Subject: Re: tool to diff cache <-> working directory
Message-ID: <20050506020759.GA11506@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050506020759.GA11506%40cip.informatik.uni-erlangen.de
In-Reply-To: <7vhdhhf88u.fsf@assigned-by-dhcp.cox.net>

```
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, 2005-05-06 02:48

Subject: Re: tool to diff cache <-> working directory
Message-ID: <7vy8atdq7i.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vy8atdq7i.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050506020759.GA11506@cip.informatik.uni-erlangen.de>

```
>>>>> "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, 2005-05-06 03:13

Subject: Re: tool to diff cache <-> working directory
Message-ID: <20050506031316.GB11506@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050506031316.GB11506%40cip.informatik.uni-erlangen.de
In-Reply-To: <7vy8atdq7i.fsf@assigned-by-dhcp.cox.net>

```
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

```
