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

Re: bug report on update-index --assume-unchanged

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 5, 2014, 21:19 UTC
Message-ID
<xmqqbnnhpzgb.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqq1toeq79b.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> If however you did something that made Git notice that you changed
> these paths marked with assume-unchanged bit anyway, then Git will,
> well, notice that they are not "unchanged" as you promised.

By the way, this cuts both ways. I would not bother checking with the current codebase, but I know it used to be that when we have a blob object name and need a temporary file that holds the content for read-only purpose (e.g. passing a pair of files to external diff driver), we allowed Git to reuse files in the working tree whose blob object name we knew. This is of course because it is faster than inflating the blob contents out of the object store and writing a new file.

That codepath is allowed to "borrow" the working tree file as such a temporary file for read-only purpose, when a file is stat-clean (i.e. its contents is known to match the blob object recorded in the index). A file with assume-unchanged bit set is treated exactly the same way, because the user promised not to modify it.

If the user broke the promise, then an external diff driver would have been given a file whose contents does not actually match the wanted blob object, resulting in an incorrect diff output.

Previous: Philip OakleyNext: Sérgio Basto
Message 13 of 19 in “GIT: ignoring changes in tracked files and bug report”
  1. Sérgio BastoDec 4, 2014
  2. bug report on update-index --assume-unchangedSérgio Basto, Dec 5, 2014
  3. Johannes SixtDec 5, 2014
  4. Duy NguyenDec 5, 2014
  5. Sérgio BastoDec 5, 2014
  6. Junio C HamanoDec 5, 2014
  7. Philip OakleyDec 5, 2014
  8. Junio C HamanoDec 5, 2014
  9. Philip OakleyDec 5, 2014
  10. Andreas SchwabDec 5, 2014
  11. Sérgio BastoDec 6, 2014
  12. Philip OakleyDec 6, 2014
  13. Junio C HamanoDec 5, 2014
  14. Sérgio BastoDec 5, 2014
  15. Junio C HamanoDec 5, 2014
  16. Junio C HamanoDec 5, 2014
  17. commit: ignore assume-unchanged files in "commmit <file>" modeNguyễn Thái Ngọc Duy, Dec 5, 2014
  18. Sérgio BastoDec 9, 2014
  19. Philip OakleyDec 11, 2014

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.