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

Re: [PATCH v2] doc: make clear --assume-unchanged's user contract

From
Sérgio Basto <sergio@serjux.com>
Date
Dec 9, 2014, 03:43 UTC
Message-ID
<1418096636.19104.31.camel@segulix>
In-Reply-To
<1417878270-4364-2-git-send-email-philipoakley@iee.org>
On Sáb, 2014-12-06 at 15:04 +0000, Philip Oakley wrote: 
Show 59 quoted lines
> Many users misunderstand the --assume-unchanged contract, believing
> it means Git won't look at the flagged file.
> 
> Be explicit that the --assume-unchanged contract is by the user that
> they will NOT change the file so that Git does not need to look (and
> expend, for example, lstat(2) cycles)
> 
> Mentioning "Git stops checking" does not help the reader, as it is
> only one possible consequence of what that assumption allows Git to
> do, but
> 
>    (1) there are things other than "stop checking" that Git can do
>        based on that assumption; and
>    (2) Git is not obliged to stop checking; it merely is allowed to.
> 
> Also, this is a single flag bit, correct the plural to singular, and
> the verb, accordingly.
> 
> Drop the stale and incorrect information about "poor-man's ignore",
> which is not what this flag bit is about at all.
> 
> Signed-off-by: Philip Oakley <philipoakley@iee.org>
> ---
>  Documentation/git-update-index.txt | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
> index e0a8702..da1ccbc 100644
> --- a/Documentation/git-update-index.txt
> +++ b/Documentation/git-update-index.txt
> @@ -78,20 +78,18 @@ OPTIONS
>          Set the execute permissions on the updated files.
>  
>  --[no-]assume-unchanged::
> -	When these flags are specified, the object names recorded
> -	for the paths are not updated.  Instead, these options
> -	set and unset the "assume unchanged" bit for the
> -	paths.  When the "assume unchanged" bit is on, Git stops
> -	checking the working tree files for possible
> -	modifications, so you need to manually unset the bit to
> -	tell Git when you change the working tree file. This is
> +	When this flag is specified, the object names recorded
> +	for the paths are not updated.  Instead, this option
> +	sets/unsets the "assume unchanged" bit for the
> +	paths.  When the "assume unchanged" bit is on, the user
> +	promises not to change the file and allows Git to assume
> +	that the working tree file matches what is recorded in
> +	the index.  If you want to change the working tree file,
> +	you need to unset the bit to tell Git.  This is
>  	sometimes helpful when working with a big project on a
>  	filesystem that has very slow lstat(2) system call
>  	(e.g. cifs).
>  +
> -This option can be also used as a coarse file-level mechanism
> -to ignore uncommitted changes in tracked files (akin to what
> -`.gitignore` does for untracked files).
>  Git will fail (gracefully) in case it needs to modify this file
>  in the index e.g. when merging in a commit;
>  thus, in case the assumed-untracked file is changed upstream,

I don't understand why you insist that we have a contract, when : "git diff .", "git diff -a" and "git commit -a" have a different behavior of "git commit ." , this is not about any contract this is about coherency and be user friendly .

At least if you want keep things like that, wrote in doc, clearly, that assume-unchanged flag *is not*, to git ignoring changes in tracked files and currently not ignore files for git commit <path> and may not work in other cases .

Also don't understand why --assumed-untracked shouldn't deal with changed files instead fallback in "the user promises not to change the file" and sometimes works others not.

Also if this is the contract when a file is different from commit, should warning the user that is not in contract (modify files that are assumed-untracked )

Thanks, 
-- 
Sérgio M. B.
Previous: Philip OakleyNext: Philip Oakley
Message 3 of 11 in “Improve --assume-unchanged in the git update-index man page”
  1. Improve --assume-unchanged in the git update-index man pagePhilip Oakley, Dec 6, 2014
  2. doc: make clear --assume-unchanged's user contractPhilip Oakley, Dec 6, 2014
  3. Sérgio BastoDec 9, 2014
  4. Philip OakleyDec 9, 2014
  5. Philip OakleyDec 9, 2014
  6. Michael J GruberDec 9, 2014
  7. gitignore.txt: do not suggest assume-unchangedMichael J Gruber, Dec 9, 2014
  8. Jonathan NiederDec 10, 2014
  9. Michael J GruberDec 11, 2014
  10. Junio C HamanoDec 10, 2014
  11. Sérgio BastoDec 10, 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.