{"thread":{"id":"29479","subject":"How often does git calculate SHAs?","startedAt":"2012-01-30T14:25:40Z","lastAt":"2012-01-30T14:59:55Z","messageCount":2,"participants":["Michael Cook","Shawn Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"183327","messageId":"4F26A864.1080702@bbn.com","threadId":"29479","inReplyTo":null,"subject":"How often does git calculate SHAs?","fromName":"Michael Cook","fromEmail":"mcook@bbn.com","sentAt":"2012-01-30T14:25:40Z","receivedAt":"2012-01-30T14:25:40Z","isPatch":false,"sender":{"key":"mcook@bbn.com","avatar":null},"body":"How often does git actually calculate a file's SHA?\n\n`strace git status` shows that git stat'ed many files, but opened only a \nfew. So I assume git has some heuristicsbased on the stat infofor when \nto recalculate the SHAs.\n\nAny pointers to how I could have figured this out myself from looking at \nthe source code would be appreciated. Google wasn't helpful.\n\nMichael\n\n-- \nMichael Cook, Raytheon BBN Technologies, www.bbn.com\n"},{"id":"183328","messageId":"CAJo=hJtEPTPTwdoFaoZH4OBpfnCR3VDUNGdNtCprmPf=13xrdQ@mail.gmail.com","threadId":"29479","inReplyTo":"4F26A864.1080702@bbn.com","subject":"Re: How often does git calculate SHAs?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2012-01-30T14:59:55Z","receivedAt":"2012-01-30T14:59:55Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"On Mon, Jan 30, 2012 at 06:25, Michael Cook <mcook@bbn.com> wrote:\n> How often does git actually calculate a file's SHA?\n>\n> `strace git status` shows that git stat'ed many files, but opened only a\n> few. So I assume git has some heuristicsbased on the stat infofor when to\n> recalculate the SHAs.\n>\n> Any pointers to how I could have figured this out myself from looking at the\n> source code would be appreciated. Google wasn't helpful.\n\nDuring `git status` Git performs an lstat() of every file in the\nworking tree. If the file matches stat structure data with the cache\nheld in .git/index, Git assumes the file is unmodified.\n\nThings Git are looking for is usually size, mtime, inode number,\ncreation time, etc.\n"}]}