* sha1 of the repo excluding history ?
@ 2007-04-12 23:26 Yakov Lerner
2007-04-12 23:40 ` Shawn O. Pearce
2007-04-13 0:24 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Yakov Lerner @ 2007-04-12 23:26 UTC (permalink / raw)
To: Git Mailing List
Can I obtain from git the sha1 of the total last state of the
repo excluding history ? This is a state that covers contents and
names of all files and dirs, and x perm of files;
but excludes history, timestamps, ownerhisp, and inode numbers.
That would be approximately like the slow method:
'find | egrep -v '/\.git(/|$)' | sort | Xcpio -o | sha1sum -'
(imagining Xcpio that does not archive any ownership, timestamps,
and inode numbers). Can I obtain this result immediately from git ?
Yakov
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sha1 of the repo excluding history ?
2007-04-12 23:26 sha1 of the repo excluding history ? Yakov Lerner
@ 2007-04-12 23:40 ` Shawn O. Pearce
2007-04-13 0:24 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Shawn O. Pearce @ 2007-04-12 23:40 UTC (permalink / raw)
To: Yakov Lerner; +Cc: Git Mailing List
Yakov Lerner <iler.ml@gmail.com> wrote:
> Can I obtain from git the sha1 of the total last state of the
> repo excluding history ? This is a state that covers contents and
> names of all files and dirs, and x perm of files;
> but excludes history, timestamps, ownerhisp, and inode numbers.
>
> That would be approximately like the slow method:
> 'find | egrep -v '/\.git(/|$)' | sort | Xcpio -o | sha1sum -'
> (imagining Xcpio that does not archive any ownership, timestamps,
> and inode numbers). Can I obtain this result immediately from git ?
git rev-parse HEAD^{tree}
The trick here is ^{tree}; this operator takes a commit-ish (commit
or tag) and returns the SHA-1 of the tree that the commit-ish
points at. That SHA-1 is the SHA-1 of the file contents, names,
and executable bits, but nothing else. No history.
I use it sometimes after a rebase when I reorganize history:
old=`git rev-parse HEAD^{tree}`
.... do rebasing magick ...
test $old = `git rev-parse HEAD^{tree}` && echo GOOD
If I don't get back GOOD then I know I somehow changed the files in
a way that isn't what I had before, and that wasn't what I wanted
if all I was doing was cleaning up commit messages.
--
Shawn.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sha1 of the repo excluding history ?
2007-04-12 23:26 sha1 of the repo excluding history ? Yakov Lerner
2007-04-12 23:40 ` Shawn O. Pearce
@ 2007-04-13 0:24 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-04-13 0:24 UTC (permalink / raw)
To: Yakov Lerner; +Cc: Git Mailing List
"Yakov Lerner" <iler.ml@gmail.com> writes:
> Can I obtain from git the sha1 of the total last state of the
> repo excluding history ? This is a state that covers contents and
> names of all files and dirs, and x perm of files;
> but excludes history, timestamps, ownerhisp, and inode numbers.
>
> That would be approximately like the slow method:
> 'find | egrep -v '/\.git(/|$)' | sort | Xcpio -o | sha1sum -'
> (imagining Xcpio that does not archive any ownership, timestamps,
> and inode numbers). Can I obtain this result immediately from git ?
>
> Yakov
I think you are talking about tree object name. git-cat-file
commit HEAD and look at "tree xxx" line.
You can use "git tar-tree $tree_object_name" to tar it up,
and "git ls-tree -r $tree_object_name" to list all the blob
object names with their perms.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-13 0:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-12 23:26 sha1 of the repo excluding history ? Yakov Lerner
2007-04-12 23:40 ` Shawn O. Pearce
2007-04-13 0:24 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).