All of lore.kernel.org
 help / color / mirror / Atom feed
* How do get a specific version of a particular file?
@ 2007-02-27 12:34 Theodore Ts'o
  2007-02-27 12:43 ` Christian MICHON
                   ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: Theodore Ts'o @ 2007-02-27 12:34 UTC (permalink / raw)
  To: git


So given a particular tree-ish and a pathname, I'd like get the contents
of that particular file as of a particular revision.  i.e., the
equivalent of:

	cvs -r v1.37 -p e2fsck/pass1.c
or
	bk cat -r 2345 e2fsck/pass1.c

The closest I've been able to come is to use

	git archive --format=zip v1.37 e2fsck/pass1.c | gunzip

But that seems kinda silly.  

git-checkout will only write the output to the working tree.
git-cat-file and git-show only work on a object identifier (they are
low-level plumbing commands).  

So if it is a matter of we don't have an easy way to do this (as opposed
to me being stupid or the git documentation just failing to mention it
in the right places), what's the best way to add it?

One easy way would be to add --format=raw to git-archive, but that might
seem counter-intuitive to an average git user; they just want to see the
output of a file at a particular point in time, which doesn't have much
to do with archiving.   

Should we add a new command like "git-cat"?   Should we add a -p option
to the "git-checkout <treeish> <path>" form of git-checkout?

I'm currently leaning towards the last; it would be pretty simple to
enhance git-checkout so that a -p option would run "git archive
--format=zip ...", even though that would be a pretty nasty hack, and it
wouldn't be much harder to add --format=raw support to git-archive, but
I still think that's not a intuitive place to find that particular
functionality.

						- Ted

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2007-02-28  4:34 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 12:34 How do get a specific version of a particular file? Theodore Ts'o
2007-02-27 12:43 ` Christian MICHON
2007-02-27 12:44 ` Peter Baumann
2007-02-27 12:49 ` Alex Riesen
2007-02-27 12:53   ` Alex Riesen
2007-02-27 12:57 ` Johannes Schindelin
2007-02-27 15:42   ` Theodore Tso
2007-02-27 19:55     ` Johannes Schindelin
2007-02-27 22:39       ` Theodore Tso
2007-02-27 23:25         ` Randal L. Schwartz
2007-02-27 23:35           ` Junio C Hamano
2007-02-28  0:22             ` Linus Torvalds
2007-02-28  0:31               ` Junio C Hamano
2007-02-28  0:39                 ` Johannes Schindelin
2007-02-28  0:54                 ` Linus Torvalds
2007-02-28  1:11                   ` Nicolas Pitre
2007-02-28  1:24                     ` Linus Torvalds
2007-02-28  1:48                       ` Nicolas Pitre
2007-02-28  2:32                 ` Theodore Tso
2007-02-28  2:45                   ` Junio C Hamano
2007-02-28  3:03                     ` Theodore Tso
2007-02-28  4:33                       ` Junio C Hamano
2007-02-28  1:04               ` Nicolas Pitre
2007-02-28  0:01           ` Johannes Schindelin
2007-02-28  0:30             ` Linus Torvalds
2007-02-28  0:33               ` Junio C Hamano
2007-02-28  0:36               ` Johannes Schindelin
2007-02-27 15:43   ` [PATCH] Fix git-show man page formatting in the EXAMPLES section Theodore Tso
2007-02-27 16:38 ` How do get a specific version of a particular file? Linus Torvalds
2007-02-27 17:14   ` Bill Lear
2007-02-27 19:09   ` Theodore Tso
2007-02-27 19:33     ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.