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

Re: [BUG] rebase --interactive silently overwrites ignored files

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
May 7, 2019, 14:03 UTC
Message-ID
<76bb6944-d448-66b9-dd4e-ed3e262e9a96@gmail.com>
In-Reply-To
<xmqq4l69tupt.fsf@gitster-ct.c.googlers.com>
Hi Junio
On 05/05/2019 05:02, Junio C Hamano wrote:
Show 15 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> I've had a look at the rebase -i code and I think it only overwrites
>> ignored files when it is fast-forwarding. This matches what merge does
>> when fast-forwarding but I'm not convinced either of them should be
>> doing this by default (I think checkout doing it is probably asking
>> for trouble)...
> 
>> I'll put a patch together to fix rebase -i, I'd like to see the
>> defaults for merge and checkout changed but I'm not sure that would be
>> popular.
> 
> I suspect that such a change in behaviour for "rebase -i" is not a
> fix but a regression.  Shouldn't it be consistent with checkout and
> merge?

My problem is that I don't really understand why some operations should overwrite ignored files and others shouldn't. Having nearly all rebase operations preserve ignored files and only overwriting them for a fast-forward seems confusing and probably surprising to users. Is it a bug that pull does not overwrite ignored files when fast-forwarding but merge does? Why is it ok to overwrite ignored files when merge fast-forwards but not otherwise?

Show 8 quoted lines
>> It does seem like surprising behavior though when most
>> operations try to preserve untracked files.
> 
> Are you conflating untracked and ignored?
> 
> Because we haven't adopted 'precious' (or whatever the final name
> would be), which is "ignored but not expendable", ignored files are
> by definition "ignored and expendable".  

My confusion is that they are only "ignored and expendable" in certain circumstances. Many git operations actually fail if they are going to overwrite an ignored file [1] - I don't understand if that is intentional or not.

Best Wishes
Phillip

[1] https://public-inbox.org/git/CAL_tzDFQQtDYMStN+RDVYN_TzJmO+kufMhG9PGHwvsUWREpgWQ@mail.gmail.com/

Show 7 quoted lines
> When checkout (and merge
> that is its more general form) needs to match the working tree to
> the index contents and an ingored file is in the way, it should
> overwrite it.
> 
> Until we introduce "ignored but not expendable" class, that is.
> 
Previous: Junio C Hamano
Message 8 of 8 in “[BUG] rebase --interactive silently overwrites ignored files”
  1. whApr 11, 2019
  2. Phillip WoodApr 12, 2019
  3. whApr 14, 2019
  4. Phillip WoodApr 14, 2019
  5. Phillip WoodMay 2, 2019
  6. Duy NguyenMay 2, 2019
  7. Junio C HamanoMay 5, 2019
  8. Phillip WoodMay 7, 2019

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.