{"thread":{"id":"21570","subject":"git replace woes: dirty stat with clean workdir","startedAt":"2009-11-10T16:21:12Z","lastAt":"2009-11-10T23:33:46Z","messageCount":2,"participants":["Michael J Gruber","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127253","messageId":"4AF992F8.8010309@drmicha.warpmail.net","threadId":"21570","inReplyTo":null,"subject":"git replace woes: dirty stat with clean workdir","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-11-10T16:21:12Z","receivedAt":"2009-11-10T16:21:12Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Hi there,\n\nwhen cooking up a \"warning example\" for git replace (don't draw\npremature conclusions when there are replaced objects) I came across the\nfollowing problem: git status seems to compare the work dir with the\ntree of HEAD, not the replacing tree. Even deleting the index does not help.\n\n[ The example also shows that we need a way to specify\n--no-replace-objects for gitk. Would easier if gitk really where git\nsomething. ]\n\nMichael\n\n#!/bin/sh\nrm -Rf rtest &&\nmkdir rtest &&\ncd rtest &&\ngit init &&\necho > comment &&\ngit add comment &&\ngit commit -m \"empty comment\" &&\necho nice > \"comment\" &&\ngit commit -am \"nice comment\" &&\necho ugly > \"comment\" &&\ngit commit -am \"to be discarded\" &&\ngit replace HEAD^^{tree} HEAD^{tree} &&\ngit reset --hard HEAD^ &&\ngit log -p &&\ngit st\n"},{"id":"127280","messageId":"200911110033.46546.chriscool@tuxfamily.org","threadId":"21570","inReplyTo":"4AF992F8.8010309@drmicha.warpmail.net","subject":"Re: git replace woes: dirty stat with clean workdir","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-11-10T23:33:46Z","receivedAt":"2009-11-10T23:33:46Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn mardi 10 novembre 2009, Michael J Gruber wrote:\n> Hi there,\n>\n> when cooking up a \"warning example\" for git replace (don't draw\n> premature conclusions when there are replaced objects) I came across the\n> following problem: git status seems to compare the work dir with the\n> tree of HEAD, not the replacing tree. Even deleting the index does not\n> help.\n\nYeah, you are right. I must say that I never tested replacing trees before.\n\n> [ The example also shows that we need a way to specify\n> --no-replace-objects for gitk. Would easier if gitk really where git\n> something. ]\n\nYeah, I think --no-replace-objects might not work well for shell scripts or \neven commands that call other commands using run_command(). Perhaps we need \nan environment variable GIT_NO_REPLACE_OBJECTS to be set by commands that \nare passed --no-replace-objects and checked by all the commands. I will \nhave a look at that.\n\nThanks,\nChristian.\n"}]}