threads / patch / 27859

patchgitignore: add top level patch ignore rule

Subject: [PATCH] gitignore: add top level patch ignore rule

## tl;dr

8 messages between Jul 19, 2011 and Jul 22, 2011. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

Vitaliy Ivanov· Jul 19, 2011, 22:17 UTC · lore

Add top level ignore rule for patches created by format-patch command. On the way, reorganize ignore rules and add comments.

Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
---
 .gitignore |   43 ++++++++++++++++++++++++++++++-------------
 1 files changed, 30 insertions(+), 13 deletions(-)
Show changes to .gitignore +30 −13
diff --git a/.gitignore b/.gitignore
index 8572c8c..47afe77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,15 @@
+#
+# NOTE! Don't add files that are generated in specific
+# subdirectories here. Add them in the ".gitignore" file
+# in that subdirectory instead.
+#
+# NOTE! Please use 'git ls-files -i --exclude-standard'
+# command after changing this file, to see if there are
+# any tracked files which get ignored after the change.
+
+#
+# Top-level files
+#
 /GIT-BUILD-OPTIONS
 /GIT-CFLAGS
 /GIT-LDFLAGS
@@ -187,21 +199,10 @@
 /test-svn-fe
 /test-treap
 /common-cmds.h
-*.tar.gz
-*.dsc
-*.deb
 /git.spec
-*.exe
-*.[aos]
-*.py[co]
-.depend/
-*.gcda
-*.gcno
-*.gcov
 /coverage-untested-functions
 /cover_db/
 /cover_db_html/
-*+
 /config.mak
 /autom4te.cache
 /config.cache
@@ -213,6 +214,24 @@
 /tags
 /TAGS
 /cscope*
