# [PATCH v3] gitk: add --no-replace-objects option

5 messages from 2009-11-20 to 2009-11-20. Participants: Christian Couder, Junio C Hamano.
Thread: https://gitlist.dev/t/21692

## Christian Couder, 2009-11-20 19:40

Subject: [PATCH v3] gitk: add --no-replace-objects option
Message-ID: <20091120194046.4469.53971.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20091120194046.4469.53971.chriscool%40tuxfamily.org

```
This option simply sets the GIT_NO_REPLACE_OBJECTS environment
variable, and that is enough to make gitk ignore replace refs.

The GIT_NO_REPLACE_OBJECTS is set to "1" instead of "" as it is
safer on some platforms, thanks to Johannes Sixt and Michael J
Gruber.

Replace refs are useful to change some git objects after they
have started to be shared between different repositories. One
might want to ignore them to see the original state.

Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 gitk-git/gitk |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index a0214b7..c586b93 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -128,7 +128,7 @@ proc unmerged_files {files} {
 }
 
 proc parseviewargs {n arglist} {
-    global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs
+    global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
 
     set vdatemode($n) 0
     set vmergeonly($n) 0
@@ -208,6 +208,9 @@ proc parseviewargs {n arglist} {
 		# git rev-parse doesn't understand --merge
 		lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD
 	    }
+	    "--no-replace-objects" {
+		set env(GIT_NO_REPLACE_OBJECTS) "1"
+	    }
 	    "-*" {
 		# Other flag arguments including -<n>
 		if {[string is digit -strict [string range $arg 1 end]]} {
-- 
1.6.5.1.gaf97d

```

## Junio C Hamano, 2009-11-20 20:04

Subject: Re: [PATCH v3] gitk: add --no-replace-objects option
Message-ID: <7vocmxvu7c.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vocmxvu7c.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20091120194046.4469.53971.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

> This option simply sets the GIT_NO_REPLACE_OBJECTS environment
> variable, and that is enough to make gitk ignore replace refs.

This is a much less interesting implementation detail than everything else
you should talk about the new feature you are adding; why is it the first
sentence of the message?

> The GIT_NO_REPLACE_OBJECTS is set to "1" instead of "" as it is
> safer on some platforms, thanks to Johannes Sixt and Michael J
> Gruber.

And this is even less interesting.

> Replace refs are useful to change some git objects after they
> have started to be shared between different repositories. One
> might want to ignore them to see the original state.

This is what the reader needs to see to understand why this patch is
worthy of consideration.  It is a minor offense that the paragraph does
not end with "... original state, and --no-replace-objects option can be
used from the command line to do so", but this could be excused if this is
made the first paragraph in the message, close to the subject.

I wonder if this switch deserves run-time flippability, though...

> Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  gitk-git/gitk |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index a0214b7..c586b93 100644
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -128,7 +128,7 @@ proc unmerged_files {files} {
>  }
>  
>  proc parseviewargs {n arglist} {
> -    global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs
> +    global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
>  
>      set vdatemode($n) 0
>      set vmergeonly($n) 0
> @@ -208,6 +208,9 @@ proc parseviewargs {n arglist} {
>  		# git rev-parse doesn't understand --merge
>  		lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD
>  	    }
> +	    "--no-replace-objects" {
> +		set env(GIT_NO_REPLACE_OBJECTS) "1"
> +	    }
>  	    "-*" {
>  		# Other flag arguments including -<n>
>  		if {[string is digit -strict [string range $arg 1 end]]} {
> -- 
> 1.6.5.1.gaf97d

```

## Christian Couder, 2009-11-20 20:42

Subject: Re: [PATCH v3] gitk: add --no-replace-objects option
Message-ID: <200911202142.39520.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200911202142.39520.chriscool%40tuxfamily.org
In-Reply-To: <7vocmxvu7c.fsf@alter.siamese.dyndns.org>

```
On vendredi 20 novembre 2009, Junio C Hamano wrote:
> Christian Couder <chriscool@tuxfamily.org> writes:
> > This option simply sets the GIT_NO_REPLACE_OBJECTS environment
> > variable, and that is enough to make gitk ignore replace refs.
>
> This is a much less interesting implementation detail than everything
> else you should talk about the new feature you are adding; why is it the
> first sentence of the message?

This patch was previously the second patch in a 2 patch series so the 
previous patch was already explaining some context. Perhaps I should have 
sent the first patch again with this one.

> > The GIT_NO_REPLACE_OBJECTS is set to "1" instead of "" as it is
> > safer on some platforms, thanks to Johannes Sixt and Michael J
> > Gruber.
>
> And this is even less interesting.
>
> > Replace refs are useful to change some git objects after they
> > have started to be shared between different repositories. One
> > might want to ignore them to see the original state.
>
> This is what the reader needs to see to understand why this patch is
> worthy of consideration.  It is a minor offense that the paragraph does
> not end with "... original state, and --no-replace-objects option can be
> used from the command line to do so", but this could be excused if this
> is made the first paragraph in the message, close to the subject.

Ok, I will send the full series again with these changes.

> I wonder if this switch deserves run-time flippability, though...

The following patch in master added run-time flippability to many commands:

http://git.kernel.org/?p=git/git.git;a=commit;h=b0fa7ab51b29d34579d8f6bb4443dfbcb8278c7a

and Michael J Gruber wrote "we need a way to specify
--no-replace-objects for gitk" in this message:

http://article.gmane.org/gmane.comp.version-control.git/132576/

Best regards,
Christian.

```

## Junio C Hamano, 2009-11-20 20:55

Subject: Re: [PATCH v3] gitk: add --no-replace-objects option
Message-ID: <7v1vjsx6f5.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v1vjsx6f5.fsf%40alter.siamese.dyndns.org
In-Reply-To: <200911202142.39520.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

>> I wonder if this switch deserves run-time flippability, though...
>
> The following patch in master added run-time flippability to many commands:

What I meant was not that.  I was wondering if the user wants to flip from
the gitk GUI without restarting gitk.

```

## Christian Couder, 2009-11-20 21:15

Subject: Re: [PATCH v3] gitk: add --no-replace-objects option
Message-ID: <200911202215.11974.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200911202215.11974.chriscool%40tuxfamily.org
In-Reply-To: <7v1vjsx6f5.fsf@alter.siamese.dyndns.org>

```
On vendredi 20 novembre 2009, Junio C Hamano wrote:
> Christian Couder <chriscool@tuxfamily.org> writes:
> >> I wonder if this switch deserves run-time flippability, though...
> >
> > The following patch in master added run-time flippability to many
> > commands:
>
> What I meant was not that.  I was wondering if the user wants to flip
> from the gitk GUI without restarting gitk.

Ah ok, yes this would be nice. But anyway I think the current patch is a 
first good step.

Thanks,
Christian.

```
