How do I...

11 messages, 6 authors, 2016-06-15 · open the first message on its own page

How do I...

From: Frank Sorenson <hidden>
Date: 2016-06-15 22:41:56

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Okay, I've got some "How can I?" questions.  I hope I'm not the only one
still working to "git it".

How can I git a list of commits that have modified a particular file?
For example, I'd like to do something like this:
# git-file-revs Makefile
f7eb55878f11575281add2a5726e483aed5e45bb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
...

How can I output a list of the filename(s) modified by a particular
commit? (for example)
# git-commit-info files 6741f3a7f9922391cd02b3ca1329e669497dc22f
Makefile
file1
arch/file2

Can I use cg-log to output just the information about a particular
commit?  (I don't need all the commits, just the one I'm interested in).

After doing a cg-update, can I cg-log just the changes since the last
update?  Alternatively, how can I tell cg-log I'm caught up, and don't
need anything historical?

Can I do these with git/cogito, or will I need to start diving deeper
into the code?

Thanks,

Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCez2zaI0dwg4A47wRAuNAAJ0QsBkwwHFbFQshRGSDCLv/pEaZXQCfeZj6
rqC9ZoVAYNeMwKqppbyXx9o=
=pJDl
-----END PGP SIGNATURE-----

Re: How do I...

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

hello,
How can I git a list of commits that have modified a particular file?
You have to parse the git-rev-list and look at every single commit. But
I think cogito as well as jit have a command to obtain that.
How can I output a list of the filename(s) modified by a particular
commit? (for example)
A commit is only a pointer to a tree, so you can't. But you can see what
files have changed between a parent (note: there are up to 16) and the
dir which is associated with the commit:

git-diff-tree <child> <parent>

So calling git-diff-tree for every parent should do what you want.

	Thomas

Re: How do I...

From: Thomas Glanzmann <hidden>
Date: 2016-06-15 22:41:56

Hello,
git-diff-tree <child> <parent>
of course this is: git-diff-tree <parent> <child>

	Thomas

Re: How do I...

From: Dave Kleikamp <hidden>
Date: 2016-06-15 22:41:56

On Fri, 2005-05-06 at 03:49 -0600, Frank Sorenson wrote:
After doing a cg-update, can I cg-log just the changes since the last
update?  Alternatively, how can I tell cg-log I'm caught up, and don't
need anything historical?
(Assuming pulling from "origin")
Instead of doing cg-update, do cg-pull.  Then "cg-log :origin" will give
you you the changesets you just pulled.  "cg-merge origin" will then
complete operation, thereby catching you up.

-- 
David Kleikamp
IBM Linux Technology Center

Re: How do I...

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


On Fri, 6 May 2005, Frank Sorenson wrote:
Okay, I've got some "How can I?" questions.  I hope I'm not the only one
still working to "git it".

How can I git a list of commits that have modified a particular file?
For example, I'd like to do something like this:
# git-file-revs Makefile
f7eb55878f11575281add2a5726e483aed5e45bb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
There has been at least two different scripts for this posted, and one C 
source code version.

I just haven't integrated them, because I'm an idiot, and too much choice 
makes me run around in small circles and clucking.

Guys - whoever wrote one of the scripts, can you please send out your 
current version to the git list and cc me, and explain why yours is 
superior to the other peoples version. Please?

But I might cook something up myself too. 
How can I output a list of the filename(s) modified by a particular
commit? (for example)
# git-commit-info files 6741f3a7f9922391cd02b3ca1329e669497dc22f
You need to use "git-tree-diff", but it doesn't want one commit, it wants 
two.

In the case of "what did this one commit change", you need to look up its 
parents (there can be more than one! In fact, the current git repository 
has one entry with _five_ parents), and then you need to select one of 
them as the reference. In other words, if it's a merge, you need to select 
which side you care about.
Can I use cg-log to output just the information about a particular
commit?  (I don't need all the commits, just the one I'm interested in).
You don't even need cg-log for that. If you already know which commit 
you're interested in, just output that one commit:

	git-cat-file commit <commit-name-here>
