Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15

Re: Wanted - a file browser interface to git

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:09


On Tue, 18 Oct 2005, John Ellson wrote:
Linus Torvalds wrote:
quoted
You are aware of "git whatchanged -p xxx", right?
I wasn't aware of it, no.  Looks very useful.  Thanks.

I see that you can take the tree id from the diff-tree lines and
then produce the state of the file at that time with "cg-admin-cat -r <id>
xxx"
Is that how you would do it?
Well, I'd do it with the git commands: once you see the diff, you should 
know the SHA1's of the source and destination, and then you can just do

	git-cat-file blob [sha1]

to get the before (or after) state.

The way I'd get the SHA1 is either (now with the extended diff format) in 
the short form from the diff itself (the "index" line), or by just 
separately doing a

	git-diff-tree -r [sha-of-commit]

to see the "raw" diff format.

All the diff things can take a pathname limiter, the same way 
"git-whatchanged" does, so if you are only interested in one file, just 
name the file:

	git-diff-tree -r [sha-of-commit] [filename]

And just to make clear how powerful this is: "filename" doesn't have to be 
a single file. It can be a set of files and/or directories, so if you want 
to track multiple things at the same time, just do multiple filenames.

What I do a lot is to check what has changed in some particular subsystem, 
ie somebody says that something broke in SCSI, and then I do

	git-whatchanged -p drivers/scsi/ include/scsi/

and it will show any changes to anything under either of those 
directories.

"git-whatchanged" really is very powerful. The silly thing is that it 
really boils down to just a single line script (well, with various 
argument handling etc it's actually five lines, but the "core" is really 
just a single pipeline of "git-rev-list | git-diff-tree --stdin".
Are there any plans for cogito to support it?
Well, cogito could certainly just do a "cg-whatchanged", but it's really 
the same thing. Since cogito depends on git anyway, cogito users could 
just use the git-whatchanged functionality.

Or to make it more seamless, just do

	alias cg-whatchanged=git-whatchanged

or something like that ;^)

			Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help