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

Re: [RFC][PATCH] Re: git-rm isn't the inverse action of git-add

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Jul 9, 2007, 09:45 UTC
Message-ID
<vpqsl7xkj0j.fsf@bauges.imag.fr>
In-Reply-To
<Pine.LNX.4.64.0707082240510.4248@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 12 quoted lines
> Hi,
>
> On Sun, 8 Jul 2007, Matthieu Moy wrote:
>
>> I'm not sure whether this is really wrong. The things git should
>> really care about are the index and the repository itself, and the
>> proposed behavior is consistant regarding that (either remove all
>> files from the index, or remove none).
>
> Well, I think it is wrong for the same reason as it is wrong to apply the 
> changes to _any_ file when one would fail.  And since "git apply" shares 
> my understanding, I think "git rm" should, too.
OK, let's say I'm convinced ;-).
Show 11 quoted lines
>> > I suspect that this case does never fail. 0 means success for 
>> > remove_file().  Not good.  You should at least have a way to ensure that 
>> > it removed the files from the working tree from a script.  Otherwise there 
>> > is not much point in returning a value to begin with.
>> 
>> I've changed it to have exit_status = 1 if git-rm aborted before
>> starting, and 2 if git-rm skiped some file removals (and of course, 0
>> if everything is done as expected).
>
> Oh, so you do not take the return value of this function to determine if 
> it has or has not done something with the files?  That's a bit confusing.

I did, but previously, I kept the code that "die()"s if the first call to remove_file() "fails". In remove_file_maybe(), not removing a file because it's not sure it's safe to delete it is not a failure, so I had to put a "return 0;" here to avoid the fatal error. My first patch had return status !=0 if we tried to remove the file, and it failed. I changed that.

> I meant to complain about your OP, but this time it is even worse.  The 
> best way to guarantee that a patch gets lost in a thread is to move it _at 
> the end_ of a reply.

I had posted the patch for info, but I did expect this one to get lost, since it's definitely not complete.

I'll post an updated patch with a testcase and an appropriate subject line within a few days (I don't have time right now).

Thanks,
-- 
Matthieu
Previous: Johannes SchindelinNext: Matthieu Moy
Message 18 of 37 in “git-rm isn't the inverse action of git-add”
  1. Christian JaegerJul 2, 2007
  2. Yann DirsonJul 2, 2007
  3. Christian JaegerJul 2, 2007
  4. Yann DirsonJul 2, 2007
  5. Matthieu MoyJul 2, 2007
  6. Johannes SchindelinJul 2, 2007
  7. Matthieu MoyJul 3, 2007
  8. Johannes SchindelinJul 3, 2007
  9. Matthieu MoyJul 3, 2007
  10. Johannes SchindelinJul 3, 2007
  11. Jan HudecJul 4, 2007
  12. Matthieu MoyJul 5, 2007
  13. David KastrupJul 5, 2007
  14. [RFC][PATCH] Re: git-rm isn't the inverse action of git-addMatthieu Moy, Jul 8, 2007
  15. Johannes SchindelinJul 8, 2007
  16. Matthieu MoyJul 8, 2007
  17. Johannes SchindelinJul 8, 2007
  18. Matthieu MoyJul 9, 2007
  19. Matthieu MoyJul 13, 2007
  20. More permissive "git-rm --cached" behavior without -f.Matthieu Moy, Jul 13, 2007
  21. Jeff KingJul 13, 2007
  22. Matthieu MoyJul 13, 2007
  23. Jeff KingJul 14, 2007
  24. Jakub NarebskiJul 14, 2007
  25. Junio C HamanoJul 14, 2007
  26. Junio C HamanoJul 14, 2007
  27. Matthieu MoyJul 14, 2007
  28. Christian JaegerJul 2, 2007
  29. Jeff KingJul 3, 2007
  30. Junio C HamanoJul 3, 2007
  31. Jeff KingJul 3, 2007
  32. Junio C HamanoJul 3, 2007
  33. Jeff KingJul 3, 2007
  34. Junio C HamanoJul 3, 2007
  35. Jakub NarebskiJul 11, 2007
  36. Jan HudecJul 11, 2007
  37. Junio C HamanoJul 11, 2007

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.