After doing a cg-update, can I cg-log just the changes since the last
update?  Alternatively, how can I tell cg-log I'm caught up, and don't
need anything historical?
I don't know how to do with with cg-update, but if you use the 
"git-pull-script" thing, you can do

	git-diff-tree -p ORIG_HEAD HEAD

which shows you what the pull brought in.
Can I do these with git/cogito, or will I need to start diving deeper
into the code?
Apart from finding the "which commit changed this", it's all trivially 
doable. And the "which commit" thing is also trivially doable if you just 
find the script..

		Linus

Re: How do I...

From: David Woodhouse <dwmw2@infradead.org>
Date: 2016-06-15 22:41:56

On Fri, 2005-05-06 at 09:13 -0700, Linus Torvalds wrote:
There has been at least two different scripts for this posted, and one C 
source code version.

I just haven't integrated them, because I'm an idiot, and too much choice 
makes me run around in small circles and clucking.

Guys - whoever wrote one of the scripts, can you please send out your 
current version to the git list and cc me, and explain why yours is 
superior to the other peoples version. Please?
I already explained why mine sucks and shouldn't be merged. It was a
proof of concept; hoping for the stone soup effect.

I haven't seen a C version or indeed anything which actually does the
right thing, although I outlined how it would work and _threatened_ to
do one. I had a half-arsed attempt at it on the way home from
linux.conf.au but my brain tends to melt while I'm on airplanes so I
didn't get very far.

-- 
dwmw2

Re: How do I...

From: Frank Sorenson <hidden>
Date: 2016-06-15 22:41:56

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Kleikamp wrote:
On Fri, 2005-05-06 at 03:49 -0600, Frank Sorenson wrote:

quoted
After doing a cg-update, can I cg-log just the changes since the last
update?  Alternatively, how can I tell cg-log I'm caught up, and don't
need anything historical?

(Assuming pulling from "origin")
Instead of doing cg-update, do cg-pull.  Then "cg-log :origin" will give
you you the changesets you just pulled.
Super.  This works great.  Thanks.
"cg-merge origin" will then
complete operation, thereby catching you up.
Okay, not quite so great.  Here's the ouput when I ran it to update my
kernel this morning.  Note that I haven't made any local modifications.
 I'm seeing this sort of thing often enough that I'm blowing away my
whole git tree and regenerating it to get back to a stable state once or
twice a week.  I'm sure there's another way, but without me making
modifications on my end, I wouldn't expect this to happen.  Suggestions
are welcome! :)

# cg-merge origin
Fast-forwarding 6741f3a7f9922391cd02b3ca1329e669497dc22f ->
2512809255d018744fe6c2f5e996c83769846c07
        on top of 6741f3a7f9922391cd02b3ca1329e669497dc22f...
