git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git replace woes: dirty stat with clean workdir
@ 2009-11-10 16:21 Michael J Gruber
  2009-11-10 23:33 ` Christian Couder
  0 siblings, 1 reply; 2+ messages in thread
From: Michael J Gruber @ 2009-11-10 16:21 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Christian Couder

Hi there,

when cooking up a "warning example" for git replace (don't draw
premature conclusions when there are replaced objects) I came across the
following problem: git status seems to compare the work dir with the
tree of HEAD, not the replacing tree. Even deleting the index does not help.

[ The example also shows that we need a way to specify
--no-replace-objects for gitk. Would easier if gitk really where git
something. ]

Michael

#!/bin/sh
rm -Rf rtest &&
mkdir rtest &&
cd rtest &&
git init &&
echo > comment &&
git add comment &&
git commit -m "empty comment" &&
echo nice > "comment" &&
git commit -am "nice comment" &&
echo ugly > "comment" &&
git commit -am "to be discarded" &&
git replace HEAD^^{tree} HEAD^{tree} &&
git reset --hard HEAD^ &&
git log -p &&
git st

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: git replace woes: dirty stat with clean workdir
  2009-11-10 16:21 git replace woes: dirty stat with clean workdir Michael J Gruber
@ 2009-11-10 23:33 ` Christian Couder
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Couder @ 2009-11-10 23:33 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: Git Mailing List

Hi,

On mardi 10 novembre 2009, Michael J Gruber wrote:
> Hi there,
>
> when cooking up a "warning example" for git replace (don't draw
> premature conclusions when there are replaced objects) I came across the
> following problem: git status seems to compare the work dir with the
> tree of HEAD, not the replacing tree. Even deleting the index does not
> help.

Yeah, you are right. I must say that I never tested replacing trees before.

> [ The example also shows that we need a way to specify
> --no-replace-objects for gitk. Would easier if gitk really where git
> something. ]

Yeah, I think --no-replace-objects might not work well for shell scripts or 
even commands that call other commands using run_command(). Perhaps we need 
an environment variable GIT_NO_REPLACE_OBJECTS to be set by commands that 
are passed --no-replace-objects and checked by all the commands. I will 
have a look at that.

Thanks,
Christian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-10 23:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 16:21 git replace woes: dirty stat with clean workdir Michael J Gruber
2009-11-10 23:33 ` Christian Couder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).