{"thread":{"id":"17340","subject":"diff settings","startedAt":"2009-01-24T17:38:18Z","lastAt":"2009-01-31T23:10:16Z","messageCount":13,"participants":["Keith Cascio","Jeff King","Teemu Likonen","Ted Pavlic","Johannes Schindelin","Nanako Shiraishi"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101754","messageId":"alpine.GSO.2.00.0901240936080.23073@kiwi.cs.ucla.edu","threadId":"17340","inReplyTo":null,"subject":"diff settings","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-01-24T17:38:18Z","receivedAt":"2009-01-24T17:38:18Z","isPatch":false,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"How do I configure my local git so that diff always obeys a particular option, \ne.g. \"-w\", without needing to type it on the command line each time?\n\nThanks,\nKeith\n"},{"id":"101767","messageId":"20090124192222.GA18010@coredump.intra.peff.net","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901240936080.23073@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-24T19:22:23Z","receivedAt":"2009-01-24T19:22:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jan 24, 2009 at 09:38:18AM -0800, Keith Cascio wrote:\n\n> How do I configure my local git so that diff always obeys a particular\n> option, e.g. \"-w\", without needing to type it on the command line each\n> time?\n\nAFAIK, there is not a way to do it in the general case (though there are\nspecific config options for things like rename support). When I\nrefactored the gitattributes diff=$foo code a few months back, I tried\nto keep in mind the possibility of a \"diff options\" field. But I never\nactually implemented anything, as I don't personally ever use diff\noptions in such a way.\n\nIf you're interested, it would probably not be too hard to implement\n(see userdiff.[ch], and the external and textconv code in diff.c for a\nstart).\n\n-Peff\n"},{"id":"101769","messageId":"87ocxwv6qg.fsf@iki.fi","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901240936080.23073@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2009-01-24T19:33:59Z","receivedAt":"2009-01-24T19:33:59Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Keith Cascio (2009-01-24 09:38 -0800) wrote:\n\n> How do I configure my local git so that diff always obeys a particular\n> option, e.g. \"-w\", without needing to type it on the command line each\n> time?\n\nIt seems that the answer is \"no\", but aliases are a work-around:\n\n    git config --global alias.dff \"diff -w\"\n\nThen \"git dff\" is your new \"git diff -w\". :-)\n"},{"id":"101775","messageId":"alpine.GSO.2.00.0901241159050.23073@kiwi.cs.ucla.edu","threadId":"17340","inReplyTo":"87ocxwv6qg.fsf@iki.fi","subject":"Re: diff settings","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-01-24T20:01:25Z","receivedAt":"2009-01-24T20:01:25Z","isPatch":false,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"> It seems that the answer is \"no\", but aliases are a work-around:\n> \n>     git config --global alias.dff \"diff -w\"\n> \n> Then \"git dff\" is your new \"git diff -w\". :-)\n\nThat feature is gonna come in handy.  It doesn't 100% fulfill my needs here but \nI like it!  Thanks, I did not know about alias.*\n"},{"id":"101877","messageId":"497CD352.2060402@tedpavlic.com","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901241159050.23073@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-25T21:02:10Z","receivedAt":"2009-01-25T21:02:10Z","isPatch":false,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":">>      git config --global alias.dff \"diff -w\"\n>>\n>> Then \"git dff\" is your new \"git diff -w\". :-)\n>\n> That feature is gonna come in handy.  It doesn't 100% fulfill my needs here but\n> I like it!  Thanks, I did not know about alias.*\n\nMercurial has a \"defaults.*\" that does exactly what you want. That is, \nyou can say\n\n[defaults]\ndiff = -w\n\nand \"hg diff\" will automatically do \"hg diff -w\". Such a feature might \nbe a nice addition to git.\n\n--Ted\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"101878","messageId":"alpine.GSO.2.00.0901251307030.12651@kiwi.cs.ucla.edu","threadId":"17340","inReplyTo":"497CD352.2060402@tedpavlic.com","subject":"Re: diff settings","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-01-25T21:11:29Z","receivedAt":"2009-01-25T21:11:29Z","isPatch":false,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"On Sun, 25 Jan 2009, Ted Pavlic wrote:\n\n> Mercurial has a \"defaults.*\" that does exactly what you want. That is, you can\n> say\n> \n> [defaults]\n> diff = -w\n> \n> and \"hg diff\" will automatically do \"hg diff -w\". Such a feature might be a \n> nice addition to git.\n\nThank you, that is very interesting.  I just submitted a patch this morning that \ndoes exactly what you describe, but I called it \"primer\" instead of \"defaults\" \nbecause it seemed more explicit.  Check it out.\n\n                            -- Keith\n"},{"id":"101932","messageId":"497D1AB7.7000208@tedpavlic.com","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901251307030.12651@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-26T02:06:47Z","receivedAt":"2009-01-26T02:06:47Z","isPatch":false,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":">> Mercurial has a \"defaults.*\" that does exactly what you want. That is, you can\n>> [defaults]\n>> diff = -w\n>> and \"hg diff\" will automatically do \"hg diff -w\". Such a feature might be a\n>> nice addition to git.\n> Thank you, that is very interesting.  I just submitted a patch this morning that\n> does exactly what you describe, but I called it \"primer\" instead of \"defaults\"\n> because it seemed more explicit.  Check it out.\n\nI saw that. However, in Mercurial's case, the [defaults] section applies \nto all commands (including new ones introduced by extensions). That is, \nit looks like your patch adds a diff.primer, but Mercurial would add a \nprimer.* that allows you to have a primer.diff, primer.commit, etc.\n\nFor example, wouldn't it be nice to have something like...\n\n[defaults]\ndiff = -w\ncommit = -a\n\netc.? Right now the only way you can do that is with aliases (e.g., I \nhave an alias from \"ci\" to \"commit -a\").\n\nThis task is pretty easy in Mercurial because Mercurial porcelains are \nimplemented as modules that are all executed through the central \"hg\" \ncommand. This isn't the case with git.\n\n(on a somewhat unrelated note, Mercurial does have a [diff] section that \nallows for, say, forcing the use of git diff and other things)\n\n--Ted\n\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"102474","messageId":"4981D8AD.6000000@tedpavlic.com","threadId":"17340","inReplyTo":"497D1AB7.7000208@tedpavlic.com","subject":"Re: diff settings","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-29T16:26:21Z","receivedAt":"2009-01-29T16:26:21Z","isPatch":false,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"> This task is pretty easy in Mercurial because Mercurial porcelains are\n> implemented as modules that are all executed through the central \"hg\"\n> command. This isn't the case with git.\n\n(on the other hand, having a \"[defaults]\" section that only applies when \ncommands are called via \"git\" might be nice. That way you can use the \n\"git-CMD\" when you want to use CMD without the \"[defaults]\"... perhaps?)\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"102476","messageId":"alpine.DEB.1.00.0901291731220.3586@pacific.mpi-cbg.de","threadId":"17340","inReplyTo":"4981D8AD.6000000@tedpavlic.com","subject":"Re: diff settings","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-29T16:33:00Z","receivedAt":"2009-01-29T16:33:00Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 29 Jan 2009, Ted Pavlic wrote:\n\n> > This task is pretty easy in Mercurial because Mercurial porcelains are\n> > implemented as modules that are all executed through the central \"hg\"\n> > command. This isn't the case with git.\n> \n> (on the other hand, having a \"[defaults]\" section that only applies when\n> commands are called via \"git\" might be nice. That way you can use the\n> \"git-CMD\" when you want to use CMD without the \"[defaults]\"... perhaps?)\n\nNope, the dash form is deprecated, and once y'all out there finally do not \nwrite it any more, we can start thinking about _not_ hardlinking the \nbuiltins to their dashed form anymore.\n\nBelieve it or not, we already have a distinction between what is called \nfrom scripts vs from humans: plumbing vs porcelain.  So you can set the \ndefaults for porcelain as much as you want, but please leave plumbing \nalone.\n\nCiao,\nDscho\n"},{"id":"102485","messageId":"alpine.GSO.2.00.0901291044280.23065@kiwi.cs.ucla.edu","threadId":"17340","inReplyTo":"alpine.DEB.1.00.0901291731220.3586@pacific.mpi-cbg.de","subject":"Re: diff settings","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-01-29T18:46:12Z","receivedAt":"2009-01-29T18:46:12Z","isPatch":false,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"On Thu, 29 Jan 2009, Johannes Schindelin wrote:\n\n> we already have a distinction between what is called from scripts vs from \n> humans: plumbing vs porcelain.  So you can set the defaults for porcelain as \n> much as you want, but please leave plumbing alone.\n\nMay we consider \"git diff\" Porcelain and \"git diff-{files,index,tree}\" plumbing?\n"},{"id":"102503","messageId":"20090130060742.6117@nanako3.lavabit.com","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901291044280.23065@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-29T21:07:42Z","receivedAt":"2009-01-29T21:07:42Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Keith Cascio <keith@CS.UCLA.EDU>:\n\n> On Thu, 29 Jan 2009, Johannes Schindelin wrote:\n>\n>> we already have a distinction between what is called from scripts vs from \n>> humans: plumbing vs porcelain.  So you can set the defaults for porcelain as \n>> much as you want, but please leave plumbing alone.\n>\n> May we consider \"git diff\" Porcelain and \"git diff-{files,index,tree}\" plumbing?\n\nSure we may. To see the list of commands with categories, you can consult\n\nhttp://www.kernel.org/pub/software/scm/git/docs/\n\nJunio, I think you could have stated this a bit more clearly in your message\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/107069/focus=107165\n\nto avoid confusion, especially when you know you are talking to somebody new to git.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"102707","messageId":"4984AACD.20600@tedpavlic.com","threadId":"17340","inReplyTo":"alpine.GSO.2.00.0901310750470.5437@kiwi.cs.ucla.edu","subject":"Re: diff settings","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-31T19:47:25Z","receivedAt":"2009-01-31T19:47:25Z","isPatch":false,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"> Thank you for alerting us to the Hg design.  I can appreciate the elegance of\n> it, and I'm always in favor of the most general possible implementation.  But\n> there is a subtle difference between diff.primer and primer.diff.\n\nAs I already discussed, Mercurial has both \"diff.primer\" and \n\"primer.diff\" precisely because \"diff\" settings affects so many Hg commands.\n\nIn particular, in my .hgrc, I have:\n\n[diff]\ngit = 1\n\nwhich causes all Mercurial commands that need to generate a diff to use \ngitdiff rather than truediff. However, if I *wanted* to apply a set of \nflags to a particular command, I could (using the equivalent \"git\" \ncommands)...\n\n[defaults]\npull = --rebase\ncommit = -a\nformat-patch = -M\n\nSo I see a purpose for both *.defaults and defaults.*. Of course, \naliases are also nice (IIRC, Mercurial doesn't have \"aliases\", but I \ncould be wrong). Mercurial users are very happy with having both \navailable. I imagine git people would be too.\n\n--Ted\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"102726","messageId":"alpine.GSO.2.00.0901311507350.10805@kiwi.cs.ucla.edu","threadId":"17340","inReplyTo":"4984AACD.20600@tedpavlic.com","subject":"Re: diff settings","fromName":"Keith Cascio","fromEmail":"keith@cs.ucla.edu","sentAt":"2009-01-31T23:10:16Z","receivedAt":"2009-01-31T23:10:16Z","isPatch":false,"sender":{"key":"keith@cs.ucla.edu","avatar":"https://gravatar.com/avatar/c5ec3a8f1cd1f449fdf8bdb7125fdbfd10b729507f32cbf0aa4ad07b4f7127ae?d=mp&s=160"},"body":"On Sat, 31 Jan 2009, Ted Pavlic wrote:\n\n> As I already discussed, Mercurial has both \"diff.primer\" and \"primer.diff\" \n> precisely because \"diff\" settings affects so many Hg commands.\n\nYes I remember you did mention that.\n\n> In particular, in my .hgrc, I have:\n> [diff]\n> git = 1\n> which causes all Mercurial commands that need to generate a diff to use\n> gitdiff rather than truediff. However, if I *wanted* to apply a set of flags\n> to a particular command, I could (using the equivalent \"git\" commands)...\n> [defaults]\n> pull = --rebase\n> commit = -a\n> format-patch = -M\n> So I see a purpose for both *.defaults and defaults.*. Of course, aliases are \n> also nice (IIRC, Mercurial doesn't have \"aliases\", but I could be wrong). \n> Mercurial users are very happy with having both available. I imagine git \n> people would be too.\n\nI like it!  I'm all for it.  Perfect opportunity for future work.  In fact, I \nthink I already glanced at the part of the code that's the right place to make \nthat stuff happen.\n\n                                      -- Keith\n"}]}