patching file fs/proc/Makefile
patching file fs/proc/array.c
patching file fs/proc/base.c
patching file fs/proc/generic.c
patching file fs/proc/inode-alloc.txt
patching file fs/proc/inode.c
patching file fs/proc/internal.h
patching file fs/proc/kcore.c
patching file fs/proc/kmsg.c
patching file fs/proc/mmu.c
patching file fs/proc/nommu.c
patching file fs/proc/proc_devtree.c
patching file fs/proc/proc_misc.c
patching file fs/proc/proc_tty.c
patching file fs/proc/root.c
patching file fs/proc/task_mmu.c
patching file fs/proc/task_nommu.c
touch: cannot touch `fs/proc/Makefile': No such file or directory
touch: cannot touch `fs/proc/array.c': No such file or directory
touch: cannot touch `fs/proc/base.c': No such file or directory
touch: cannot touch `fs/proc/generic.c': No such file or directory
touch: cannot touch `fs/proc/inode-alloc.txt': No such file or directory
touch: cannot touch `fs/proc/inode.c': No such file or directory
touch: cannot touch `fs/proc/internal.h': No such file or directory
touch: cannot touch `fs/proc/kcore.c': No such file or directory
touch: cannot touch `fs/proc/kmsg.c': No such file or directory
touch: cannot touch `fs/proc/mmu.c': No such file or directory
touch: cannot touch `fs/proc/nommu.c': No such file or directory
touch: cannot touch `fs/proc/proc_devtree.c': No such file or directory
touch: cannot touch `fs/proc/proc_misc.c': No such file or directory
touch: cannot touch `fs/proc/proc_tty.c': No such file or directory
touch: cannot touch `fs/proc/root.c': No such file or directory
touch: cannot touch `fs/proc/task_mmu.c': No such file or directory
touch: cannot touch `fs/proc/task_nommu.c': No such file or directory
rm: cannot remove `fs/proc/Makefile': No such file or directory
rm: cannot remove `fs/proc/array.c': No such file or directory
rm: cannot remove `fs/proc/base.c': No such file or directory
rm: cannot remove `fs/proc/generic.c': No such file or directory
rm: cannot remove `fs/proc/inode-alloc.txt': No such file or directory
rm: cannot remove `fs/proc/inode.c': No such file or directory
rm: cannot remove `fs/proc/internal.h': No such file or directory
rm: cannot remove `fs/proc/kcore.c': No such file or directory
rm: cannot remove `fs/proc/kmsg.c': No such file or directory
rm: cannot remove `fs/proc/mmu.c': No such file or directory
rm: cannot remove `fs/proc/nommu.c': No such file or directory
rm: cannot remove `fs/proc/proc_devtree.c': No such file or directory
rm: cannot remove `fs/proc/proc_misc.c': No such file or directory
rm: cannot remove `fs/proc/proc_tty.c': No such file or directory
rm: cannot remove `fs/proc/root.c': No such file or directory
rm: cannot remove `fs/proc/task_mmu.c': No such file or directory
rm: cannot remove `fs/proc/task_nommu.c': No such file or directory
fs/proc/Makefile: needs update
fs/proc/array.c: needs update
fs/proc/base.c: needs update
fs/proc/generic.c: needs update
fs/proc/inode-alloc.txt: needs update
fs/proc/inode.c: needs update
fs/proc/internal.h: needs update
fs/proc/kcore.c: needs update
fs/proc/kmsg.c: needs update
fs/proc/mmu.c: needs update
fs/proc/nommu.c: needs update
fs/proc/proc_devtree.c: needs update
fs/proc/proc_misc.c: needs update
fs/proc/proc_tty.c: needs update
fs/proc/root.c: needs update
fs/proc/task_mmu.c: needs update
fs/proc/task_nommu.c: needs update


Thanks,
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCe53EaI0dwg4A47wRAt5dAJ4wEG8KmRvEnqLMOtDiNrZqRhURMgCfTUaE
JLGGFnRN4YGhix/7SkOwAtg=
=aDQu
-----END PGP SIGNATURE-----

Re: How do I...

From: Dave Kleikamp <hidden>
Date: 2016-06-15 22:41:56

On Fri, 2005-05-06 at 10:39 -0600, Frank Sorenson wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Kleikamp wrote:
quoted
On Fri, 2005-05-06 at 03:49 -0600, Frank Sorenson wrote:

quoted
After doing a cg-update, can I cg-log just the changes since the last
update?  Alternatively, how can I tell cg-log I'm caught up, and don't
need anything historical?

(Assuming pulling from "origin")
Instead of doing cg-update, do cg-pull.  Then "cg-log :origin" will give
you you the changesets you just pulled.
I'm not sure if I was clear.  cg-pull should be 'cg-pull origin".
Super.  This works great.  Thanks.
quoted
"cg-merge origin" will then
complete operation, thereby catching you up.
Okay, not quite so great.  Here's the ouput when I ran it to update my
kernel this morning.  Note that I haven't made any local modifications.
 I'm seeing this sort of thing often enough that I'm blowing away my
whole git tree and regenerating it to get back to a stable state once or
twice a week.  I'm sure there's another way, but without me making
modifications on my end, I wouldn't expect this to happen.  Suggestions
are welcome! :)
I take this to mean you're seeing problems with cg-update too. cg-update
simply runs cg-pull & cg-merge together, so running them separately
shouldn't make any difference.
# cg-merge origin
Fast-forwarding 6741f3a7f9922391cd02b3ca1329e669497dc22f ->
2512809255d018744fe6c2f5e996c83769846c07
        on top of 6741f3a7f9922391cd02b3ca1329e669497dc22f...
