git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How often does git calculate SHAs?
@ 2012-01-30 14:25 Michael Cook
  2012-01-30 14:59 ` Shawn Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Cook @ 2012-01-30 14:25 UTC (permalink / raw)
  To: git

How often does git actually calculate a file's SHA?

`strace git status` shows that git stat'ed many files, but opened only a 
few. So I assume git has some heuristicsbased on the stat infofor when 
to recalculate the SHAs.

Any pointers to how I could have figured this out myself from looking at 
the source code would be appreciated. Google wasn't helpful.

Michael

-- 
Michael Cook, Raytheon BBN Technologies, www.bbn.com

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

* Re: How often does git calculate SHAs?
  2012-01-30 14:25 How often does git calculate SHAs? Michael Cook
@ 2012-01-30 14:59 ` Shawn Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn Pearce @ 2012-01-30 14:59 UTC (permalink / raw)
  To: Michael Cook; +Cc: git

On Mon, Jan 30, 2012 at 06:25, Michael Cook <mcook@bbn.com> wrote:
> How often does git actually calculate a file's SHA?
>
> `strace git status` shows that git stat'ed many files, but opened only a
> few. So I assume git has some heuristicsbased on the stat infofor when to
> recalculate the SHAs.
>
> Any pointers to how I could have figured this out myself from looking at the
> source code would be appreciated. Google wasn't helpful.

During `git status` Git performs an lstat() of every file in the
working tree. If the file matches stat structure data with the cache
held in .git/index, Git assumes the file is unmodified.

Things Git are looking for is usually size, mtime, inode number,
creation time, etc.

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

end of thread, other threads:[~2012-01-30 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-30 14:25 How often does git calculate SHAs? Michael Cook
2012-01-30 14:59 ` Shawn Pearce

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).