git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] log: Do not decorate replacements with --no-replace-objects
@ 2011-08-25 13:44 Michael J Gruber
  2011-08-25 13:55 ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 5+ messages in thread
From: Michael J Gruber @ 2011-08-25 13:44 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy, Junio C Hamano

5267d29 (log: decorate "replaced" on to replaced commits, 2011-08-19)
introduced textual decorations for replaced commits, based on the
detection of refs/replace.

Make it so that additionally the use of --no-replace-objects is
detected: I.e. replaced commits are only decorated as replaced when they
are actually replaced.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Sorry for being late to the party. Trying to keep up.
---
 log-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 74fc20d..2066bb7 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
 	struct object *obj;
 	enum decoration_type type = DECORATION_NONE;
 
-	if (!prefixcmp(refname, "refs/replace/")) {
+	if (read_replace_refs && !prefixcmp(refname, "refs/replace/")) {
 		unsigned char original_sha1[20];
 		if (get_sha1_hex(refname + 13, original_sha1)) {
 			warning("invalid replace ref %s", refname);
-- 
1.7.6.845.gc3c05

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

* Re: [PATCH] log: Do not decorate replacements with --no-replace-objects
  2011-08-25 13:44 [PATCH] log: Do not decorate replacements with --no-replace-objects Michael J Gruber
@ 2011-08-25 13:55 ` Nguyen Thai Ngoc Duy
  2011-08-25 15:08   ` Michael J Gruber
  0 siblings, 1 reply; 5+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-08-25 13:55 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git, Junio C Hamano

2011/8/25 Michael J Gruber <git@drmicha.warpmail.net>:
> Make it so that additionally the use of --no-replace-objects is
> detected: I.e. replaced commits are only decorated as replaced when they
> are actually replaced.

Yeah.. I forgot about this.

> @@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
>        struct object *obj;
>        enum decoration_type type = DECORATION_NONE;
>
> -       if (!prefixcmp(refname, "refs/replace/")) {
> +       if (read_replace_refs && !prefixcmp(refname, "refs/replace/")) {
>                unsigned char original_sha1[20];
>                if (get_sha1_hex(refname + 13, original_sha1)) {
>                        warning("invalid replace ref %s", refname);

You should put "if (!read_replace_refs) return 0;" inside "if
(!prefixcmp..", otherwise it'll come to the ref decoration code below
and my second paragraph in 5267d29's commit message will be reverted.

I thought my patch was
 - simple
 - replace is rarely used
therefore neglected the tests. Perhaps you can also add a few tests
here. It's not that simple after all.
-- 
Duy

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

* Re: [PATCH] log: Do not decorate replacements with --no-replace-objects
  2011-08-25 13:55 ` Nguyen Thai Ngoc Duy
@ 2011-08-25 15:08   ` Michael J Gruber
  2011-08-25 15:09     ` [PATCHv2] " Michael J Gruber
  0 siblings, 1 reply; 5+ messages in thread
From: Michael J Gruber @ 2011-08-25 15:08 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: git, Junio C Hamano

Nguyen Thai Ngoc Duy venit, vidit, dixit 25.08.2011 15:55:
> 2011/8/25 Michael J Gruber <git@drmicha.warpmail.net>:
>> Make it so that additionally the use of --no-replace-objects is
>> detected: I.e. replaced commits are only decorated as replaced when they
>> are actually replaced.
> 
> Yeah.. I forgot about this.
> 
>> @@ -95,7 +95,7 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
>>        struct object *obj;
>>        enum decoration_type type = DECORATION_NONE;
>>
>> -       if (!prefixcmp(refname, "refs/replace/")) {
>> +       if (read_replace_refs && !prefixcmp(refname, "refs/replace/")) {
>>                unsigned char original_sha1[20];
>>                if (get_sha1_hex(refname + 13, original_sha1)) {
>>                        warning("invalid replace ref %s", refname);
> 
> You should put "if (!read_replace_refs) return 0;" inside "if
> (!prefixcmp..", otherwise it'll come to the ref decoration code below
> and my second paragraph in 5267d29's commit message will be reverted.

Right, thanks for checking.

> I thought my patch was
>  - simple
>  - replace is rarely used
> therefore neglected the tests. Perhaps you can also add a few tests
> here. It's not that simple after all.

It would take a bit to do so, but this is a fix to a recently introduced
feature, so it should go along quickly. v2 upcoming.

Michael

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

* [PATCHv2] log: Do not decorate replacements with --no-replace-objects
  2011-08-25 15:08   ` Michael J Gruber
@ 2011-08-25 15:09     ` Michael J Gruber
  2011-08-25 21:22       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Michael J Gruber @ 2011-08-25 15:09 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy, Junio C Hamano

5267d29 (log: decorate "replaced" on to replaced commits, 2011-08-19)
introduced textual decorations for replaced commits, based on the
detection of refs/replace.

Make it so that additionally the use of --no-replace-objects is
detected: I.e. replaced commits are only decorated as replaced when they
are actually replaced.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Sorry for being late to the party. Trying to keep up.
---
 log-tree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/log-tree.c b/log-tree.c
index 74fc20d..f65f6b6 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -96,6 +96,8 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
 	enum decoration_type type = DECORATION_NONE;
 
 	if (!prefixcmp(refname, "refs/replace/")) {
+		if (!read_replace_refs)
+			return 0;
 		unsigned char original_sha1[20];
 		if (get_sha1_hex(refname + 13, original_sha1)) {
 			warning("invalid replace ref %s", refname);
-- 
1.7.6.845.gc3c05

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

* Re: [PATCHv2] log: Do not decorate replacements with --no-replace-objects
  2011-08-25 15:09     ` [PATCHv2] " Michael J Gruber
@ 2011-08-25 21:22       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2011-08-25 21:22 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git, Nguyễn Thái Ngọc Duy

Thanks, both. Will apply.

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

end of thread, other threads:[~2011-08-25 21:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25 13:44 [PATCH] log: Do not decorate replacements with --no-replace-objects Michael J Gruber
2011-08-25 13:55 ` Nguyen Thai Ngoc Duy
2011-08-25 15:08   ` Michael J Gruber
2011-08-25 15:09     ` [PATCHv2] " Michael J Gruber
2011-08-25 21:22       ` Junio C Hamano

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).