patching file fs/proc/Makefile
patching file fs/proc/array.c
patching file fs/proc/base.c
patching file fs/proc/generic.c
patching file fs/proc/inode-alloc.txt
patching file fs/proc/inode.c
patching file fs/proc/internal.h
patching file fs/proc/kcore.c
patching file fs/proc/kmsg.c
patching file fs/proc/mmu.c
patching file fs/proc/nommu.c
patching file fs/proc/proc_devtree.c
patching file fs/proc/proc_misc.c
patching file fs/proc/proc_tty.c
patching file fs/proc/root.c
patching file fs/proc/task_mmu.c
patching file fs/proc/task_nommu.c
touch: cannot touch `fs/proc/Makefile': No such file or directory
touch: cannot touch `fs/proc/array.c': No such file or directory
touch: cannot touch `fs/proc/base.c': No such file or directory
touch: cannot touch `fs/proc/generic.c': No such file or directory
touch: cannot touch `fs/proc/inode-alloc.txt': No such file or directory
touch: cannot touch `fs/proc/inode.c': No such file or directory
touch: cannot touch `fs/proc/internal.h': No such file or directory
touch: cannot touch `fs/proc/kcore.c': No such file or directory
touch: cannot touch `fs/proc/kmsg.c': No such file or directory
touch: cannot touch `fs/proc/mmu.c': No such file or directory
touch: cannot touch `fs/proc/nommu.c': No such file or directory
touch: cannot touch `fs/proc/proc_devtree.c': No such file or directory
touch: cannot touch `fs/proc/proc_misc.c': No such file or directory
touch: cannot touch `fs/proc/proc_tty.c': No such file or directory
touch: cannot touch `fs/proc/root.c': No such file or directory
touch: cannot touch `fs/proc/task_mmu.c': No such file or directory
touch: cannot touch `fs/proc/task_nommu.c': No such file or directory
rm: cannot remove `fs/proc/Makefile': No such file or directory
rm: cannot remove `fs/proc/array.c': No such file or directory
rm: cannot remove `fs/proc/base.c': No such file or directory
rm: cannot remove `fs/proc/generic.c': No such file or directory
rm: cannot remove `fs/proc/inode-alloc.txt': No such file or directory
rm: cannot remove `fs/proc/inode.c': No such file or directory
rm: cannot remove `fs/proc/internal.h': No such file or directory
rm: cannot remove `fs/proc/kcore.c': No such file or directory
rm: cannot remove `fs/proc/kmsg.c': No such file or directory
rm: cannot remove `fs/proc/mmu.c': No such file or directory
rm: cannot remove `fs/proc/nommu.c': No such file or directory
rm: cannot remove `fs/proc/proc_devtree.c': No such file or directory
rm: cannot remove `fs/proc/proc_misc.c': No such file or directory
rm: cannot remove `fs/proc/proc_tty.c': No such file or directory
rm: cannot remove `fs/proc/root.c': No such file or directory
rm: cannot remove `fs/proc/task_mmu.c': No such file or directory
rm: cannot remove `fs/proc/task_nommu.c': No such file or directory
fs/proc/Makefile: needs update
fs/proc/array.c: needs update
fs/proc/base.c: needs update
fs/proc/generic.c: needs update
fs/proc/inode-alloc.txt: needs update
fs/proc/inode.c: needs update
fs/proc/internal.h: needs update
fs/proc/kcore.c: needs update
fs/proc/kmsg.c: needs update
fs/proc/mmu.c: needs update
fs/proc/nommu.c: needs update
fs/proc/proc_devtree.c: needs update
fs/proc/proc_misc.c: needs update
fs/proc/proc_tty.c: needs update
fs/proc/root.c: needs update
fs/proc/task_mmu.c: needs update
fs/proc/task_nommu.c: needs update
I've seen some isolated problems running cg-update/cg-merge to a clean
tree with files that have been deleted.

