git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Quick question: how to generate a patch?

From
Linus Torvalds <torvalds@osdl.org>
Date
Feb 27, 2006, 17:19 UTC
Message-ID
<Pine.LNX.4.64.0602270909500.22647@g5.osdl.org>
In-Reply-To
<6d6a94c50602270902k2c06aaffw7e70268b0753ef64@mail.gmail.com>
On Tue, 28 Feb 2006, Aubrey wrote:
Show 6 quoted lines
> 
> =================================================================
> aubrey@linux:/checkout/uboot/patch/work/drivers> git diff
> ----snip----
> diff --git a/drivers/sk98lin/skxmac2.c b/drivers/sk98lin/skxmac2.c
> diff --git a/drivers/sk98lin/u-boot_compat.h b/drivers/sk98lin/u-boot_compat.h

Ok, this is _definitely_ your index being out of touch with your file contents.

Run "git-update-index --refresh" and it should be ok.

Now the question is why the index got out-of-kilter with the file contents in the first place. I used to have all these debug aids to show why git thought a file had changed, but we've not had any bugs here for a long long time, so..

The final checkout of the "git clone" should have made sure that the index is up-to-date.

Show 15 quoted lines
> >         git clone remote-repo localdir
> >         cd localdir
> >         vi somefile
> >         git diff
>
> Yes, exactly right.
> 
> > then you did everything right, and if it gives any diff other than your
> > changes to "somefile", something is buggy. Need more info.
> >
> > Does "git diff" and "git diff HEAD" give different results, btw?
> 
> Yes. the two commands give the same results.
> 
> I'm using git-1.2.3
What OS/filesystem? 

The way the index keeps track of files that haven't changed is by checking the size, the mtime and the ctime of the inode. It also checks the user/gid and inode number. If you use a filesystem where those might change (networked?), that might cause this..

		Linus
Previous: Aubrey
Message 13 of 13 in “Quick question: how to generate a patch?”
  1. AubreyFeb 27, 2006
  2. Andreas EricssonFeb 27, 2006
  3. Linus TorvaldsFeb 27, 2006
  4. AubreyFeb 27, 2006
  5. Linus TorvaldsFeb 27, 2006
  6. AubreyFeb 27, 2006
  7. Andreas EricssonFeb 27, 2006
  8. AubreyFeb 27, 2006
  9. Linus TorvaldsFeb 27, 2006
  10. AubreyFeb 28, 2006
  11. Linus TorvaldsFeb 28, 2006
  12. AubreyFeb 28, 2006
  13. Linus TorvaldsFeb 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.