All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
Cc: Laurent Arnoud <laurent@spkdev.net>,
	phillip.wood@dunelm.org.uk,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	git@vger.kernel.org
Subject: Re: [PATCH v5] diff: add config option relative
Date: Mon, 18 May 2020 10:03:45 -0700	[thread overview]
Message-ID: <xmqqzha541la.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200518135656.GB1980@danh.dev> (=?utf-8?B?IsSQb8OgbiBUcg==?= =?utf-8?B?4bqnbiBDw7RuZw==?= Danh"'s message of "Mon, 18 May 2020 20:56:56 +0700")

Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:

>> @@ -4558,6 +4563,8 @@ void repo_diff_setup(struct repository *r, struct diff_options *options)
>>  		options->b_prefix = "b/";
>>  	}
>> 
>> +	options->flags.relative_name = diff_relative;
>> +
>
> Nitpick:
>
> I don't think this option is too special to add a newline to separate
> it from the rest :)
>
> Sorry about not seeing this earlier, I'm a very careless person.
>
> Anyway, I think (just a matter of my _personal_ preference),
> it's better to move it up 21 lines, together with:
>
> 	options->flags.rename_empty = 1;

Sounds like a reasonable improvement of readability.

>> diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
>> index 258808708e..ac264ccc2a 100755
>> --- a/t/t4045-diff-relative.sh
>> +++ b/t/t4045-diff-relative.sh
>> @@ -8,7 +8,8 @@ test_expect_success 'setup' '
>>  	echo content >file1 &&
>>  	mkdir subdir &&
>>  	echo other content >subdir/file2 &&
>> -	blob=$(git hash-object subdir/file2) &&
>> +	blob_file1=$(git hash-object file1) &&
>> +	blob_file2=$(git hash-object subdir/file2) &&
>
> This rename from blob to blob_file2 is a noise to this patch.
>
> Not sure if we should make a preparatory patch to rename, though.

I personally do not mind this one.  It is crystal clear from the
patch text: "We used to use only one and managed to get away without
blob1/blob2 but now we use more than 1, so let's use names with
number suffix".  On the other hand, a "preparatory patch" that
renames blob to blob_file1 before we need the second one is a noise.

> *I* would say yes, and another patch to move all git-related code
> into test_expect_* family. Then, all new testing code for git in this
> patch should be placed inside test_expect_*, too.

The latter clean-up to make sure we won't notice Git failure outside
test_expect_* block may make sense, but I do not know if we want to
make it a preparatory clean-up or "remember to do so later when the
dust settles".  If this single-patch topic needs to touch only a
small part of the existing test to do its job, and such a clean-up
ends up touching far wider parts of the script, then I would say we
can do so as a post-patch clean-up, not as a part of the topic.

>
> I think it's better to wait for other's opinions :)
>
>> @@ -86,4 +87,80 @@ do
>>  	check_$type . dir/file2 --relative=sub
>>  done
>> 
>> +	diff --git a/$expect b/$expect
>> +	new file mode 100644
>> +	index 0000000..$short_blob_file2
>> +	--- /dev/null
>> +	+++ b/$expect
>> +	@@ -0,0 +1 @@
>> +	+other content
>> +	EOF
>> +	test_expect_success "config diff.relative $relative_opt -p $*" "
>> +		test_config -C $dir diff.relative $relative_opt &&
>> +		git -C '$dir' diff -p $* HEAD^ >actual &&
>> +		git -C '$dir' diff -p $* HEAD^ >/tmp/actual &&
>
> Please this leftover from debugging.

Thanks for a careful review, again.

  parent reply	other threads:[~2020-05-18 17:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 15:57 [PATCH] diff: add config option relative Laurent Arnoud
2020-05-15 22:22 ` Philip Oakley
2020-05-16 17:30   ` Laurent Arnoud
2020-05-15 23:31 ` brian m. carlson
2020-05-16  0:04   ` Junio C Hamano
2020-05-16 17:35     ` Laurent Arnoud
2020-05-16 17:38     ` [PATCH v3] " Laurent Arnoud
2020-05-16 18:33       ` Phillip Wood
2020-05-16 19:40         ` [PATCH v4] " Laurent Arnoud
2020-05-17  2:14           ` Đoàn Trần Công Danh
2020-05-17  2:48             ` Danh Doan
2020-05-17 15:12             ` Junio C Hamano
2020-05-18  9:40               ` [PATCH v5] " Laurent Arnoud
2020-05-18 11:46                 ` Shourya Shukla
2020-05-18 13:04                   ` Đoàn Trần Công Danh
2020-05-18 17:25                   ` Laurent Arnoud
2020-05-18 13:56                 ` Đoàn Trần Công Danh
2020-05-18 16:57                   ` Junio C Hamano
2020-05-18 19:12                     ` Đoàn Trần Công Danh
2020-05-18 20:37                       ` Junio C Hamano
2020-05-19  0:30                         ` Đoàn Trần Công Danh
2020-05-19 18:00                           ` Junio C Hamano
2020-05-19 19:39                             ` [PATCH v7] " Laurent Arnoud
2020-05-19 23:01                               ` Đoàn Trần Công Danh
2020-05-22 10:46                                 ` [PATCH v8] " Laurent Arnoud
2020-05-23  2:14                                   ` Đoàn Trần Công Danh
2020-05-22 10:48                                 ` [PATCH v7] " Laurent Arnoud
2020-05-18 17:03                   ` Junio C Hamano [this message]
2020-05-18 17:21                     ` [PATCH v6] " Laurent Arnoud
2020-05-18 17:31                       ` Junio C Hamano
2020-05-18 17:33                         ` Junio C Hamano
2020-05-18 17:34                       ` Eric Sunshine
2020-05-18 19:19                       ` Đoàn Trần Công Danh
2020-05-18 20:02                         ` Junio C Hamano
2020-05-18 17:32                   ` [PATCH v5] " Laurent Arnoud
2020-05-18 16:19                 ` Eric Sunshine
2020-05-18 17:26                   ` Laurent Arnoud
2020-05-18  9:43             ` [PATCH v4] " Laurent Arnoud
2020-05-17 15:07         ` [PATCH v3] " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzha541la.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=laurent@spkdev.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.