+/Debug/
+/Release/
+/*.patch
+
+#
+# Normal rules
+#
+*.tar.gz
+*.dsc
+*.deb
+*.exe
+*.[aos]
+*.py[co]
+.depend/
+*.gcda
+*.gcno
+*.gcov
+*+
 *.obj
 *.lib
 *.sln
@@ -222,5 +241,3 @@
 *.user
 *.idb
 *.pdb
-/Debug/
-/Release/
-- 
1.7.4.1
Michael J Gruber· Jul 20, 2011, 08:09 UTC · re: Vitaliy Ivanov · lore

Re: [PATCH] gitignore: add top level patch ignore rule

Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
> Add top level ignore rule for patches created by format-patch command.
Please don't.

The tracked ignore file is for ignoring products and artefacts of our build process. format-patch is not part of this process, and the existence of *.patch files depends on your workflow. But what is much worse: In

git status git format-patch rev-spec git send-email *.patch

it is very easy to send out the wrong patches (along with the right ones), because your patch hides them from status. Also, I can't clean them up with "git clean -f" any more. I would have to use "git clean -f -x" which would clean the build products also (and force a rebuild).

So, your patch makes a format-patch based workflow much worse. What problem does it try to solve?

> On the way, reorganize ignore rules and add comments.
How and why do you reorganize?
Show 79 quoted lines
> 
> Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
> ---
>  .gitignore |   43 ++++++++++++++++++++++++++++++-------------
>  1 files changed, 30 insertions(+), 13 deletions(-)
> 
> diff --git a/.gitignore b/.gitignore
> index 8572c8c..47afe77 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -1,3 +1,15 @@
> +#
> +# NOTE! Don't add files that are generated in specific
> +# subdirectories here. Add them in the ".gitignore" file
> +# in that subdirectory instead.
> +#
> +# NOTE! Please use 'git ls-files -i --exclude-standard'
> +# command after changing this file, to see if there are
> +# any tracked files which get ignored after the change.
> +
> +#
> +# Top-level files
> +#
>  /GIT-BUILD-OPTIONS
>  /GIT-CFLAGS
>  /GIT-LDFLAGS
> @@ -187,21 +199,10 @@
>  /test-svn-fe
>  /test-treap
>  /common-cmds.h
> -*.tar.gz
> -*.dsc
> -*.deb
>  /git.spec
> -*.exe
> -*.[aos]
> -*.py[co]
> -.depend/
> -*.gcda
> -*.gcno
> -*.gcov
>  /coverage-untested-functions
>  /cover_db/
>  /cover_db_html/
> -*+
>  /config.mak
>  /autom4te.cache
>  /config.cache
> @@ -213,6 +214,24 @@
>  /tags
>  /TAGS
>  /cscope*
> +/Debug/
> +/Release/
> +/*.patch
> +
> +#
> +# Normal rules
> +#
> +*.tar.gz
> +*.dsc
> +*.deb
> +*.exe
> +*.[aos]
> +*.py[co]
> +.depend/
> +*.gcda
> +*.gcno
> +*.gcov
> +*+
>  *.obj
>  *.lib
>  *.sln
> @@ -222,5 +241,3 @@
>  *.user
>  *.idb
>  *.pdb
> -/Debug/
> -/Release/
Vitaliy Ivanov· Jul 21, 2011, 12:54 UTC · re: Michael J Gruber · lore

Re: [PATCH] gitignore: add top level patch ignore rule

Michael,

On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber <git@drmicha.warpmail.net> wrote:

Show 21 quoted lines
> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>> Add top level ignore rule for patches created by format-patch command.
>
> Please don't.
>
> The tracked ignore file is for ignoring products and artefacts of our
> build process. format-patch is not part of this process, and the
> existence of *.patch files depends on your workflow. But what is much
> worse: In
>
> git status
> git format-patch rev-spec
> git send-email *.patch
>
> it is very easy to send out the wrong patches (along with the right
> ones), because your patch hides them from status. Also, I can't clean
> them up with "git clean -f" any more. I would have to use "git clean -f
> -x" which would clean the build products also (and force a rebuild).
>
> So, your patch makes a format-patch based workflow much worse. What
> problem does it try to solve?

I will not insist. You may know it better but git as is a public project where anyone can create and send patches. So it seems to me basic workflow for sharing changes.

>
>> On the way, reorganize ignore rules and add comments.
>
> How and why do you reorganize?

Just to be able to find specific rule faster. Global rules are now all together same is for top level root rules.

Show 82 quoted lines
>
>>
>> Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
>> ---
>>  .gitignore |   43 ++++++++++++++++++++++++++++++-------------
>>  1 files changed, 30 insertions(+), 13 deletions(-)
>>
>> diff --git a/.gitignore b/.gitignore
>> index 8572c8c..47afe77 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -1,3 +1,15 @@
>> +#
>> +# NOTE! Don't add files that are generated in specific
>> +# subdirectories here. Add them in the ".gitignore" file
>> +# in that subdirectory instead.
>> +#
>> +# NOTE! Please use 'git ls-files -i --exclude-standard'
>> +# command after changing this file, to see if there are
>> +# any tracked files which get ignored after the change.
>> +
>> +#
>> +# Top-level files
>> +#
>>  /GIT-BUILD-OPTIONS
>>  /GIT-CFLAGS
>>  /GIT-LDFLAGS
>> @@ -187,21 +199,10 @@
>>  /test-svn-fe
>>  /test-treap
>>  /common-cmds.h
>> -*.tar.gz
>> -*.dsc
>> -*.deb
>>  /git.spec
>> -*.exe
>> -*.[aos]
>> -*.py[co]
>> -.depend/
>> -*.gcda
>> -*.gcno
>> -*.gcov
>>  /coverage-untested-functions
>>  /cover_db/
>>  /cover_db_html/
>> -*+
>>  /config.mak
>>  /autom4te.cache
>>  /config.cache
>> @@ -213,6 +214,24 @@
>>  /tags
>>  /TAGS
>>  /cscope*
>> +/Debug/
>> +/Release/
>> +/*.patch
>> +
>> +#
>> +# Normal rules
>> +#
>> +*.tar.gz
>> +*.dsc
>> +*.deb
>> +*.exe
>> +*.[aos]
>> +*.py[co]
>> +.depend/
>> +*.gcda
>> +*.gcno
>> +*.gcov
>> +*+
>>  *.obj
>>  *.lib
>>  *.sln
>> @@ -222,5 +241,3 @@
>>  *.user
>>  *.idb
>>  *.pdb
>> -/Debug/
>> -/Release/
>
>
Michael J Gruber· Jul 21, 2011, 13:02 UTC · re: Vitaliy Ivanov · lore

Re: [PATCH] gitignore: add top level patch ignore rule

Vitaliy Ivanov venit, vidit, dixit 21.07.2011 14:54:
Show 29 quoted lines
> Michael,
> 
> On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>>> Add top level ignore rule for patches created by format-patch command.
>>
>> Please don't.
>>
>> The tracked ignore file is for ignoring products and artefacts of our
>> build process. format-patch is not part of this process, and the
>> existence of *.patch files depends on your workflow. But what is much
>> worse: In
>>
>> git status
>> git format-patch rev-spec
>> git send-email *.patch
>>
>> it is very easy to send out the wrong patches (along with the right
>> ones), because your patch hides them from status. Also, I can't clean
>> them up with "git clean -f" any more. I would have to use "git clean -f
>> -x" which would clean the build products also (and force a rebuild).
>>
>> So, your patch makes a format-patch based workflow much worse. What
>> problem does it try to solve?
> 
> I will not insist. You may know it better but git as is a public
> project where anyone can create and send patches. So it seems to me
> basic workflow for sharing changes.
Well sure it is. We do that and discuss the merits of patches.

I do use format-patch/send-email, and as I explained, your patch would make that more difficult. If there is something that it makes better that may outweigh it. Can you explain what improvement this (ignoring *.patch) introduces?

Show 7 quoted lines
>>
>>> On the way, reorganize ignore rules and add comments.
>>
>> How and why do you reorganize?
> 
> Just to be able to find specific rule faster. Global rules are now all
> together same is for top level root rules.

That may be a sensible cleanup, and it's good to describe that in the commit message. Also, in general, we try to separate reorganisation patches from those which introduce functional changes. (One may argue whether adding *.patch falls into the latter category, though.)

[patch snipped]
Michael
Vitaliy Ivanov· Jul 21, 2011, 13:22 UTC · re: Michael J Gruber · lore

Re: [PATCH] gitignore: add top level patch ignore rule

On Thu, Jul 21, 2011 at 4:02 PM, Michael J Gruber <git@drmicha.warpmail.net> wrote:

Show 37 quoted lines
> Vitaliy Ivanov venit, vidit, dixit 21.07.2011 14:54:
>> Michael,
>>
>> On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber
>> <git@drmicha.warpmail.net> wrote:
>>> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>>>> Add top level ignore rule for patches created by format-patch command.
>>>
>>> Please don't.
>>>
>>> The tracked ignore file is for ignoring products and artefacts of our
>>> build process. format-patch is not part of this process, and the
>>> existence of *.patch files depends on your workflow. But what is much
>>> worse: In
>>>
>>> git status
>>> git format-patch rev-spec
>>> git send-email *.patch
>>>
>>> it is very easy to send out the wrong patches (along with the right
>>> ones), because your patch hides them from status. Also, I can't clean
>>> them up with "git clean -f" any more. I would have to use "git clean -f
>>> -x" which would clean the build products also (and force a rebuild).
>>>
>>> So, your patch makes a format-patch based workflow much worse. What
>>> problem does it try to solve?
>>
>> I will not insist. You may know it better but git as is a public
>> project where anyone can create and send patches. So it seems to me
>> basic workflow for sharing changes.
>
> Well sure it is. We do that and discuss the merits of patches.
>
> I do use format-patch/send-email, and as I explained, your patch would
> make that more difficult. If there is something that it makes better
> that may outweigh it. Can you explain what improvement this (ignoring
> *.patch) introduces?

I'm not sure how listing all the patches that you have under "git status" will help you not to send a wrong one. Also we are talking about /*.patch rule and not *.patch as with such rule:

[vitaliy.ivanov@vivanov git]$ git ls-files -i --exclude-standard contrib/patches/docbook-xsl-manpages-charmap.patch t/t4100/t-apply-1.patch t/t4100/t-apply-2.patch t/t4100/t-apply-3.patch t/t4100/t-apply-4.patch t/t4100/t-apply-5.patch t/t4100/t-apply-6.patch t/t4100/t-apply-7.patch t/t4100/t-apply-8.patch t/t4100/t-apply-9.patch t/t4109/patch1.patch t/t4109/patch2.patch t/t4109/patch3.patch t/t4109/patch4.patch t/t4110/patch1.patch t/t4110/patch2.patch t/t4110/patch3.patch t/t4110/patch4.patch t/t4110/patch5.patch

Show 11 quoted lines
>>>> On the way, reorganize ignore rules and add comments.
>>>
>>> How and why do you reorganize?
>>
>> Just to be able to find specific rule faster. Global rules are now all
>> together same is for top level root rules.
>
> That may be a sensible cleanup, and it's good to describe that in the
> commit message. Also, in general, we try to separate reorganisation
> patches from those which introduce functional changes. (One may argue
> whether adding *.patch falls into the latter category, though.)

Yeah, I should agree here. I can resend it w/o adding new rules but simple reorganization and, of course, description for this change.

Vitaliy
Michael J Gruber· Jul 21, 2011, 13:29 UTC · re: Vitaliy Ivanov · lore

Re: [PATCH] gitignore: add top level patch ignore rule

Vitaliy Ivanov venit, vidit, dixit 21.07.2011 15:22:
Show 42 quoted lines
> On Thu, Jul 21, 2011 at 4:02 PM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Vitaliy Ivanov venit, vidit, dixit 21.07.2011 14:54:
>>> Michael,
>>>
>>> On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber
>>> <git@drmicha.warpmail.net> wrote:
>>>> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>>>>> Add top level ignore rule for patches created by format-patch command.
>>>>
>>>> Please don't.
>>>>
>>>> The tracked ignore file is for ignoring products and artefacts of our
>>>> build process. format-patch is not part of this process, and the
>>>> existence of *.patch files depends on your workflow. But what is much
>>>> worse: In
>>>>
>>>> git status
>>>> git format-patch rev-spec
>>>> git send-email *.patch
>>>>
>>>> it is very easy to send out the wrong patches (along with the right
>>>> ones), because your patch hides them from status. Also, I can't clean
>>>> them up with "git clean -f" any more. I would have to use "git clean -f
>>>> -x" which would clean the build products also (and force a rebuild).
>>>>
>>>> So, your patch makes a format-patch based workflow much worse. What
>>>> problem does it try to solve?
>>>
>>> I will not insist. You may know it better but git as is a public
>>> project where anyone can create and send patches. So it seems to me
>>> basic workflow for sharing changes.
>>
>> Well sure it is. We do that and discuss the merits of patches.
>>
>> I do use format-patch/send-email, and as I explained, your patch would
>> make that more difficult. If there is something that it makes better
>> that may outweigh it. Can you explain what improvement this (ignoring
>> *.patch) introduces?
> 
> I'm not sure how listing all the patches that you have under "git
> status" will help you not to send a wrong one.

Well, in order to get this patch in, you will have to explain what it is good for (not that I'd decide that, but that's my recommendation for you). I've asked twice and I'm still waiting for an explanation.

OTOH, I've explained in detail why I consider this change bad. Please reread my first reply.

> Also we are talking about /*.patch rule and not *.patch as with such rule:
Sure.
Michael
Marc Branchaud· Jul 21, 2011, 14:50 UTC · re: Vitaliy Ivanov · lore

Re: [PATCH] gitignore: add top level patch ignore rule

On 11-07-21 09:22 AM, Vitaliy Ivanov wrote:
Show 42 quoted lines
> On Thu, Jul 21, 2011 at 4:02 PM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Vitaliy Ivanov venit, vidit, dixit 21.07.2011 14:54:
>>> Michael,
>>>
>>> On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber
>>> <git@drmicha.warpmail.net> wrote:
>>>> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>>>>> Add top level ignore rule for patches created by format-patch command.
>>>>
>>>> Please don't.
>>>>
>>>> The tracked ignore file is for ignoring products and artefacts of our
>>>> build process. format-patch is not part of this process, and the
>>>> existence of *.patch files depends on your workflow. But what is much
>>>> worse: In
>>>>
>>>> git status
>>>> git format-patch rev-spec
>>>> git send-email *.patch
>>>>
>>>> it is very easy to send out the wrong patches (along with the right
>>>> ones), because your patch hides them from status. Also, I can't clean
>>>> them up with "git clean -f" any more. I would have to use "git clean -f
>>>> -x" which would clean the build products also (and force a rebuild).
>>>>
>>>> So, your patch makes a format-patch based workflow much worse. What
>>>> problem does it try to solve?
>>>
>>> I will not insist. You may know it better but git as is a public
>>> project where anyone can create and send patches. So it seems to me
>>> basic workflow for sharing changes.
>>
>> Well sure it is. We do that and discuss the merits of patches.
>>
>> I do use format-patch/send-email, and as I explained, your patch would
>> make that more difficult. If there is something that it makes better
>> that may outweigh it. Can you explain what improvement this (ignoring
>> *.patch) introduces?
> 
> I'm not sure how listing all the patches that you have under "git
> status" will help you not to send a wrong one.
Seeing various patch files in "git status" bothered me as well.

So I put all my patches in a top-level patches/ directory, along with a patches/.gitignore file that ignores everything there.

If that doesn't meet your needs, you could instead add a core.excludesfile entry to your ~/.gitconfig, and in there ignore *.patch files.

So given those alternatives, I'm not convinced your patch is suitable for all git users.

		M.
Vitaliy Ivanov· Jul 22, 2011, 13:20 UTC · re: Marc Branchaud · lore

Re: [PATCH] gitignore: add top level patch ignore rule

On Thu, Jul 21, 2011 at 5:50 PM, Marc Branchaud <marcnarc@xiplink.com> wrote:
Show 54 quoted lines
> On 11-07-21 09:22 AM, Vitaliy Ivanov wrote:
>> On Thu, Jul 21, 2011 at 4:02 PM, Michael J Gruber
>> <git@drmicha.warpmail.net> wrote:
>>> Vitaliy Ivanov venit, vidit, dixit 21.07.2011 14:54:
>>>> Michael,
>>>>
>>>> On Wed, Jul 20, 2011 at 11:09 AM, Michael J Gruber
>>>> <git@drmicha.warpmail.net> wrote:
>>>>> Vitaliy Ivanov venit, vidit, dixit 20.07.2011 00:17:
>>>>>> Add top level ignore rule for patches created by format-patch command.
>>>>>
>>>>> Please don't.
>>>>>
>>>>> The tracked ignore file is for ignoring products and artefacts of our
>>>>> build process. format-patch is not part of this process, and the
>>>>> existence of *.patch files depends on your workflow. But what is much
>>>>> worse: In
>>>>>
>>>>> git status
>>>>> git format-patch rev-spec
>>>>> git send-email *.patch
>>>>>
>>>>> it is very easy to send out the wrong patches (along with the right
>>>>> ones), because your patch hides them from status. Also, I can't clean
>>>>> them up with "git clean -f" any more. I would have to use "git clean -f
>>>>> -x" which would clean the build products also (and force a rebuild).
>>>>>
>>>>> So, your patch makes a format-patch based workflow much worse. What
>>>>> problem does it try to solve?
>>>>
>>>> I will not insist. You may know it better but git as is a public
>>>> project where anyone can create and send patches. So it seems to me
>>>> basic workflow for sharing changes.
>>>
>>> Well sure it is. We do that and discuss the merits of patches.
>>>
>>> I do use format-patch/send-email, and as I explained, your patch would
>>> make that more difficult. If there is something that it makes better
>>> that may outweigh it. Can you explain what improvement this (ignoring
>>> *.patch) introduces?
>>
>> I'm not sure how listing all the patches that you have under "git
>> status" will help you not to send a wrong one.
>
> Seeing various patch files in "git status" bothered me as well.
>
> So I put all my patches in a top-level patches/ directory, along with a
> patches/.gitignore file that ignores everything there.
>
> If that doesn't meet your needs, you could instead add a core.excludesfile
> entry to your ~/.gitconfig, and in there ignore *.patch files.
>
> So given those alternatives, I'm not convinced your patch is suitable for all
> git users.

Sure. It's not a problem. And thanks for describing workarounds here. Actually, this issue is not bothering me a lot but I know that's a usual practice to put patches to git ignore list. That's why I proposed it to the list.

Vitaliy

← back to recent threads