Add git format-patch produced patches to .gitignore
PATCH 1/1 Add git format-patch produced patches to .gitignore
Change Git's own .gitignore so that patches produced with git format-patch don't show up as untracked.
--- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
.gitignore +1 -0
@@ -203,3 +203,4 @@ *.pdb /Debug/ /Release/ +[0-9][0-9][0-9][0-9]-*.patch
Signature · 1 line
1.7.1.84.gd92f8
Ævar Arnfjörð Bjarmason venit, vidit, dixit 15.05.2010 23:22:
Quoted 3 lines
Change Git's own .gitignore so that patches produced with git format-patch don't show up as untracked.
Does the git build process call format-patch? No! The .gitignore we distribute is meant for things the build process creates, not for imposing a specific workflow on developers.
If you want to ignore format patch output, simply use .git/info/excludes or a global excludes file, but please don't force everyone else to live with that or work around it.
Cheers,
Michael
Quoted 14 lines
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>--- .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-).gitignore +1
-0@@ -203,3 +203,4 @@ *.pdb /Debug/ /Release/ +[0-9][0-9][0-9][0-9]-*.patch
Quoted 2 lines · Michael J Gruber
Does the git build process call format-patch? No! The .gitignore we distribute is meant for things the build process creates
Ah, true. I seem to remember a thread long ago about whether to include editor droppings in .gitignore, but I can’t find it in the git or lkml archive.
git’s .gitignore does not include .*.swp, \#*#, *~, indeed.
Quoted 1 line
Quoted 1 line
+[0-9][0-9][0-9][0-9]-*.patch
So nack from me as well. It is nice that the .gitignore file we track does not have to change with fashions, and this way each user can set up a personal excludesfile according to choice of tools without interference.
Maybe there should be a reasonable "default" .gitexcludes file in gitignore.5 as an example, but that is a different topic[1].
Thanks for the reminder,
Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/96220/focus=96289
PATCH 1/1 Remove editor-specific droppings from .gitignore
Git's own .gitignore files should only contain things created by Git's build systems, not editor-specific droppings.
See the discussion following the "[PATCH] Add git format-patch produced patches to .gitignore" thread (<[email protected]>).
---
Quoted 10 lines · Jonathan Nieder
Quoted 2 lines · Michael J Gruber
Does the git build process call format-patch? No! The .gitignore we distribute is meant for things the build process creates
Ah, true. I seem to remember a thread long ago about whether to include editor droppings in .gitignore, but I can’t find it in the git or lkml archive.
git’s .gitignore does not include .*.swp, \#*#, *~, indeed.
Thanks both of you, I stand corrected. Anyway, I guess this is a bug then. It's the only thing ignored by Git's various .gitignore files that isn't created by the build system.
git-gui/po/.gitignore | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
git-gui/po/.gitignore +0 -1
@@ -1,2 +1 @@ *.msg -*~
Signature · 1 line
1.7.1.84.gd92f8
Quoted 3 lines · Michael J Gruber
If you want to ignore format patch output, simply use .git/info/excludes or a global excludes file, but please don't force everyone else to live with that or work around it.
Side note: I said with similar intent that this allows developers to work “without interference”. This was a poor choice of words on my
part: a too-long .gitignore only prevents me from noticing and tracking files that others considered not worth tracking.
From the thread I faintly remembered and then linked to[1]: ;-)
I earlier said that "*~" should not be in project-wide .gitignore file because use of Emacs vs vi is a matter of personal taste, and Emacs specific "*~" pattern does not belong to a project policy, just like vim "*.swp" pattern doesn't.
But I think that reasoning is flawed. The right criteria should not be about "use of Emacs vs vi", but about "do we in this project ever want to track files that match *~ or *.swp as legitimate contents". If a project expects not to have a tracked file whose name ends with ".swp", even if it does _not_ mean to encourage use of vim over Emacs or any other editor, I think it is fine to add such to its tracked .gitignore file for its developer's benefit.
This does not change my conclusion: there are many other reasons to leave files produced outside the build process unlisted:
. consistency: to keep the file intuitive and avoid a lot of
patch churn, it is nicest to choose one rule and stick to it
. simplicity: shorter .gitignore. Making the appropriate content
of .gitignore depend on the behavior of too many text editors (and IDEs, and foreign VCSes, and debugging tools, and ...) makes it hard to maintain. See qt’s .gitignore for an example of this.
. correctness: for the case of format-patch, it is hard to say
"we will never want to track files that match ????-*.patch as legitimate contents". In fact, it is likely such files may need to be added to the test suite.
And unlike .o files and company, it does not seem likely that formatted patches need to be kept around during development.
I hope that is a little clearer. Sorry for the ramble. Jonathan
[1] http://thread.gmane.org/gmane.comp.version-control.git/96220/focus=96294
Jonathan Nieder venit, vidit, dixit 17.05.2010 04:22:
Quoted 18 lines
Quoted 3 lines · Michael J Gruber
If you want to ignore format patch output, simply use .git/info/excludes or a global excludes file, but please don't force everyone else to live with that or work around it.
Side note: I said with similar intent that this allows developers to work “without interference”. This was a poor choice of words on my
part: a too-long .gitignore only prevents me from noticing and tracking files that others considered not worth tracking.From the thread I faintly remembered and then linked to[1]: ;-)
I earlier said that "*~" should not be in project-wide .gitignore file because use of Emacs vs vi is a matter of personal taste, and Emacs specific "*~" pattern does not belong to a project policy, just like vim "*.swp" pattern doesn't.
Quoted 7 lines
But I think that reasoning is flawed. The right criteria should not be about "use of Emacs vs vi", but about "do we in this project ever want to track files that match *~ or *.swp as legitimate contents". If a project expects not to have a tracked file whose name ends with ".swp", even if it does _not_ mean to encourage use of vim over Emacs or any other editor, I think it is fine to add such to its tracked .gitignore file for its developer's benefit.
I think I meant to object back then but concluded it made no difference. My mathematically deformed^Weducated mind tells me that "do we... contents" means we should put everything in .gitignore except what we expect to track. So, here the literal understanding certainly differs from the intended definition ;)
Quoted 18 lines
This does not change my conclusion: there are many other reasons to leave files produced outside the build process unlisted:
. consistency: to keep the file intuitive and avoid a lot of
patch churn, it is nicest to choose one rule and stick to it. simplicity: shorter .gitignore. Making the appropriate content
of .gitignore depend on the behavior of too many text editors (and IDEs, and foreign VCSes, and debugging tools, and ...) makes it hard to maintain. See qt’s .gitignore for an example of this.. correctness: for the case of format-patch, it is hard to say
"we will never want to track files that match ????-*.patch as legitimate contents". In fact, it is likely such files may need to be added to the test suite.
Quoted 5 lines
And unlike .o files and company, it does not seem likely that formatted patches need to be kept around during development.
I hope that is a little clearer. Sorry for the ramble. Jonathan
I haven't found the rambling part in your post yet but agree everything is clearer now :)
Michael
P.S.: I'm fine with Ævar's revised patch, of course. ACK
Quoted 2 lines
[1] http://thread.gmane.org/gmane.comp.version-control.git/96220/focus=96294
Generally I use the format-patch command as:
git format-patch -M origin/master -o outgoing/
So, my patches will be in subdirectory outgoing. But the regex rule in this patch won't be able to hide them.
What do u want to do in that case ?
- Pavan
Quoted 25 lines · Ævar Arnfjörð Bjarmason
Change Git's own .gitignore so that patches produced with git format-patch don't show up as untracked.
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>---
.gitignore | 1 +1 files changed, 1 insertions(+), 0 deletions(-).gitignore +0
-0@@ -203,3 +203,4 @@ *.pdb/Debug/
/Release/
+[0-9][0-9][0-9][0-9]-*.patch
--
1.7.1.84.gd92f8--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Pavan Kumar Sunkara
Quoted 7 lines · Ævar Arnfjörð Bjarmason
.gitignore +0
-0@@ -203,3 +203,4 @@ *.pdb/Debug/
/Release/
+[0-9][0-9][0-9][0-9]-*.patch
[...]
Quoted 6 lines
git format-patch -M origin/master -o outgoing/
So, my patches will be in subdirectory outgoing. But the regex rule in this patch won't be able to hide them.
What do u want to do in that case ?
Try it out.
In fact, I was worried that this patch would trigger a similar
problem: maybe some test data directory contains format-patch output? In fact none do, so I like the patch.
Thanks,
Jonathan
Quoted 11 lines · Jonathan Nieder
Quoted 9 lines · Pavan Kumar Sunkara
Quoted 7 lines · Ævar Arnfjörð Bjarmason
.gitignore +0
-0@@ -203,3 +203,4 @@ *.pdb/Debug/
/Release/
+[0-9][0-9][0-9][0-9]-*.patch[...]
Quoted 8 lines
Quoted 6 lines
git format-patch -M origin/master -o outgoing/
So, my patches will be in subdirectory outgoing. But the regex rule in this patch won't be able to hide them.
What do u want to do in that case ?
Try it out.
Right, patches in outgoing/ will be ignored too because the rule isn't prefixed with /, so it works regardless of whether the file is in a subdirectory or not.
Quoted 3 lines
In fact, I was worried that this patch would trigger a similar
problem: maybe some test data directory contains format-patch output? In fact none do, so I like the patch.
None do, there's no file that matches '????-*.patch' in Git. Even if there was you could still 'git add -f' it, which wouldn't be that big of a problem because it would be part of some rarely touched test suite in t/*.