Saw this this morning:

shaggy@kleikamp linus-clean $ cg-merge origin
Fast-forwarding bfd4bda097f8758d28e632ff2035e25577f6b060 ->
2512809255d018744fe6c2f5e996c83769846c07
        on top of bfd4bda097f8758d28e632ff2035e25577f6b060...
patching file drivers/video/intelfb/intelfb.h
shaggy@kleikamp linus-clean $ cg-status
? drivers/video/intelfb/intelfbdrv.h

Removing the file manually appears to fix it.
Thanks,
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-- 
David Kleikamp
IBM Linux Technology Center

Re: How do I...

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


On Fri, 6 May 2005, Frank Sorenson wrote:
Okay, I've got some "How can I?" questions.  I hope I'm not the only one
still working to "git it".

How can I git a list of commits that have modified a particular file?
For example, I'd like to do something like this:
# git-file-revs Makefile
f7eb55878f11575281add2a5726e483aed5e45bb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Ok, I now have the perfect interface for _most_ uses of this thing.

For example, let's say that you are interested in "what changed in the 
USB input layer lately". You can now do

	git-rev-list | git-diff-tree -p -v --stdin drivers/usb/input | less -S

and you'll get some very readable output that tells you _exactly_ what has 
changed to any file in that subdirectory.

Or, let's say that you're the author of the gt96100 ethernet driver (just 
to pick one that has both a .c and a .h file and that has had changes in 
the current git tree, you'd do:

	git-rev-list HEAD | git-diff-tree -p -v --stdin drivers/net/gt96100eth.* | less -S

and it gives you _exactly_ what you want (ie thanks to how diff-tree
works, you can give it any number of files or directories you're
interested in).

Normally, this thing will ignore merge commits, but if you want to see the
merges that the changes came through (a merge _can_ have real changes of
its own too), add the "-m" flag to the git-diff-tree thing.

Try out the above examples on the current kernel tree (and with my most
current git version as of five minutes ago - it shows up at least on
gitweb, but I don't know if it's mirrored out with rsync yet). Very
pretty. Very useful.

		Linus

Re: How do I...

From: Frank Sorenson <hidden>
Date: 2016-06-15 22:41:56

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave Kleikamp wrote:
I'm not sure if I was clear.  cg-pull should be 'cg-pull origin".
Got it, and it does just what I wanted.
I take this to mean you're seeing problems with cg-update too. cg-update
simply runs cg-pull & cg-merge together, so running them separately
shouldn't make any difference.
Yes.  cg-pull and cg-update have both shown odd breakage of this sort,
putting my tree into a bad state.  Sometimes deleting files fixes it,
but more often than not, I've needed to just start a new tree again in
order to fix it.  This is probably due to inexperience with git, but
tree corruption probably shouldn't occur like this.

Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCe8BxaI0dwg4A47wRAk2OAJ915s2KHTNxrpi6k3wa7HiDhpOFGgCgrMxp
73JzFxl7lg2c9korTF8L7Ek=
=ILPh
-----END PGP SIGNATURE-----

Re: How do I...

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2016-06-15 22:41:56

On Fri, 2005-05-06 at 17:36 +0100, David Woodhouse wrote:
On Fri, 2005-05-06 at 09:13 -0700, Linus Torvalds wrote:
quoted
There has been at least two different scripts for this posted, and one C 
source code version.

I just haven't integrated them, because I'm an idiot, and too much choice 
makes me run around in small circles and clucking.

Guys - whoever wrote one of the scripts, can you please send out your 
current version to the git list and cc me, and explain why yours is 
superior to the other peoples version. Please?
I already explained why mine sucks and shouldn't be merged. It was a
proof of concept; hoping for the stone soup effect.

I haven't seen a C version or indeed anything which actually does the
right thing, although I outlined how it would work and _threatened_ to
do one. I had a half-arsed attempt at it on the way home from
linux.conf.au but my brain tends to melt while I'm on airplanes so I
didn't get very far.
Note that paulus current dirdiff CVS can diff arbitrary revs of a git
tree afaik (or a rev against current edited content).

Ben.

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