From: Junio C Hamano Date: Wed, 24 Jun 2020 00:09:18 GMT Subject: Re: [PATCH v2 1/3] diff-files --raw: handle intent-to-add files correctly Message-ID: In-Reply-To: <640e225550886727594ca9dfaee6c9e6ea4b1014.1592916485.git.gitgitgadget@gmail.com> "Johannes Schindelin via GitGitGadget" writes: > From: Johannes Schindelin > > In `run_diff_files()`, files that have been staged with the intention to > add are queued without a valid OID in the `diff_filepair`. > > When the output mode is, say, `DIFF_FORMAT_PATCH`, the > `diff_fill_oid_info()` function, called from `run_diff()`, will remedy > that situation by reading the file contents from disk. The above is true. What do we do for a path that is actually added to the index but is stat-dirty or actually modified in the working tree when we are giving the raw output? Don't we give 0{40} to mean "we dunno---you go look at the working tree"? I think we should do the same for i-t-a file wrt the object name. In both cases, the index does not know what the actual object name is, and we do not want to run the index_path() and write out a new object in the object database. Using the status letter 'A' would also be appropriate, as we would show "new file ..." in the --patch output in this case, which would be consistent.