Re: [PATCH v2 1/3] diff-files --raw: handle intent-to-add files correctly
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 24, 2020, 13:26 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2006241517320.54@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqqzh8t9vf5.fsf@gitster.c.googlers.com>
Hi Junio,
On Tue, 23 Jun 2020, Junio C Hamano wrote:
Show 20 quoted lines
> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > 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.Sure, but my intention was to synchronize the `--raw` vs the `--patch` output: the latter _already_ shows the correct hash. This here patch makes the hash in the former's output match the latter's.
Besides, we're talking about the post-image of `diff-files`, i.e. the worktree version, here. I seem to remember that the pre-image already uses the all-zero hash to indicate precisely what you mentioned above.
Ciao, Dscho
Show 5 quoted lines
> 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. > >