{"thread":{"id":"11331","subject":"git with custom diff for commits","startedAt":"2007-12-17T22:56:28Z","lastAt":"2007-12-19T12:13:08Z","messageCount":24,"participants":["Gerald Gutierrez","Johannes Schindelin","Matthieu Moy","Junio C Hamano","Martin Langhoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"63507","messageId":"60687a7d0712171456p14328817y5aa229f0df23c02f@mail.gmail.com","threadId":"11331","inReplyTo":null,"subject":"git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-17T22:56:28Z","receivedAt":"2007-12-17T22:56:28Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":"Hello folks,\n\nI do a nightly mysqldump of a database and check it into a git\nrepository. mysqldump generates a timestamp as part of that output\nwhich is causing git to think that the file changes every night when\nit really doesn't. The timestamp is simply in an SQL comment.\n\nSo what I'd like to do is teach git to ignore that particular SQL\ntimestamp comment. I've tried to set up an external diff script that\nruns diff -I \"<<sql timestamp comment>>\" that effectively ignores the\ntimestamp. While this works with \"git diff\", it seems when git\ncommits, it still sees the differences.\n\nHow do I properly teach git to ignore these types of differences?\n\nGerald.\n"},{"id":"63511","messageId":"Pine.LNX.4.64.0712172300510.9446@racer.site","threadId":"11331","inReplyTo":"60687a7d0712171456p14328817y5aa229f0df23c02f@mail.gmail.com","subject":"Re: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-17T23:01:37Z","receivedAt":"2007-12-17T23:01:37Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 17 Dec 2007, Gerald Gutierrez wrote:\n\n> I do a nightly mysqldump of a database and check it into a git \n> repository. mysqldump generates a timestamp as part of that output which \n> is causing git to think that the file changes every night when it really \n> doesn't. The timestamp is simply in an SQL comment.\n> \n> So what I'd like to do is teach git to ignore that particular SQL \n> timestamp comment. I've tried to set up an external diff script that \n> runs diff -I \"<<sql timestamp comment>>\" that effectively ignores the \n> timestamp. While this works with \"git diff\", it seems when git commits, \n> it still sees the differences.\n> \n> How do I properly teach git to ignore these types of differences?\n\nYou might be interested in reading Documentation/gitattributes.txt, look \nfor \"diff driver\".\n\nHth,\nDscho\n"},{"id":"63514","messageId":"vpq1w9kaphg.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712172300510.9446@racer.site","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-17T23:08:43Z","receivedAt":"2007-12-17T23:08:43Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Mon, 17 Dec 2007, Gerald Gutierrez wrote:\n>\n>> I do a nightly mysqldump of a database and check it into a git \n>> repository. mysqldump generates a timestamp as part of that output which \n>> is causing git to think that the file changes every night when it really \n>> doesn't. The timestamp is simply in an SQL comment.\n>> \n>> So what I'd like to do is teach git to ignore that particular SQL \n>> timestamp comment. I've tried to set up an external diff script that \n>> runs diff -I \"<<sql timestamp comment>>\" that effectively ignores the \n>> timestamp. While this works with \"git diff\", it seems when git commits, \n>> it still sees the differences.\n>> \n>> How do I properly teach git to ignore these types of differences?\n>\n> You might be interested in reading Documentation/gitattributes.txt, look \n> for \"diff driver\".\n\nIt will show an empty output for \"git diff\", but I doubt thit will\nchange anything at commit time. Probably the \"filter\" thing on the\nsame file (also \"man gitattributes\") can help though.\n\n-- \nMatthieu\n"},{"id":"63515","messageId":"Pine.LNX.4.64.0712172310090.9446@racer.site","threadId":"11331","inReplyTo":"vpq1w9kaphg.fsf@bauges.imag.fr","subject":"Re: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-17T23:11:58Z","receivedAt":"2007-12-17T23:11:58Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Matthieu Moy wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Mon, 17 Dec 2007, Gerald Gutierrez wrote:\n> >\n> >> I've tried to set up an external diff script that runs diff -I \"<<sql \n> >> timestamp comment>>\" that effectively ignores the timestamp. While \n> >> this works with \"git diff\", it seems when git commits, it still sees \n> >> the differences.\n> >> \n> >> How do I properly teach git to ignore these types of differences?\n> >\n> > You might be interested in reading Documentation/gitattributes.txt, \n> > look for \"diff driver\".\n> \n> It will show an empty output for \"git diff\", but I doubt thit will \n> change anything at commit time. Probably the \"filter\" thing on the same \n> file (also \"man gitattributes\") can help though.\n\nAh, right.  I completely missed that you were talking about git-commit, \nnot git-log on git commits.\n\nYes, setting up a \"clean\" filter that removes the timestamps is probably \nthe reasonable thing to do here.\n\nSorry for the noise,\nDscho\n"},{"id":"63522","messageId":"7vbq8o6gxw.fsf@gitster.siamese.dyndns.org","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712172310090.9446@racer.site","subject":"Re: git with custom diff for commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-17T23:26:51Z","receivedAt":"2007-12-17T23:26:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> It will show an empty output for \"git diff\", but I doubt thit will \n>> change anything at commit time. Probably the \"filter\" thing on the same \n>> file (also \"man gitattributes\") can help though.\n>\n> Ah, right.  I completely missed that you were talking about git-commit, \n> not git-log on git commits.\n>\n> Yes, setting up a \"clean\" filter that removes the timestamps is probably \n> the reasonable thing to do here.\n\nI wouldn't do filters for something like that.  Can you guarantee that\nthe output from corresopnding smudge filter will load cleanly back to\nthe mysql database?\n\nJust do not make the commit if you made only meaningless changes and\nnothing else.  pre-commit hook would probably be a good place to do so.\n"},{"id":"63521","messageId":"002901c84104$6149cbc0$02fdfea9@na.acco.com","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712172310090.9446@racer.site","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-17T23:27:11Z","receivedAt":"2007-12-17T23:27:11Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":" \n> Ah, right.  I completely missed that you were talking about \n> git-commit, not git-log on git commits.\n> \n> Yes, setting up a \"clean\" filter that removes the timestamps \n> is probably the reasonable thing to do here.\n\nI read about the filter too, but have no idea how to implement it. Any\nexamples that I could follow?\n\nThanks,\nGerald.\n"},{"id":"63570","messageId":"vpqk5ncz8fn.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"7vbq8o6gxw.fsf@gitster.siamese.dyndns.org","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-18T08:57:48Z","receivedAt":"2007-12-18T08:57:48Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>\n>>> It will show an empty output for \"git diff\", but I doubt thit will \n>>> change anything at commit time. Probably the \"filter\" thing on the same \n>>> file (also \"man gitattributes\") can help though.\n>>\n>> Ah, right.  I completely missed that you were talking about git-commit, \n>> not git-log on git commits.\n>>\n>> Yes, setting up a \"clean\" filter that removes the timestamps is probably \n>> the reasonable thing to do here.\n>\n> I wouldn't do filters for something like that.  Can you guarantee that\n> the output from corresopnding smudge filter will load cleanly back to\n> the mysql database?\n\nThe original poster said the date was an SQL comment, so, it should be\nsafe to strip it. That said, precommit hook is probably a good or\nbetter solution. At least, if you're not sure you didn't make a\nmistake writting it, you'll notice either a good commit or no commit\nat all. With filters, you might well notice you corrupted the commit\ntoo late :-(.\n\n-- \nMatthieu\n"},{"id":"63577","messageId":"7vodco1him.fsf@gitster.siamese.dyndns.org","threadId":"11331","inReplyTo":"vpqk5ncz8fn.fsf@bauges.imag.fr","subject":"Re: git with custom diff for commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-18T09:25:37Z","receivedAt":"2007-12-18T09:25:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> ...\n>> I wouldn't do filters for something like that.  Can you guarantee that\n>> the output from corresopnding smudge filter will load cleanly back to\n>> the mysql database?\n>\n> The original poster said the date was an SQL comment, so, it should be\n> safe to strip it. That said, precommit hook is probably a good or\n> better solution. At least, if you're not sure you didn't make a\n> mistake writting it, you'll notice either a good commit or no commit\n> at all. With filters, you might well notice you corrupted the commit\n> too late :-(.\n\nYeah.  After writing the message you are responding to, I realized that\nI already do something like that to manage html/man branches that are\nautogenerated, and it is exactly the same situation as Gerald is in.\n\nThe autogeneration of documentation and updating of html/man branches is\ncontrolled by dodoc.sh script in 'todo' branch, installed as post-update\nhook in my public repository.  It builds the documentation in a checkout\nof 'master' branch, installs the result into another checkout of 'html'\nand 'man' branches, and commits.\n\nThe twist is in the \"install\" step (this is different from my suggestion\nof preventing the commit in pre-commit hook).  When the newly generated\ndocumentation files are different from the previously generated ones\nonly by datestamp, they are not installed into 'html'/'man' checkouts,\nand such a change is not included in the commits.\n\nSo my updated suggestion would be:\n\n - Keep a checkout of that mysql dump;\n\n - Make the dump procedure to dump to that checkout area;\n\n - Run \"git diff HEAD\", perhaps with the external diff that filters out\n   the cruft as suggested in the thread, and run \"git checkout $path\"\n   for paths that had only meaningless changes;\n\n - Run \"git commit\" if the above step did not nuke all changes.\n"},{"id":"63666","messageId":"000001c841b5$89fcef00$762a14ac@na.acco.com","threadId":"11331","inReplyTo":"7vodco1him.fsf@gitster.siamese.dyndns.org","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-18T20:35:28Z","receivedAt":"2007-12-18T20:35:28Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":"\n> \n> So my updated suggestion would be:\n> \n>  - Keep a checkout of that mysql dump;\n> \n>  - Make the dump procedure to dump to that checkout area;\n> \n>  - Run \"git diff HEAD\", perhaps with the external diff that \n> filters out\n>    the cruft as suggested in the thread, and run \"git checkout $path\"\n>    for paths that had only meaningless changes;\n> \n>  - Run \"git commit\" if the above step did not nuke all changes.\n> \n\nI ended up doing the following, which sounds similar to the above. Instead\nof doing mysqldump into data.sql, it goes into data.sql.2 which I compare\nwith the checked in data.sql using \"diff -I <timestamp RE>\". If there are no\ndifferences, I delete data.sql.2. If there are differences, I move\ndata.sql.2 into data.sql and check in. Perhaps not as elegant but certainly\nworks.\n\nGerald.\n"},{"id":"63668","messageId":"7vzlw7ybx7.fsf@gitster.siamese.dyndns.org","threadId":"11331","inReplyTo":"000001c841b5$89fcef00$762a14ac@na.acco.com","subject":"Re: git with custom diff for commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-18T20:40:04Z","receivedAt":"2007-12-18T20:40:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Gerald Gutierrez\" <ggmlfs@gmail.com> writes:\n\n> I ended up doing the following, which sounds similar to the above. Instead\n> of doing mysqldump into data.sql, it goes into data.sql.2 which I compare\n> with the checked in data.sql using \"diff -I <timestamp RE>\". If there are no\n> differences, I delete data.sql.2. If there are differences, I move\n> data.sql.2 into data.sql and check in. Perhaps not as elegant but certainly\n> works.\n\nHeh, that's essentially how automated html/man branches are managed ;-)\n"},{"id":"63670","messageId":"000101c841b7$5f1d1060$762a14ac@na.acco.com","threadId":"11331","inReplyTo":"7vzlw7ybx7.fsf@gitster.siamese.dyndns.org","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-18T20:48:37Z","receivedAt":"2007-12-18T20:48:37Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":"\nYes, but wouldn't it be slick to actually teach git's internal diff to do\nthings like GNU diff can, like the ignore option -I, case insensitivity,\netc. I thought that's what the external diff capability is for, but it is\nnot so.\n\nGerald.\n\n> -----Original Message-----\n> From: Junio C Hamano [mailto:gitster@pobox.com] \n> Sent: Tuesday, December 18, 2007 12:40 PM\n> To: Gerald Gutierrez\n> Cc: 'Junio C Hamano'; 'Matthieu Moy'; 'Johannes Schindelin'; \n> git@vger.kernel.org\n> Subject: Re: git with custom diff for commits\n> \n> \"Gerald Gutierrez\" <ggmlfs@gmail.com> writes:\n> \n> > I ended up doing the following, which sounds similar to the above. \n> > Instead of doing mysqldump into data.sql, it goes into data.sql.2 \n> > which I compare with the checked in data.sql using \"diff -I \n> <timestamp \n> > RE>\". If there are no differences, I delete data.sql.2. If \n> there are \n> > differences, I move\n> > data.sql.2 into data.sql and check in. Perhaps not as elegant but \n> > certainly works.\n> \n> Heh, that's essentially how automated html/man branches are \n> managed ;-)\n"},{"id":"63678","messageId":"Pine.LNX.4.64.0712182124410.23902@racer.site","threadId":"11331","inReplyTo":"000101c841b7$5f1d1060$762a14ac@na.acco.com","subject":"RE: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T21:27:08Z","receivedAt":"2007-12-18T21:27:08Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Gerald Gutierrez wrote:\n\n> Yes, but wouldn't it be slick to actually teach git's internal diff to \n> do things like GNU diff can, like the ignore option -I, case \n> insensitivity, etc. I thought that's what the external diff capability \n> is for, but it is not so.\n\nI disagree.  Your statement is misleading when you say you want the \ninternal diff to do things like GNU diff can.\n\nWhat you want to do _in fact_ is not only modify the diff _output_, but \nthe commit _input_.\n\nAnd I am not so keen on such filters.  If I do not want to commit,  I do \nnot change it to begin with.  Yes, your mysqldump is a special case here.  \nBut it is special anyway, as it is not source code.\n\nCiao,\nDscho\n"},{"id":"63682","messageId":"7vir2vy97l.fsf@gitster.siamese.dyndns.org","threadId":"11331","inReplyTo":"000101c841b7$5f1d1060$762a14ac@na.acco.com","subject":"Re: git with custom diff for commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-18T21:38:38Z","receivedAt":"2007-12-18T21:38:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Gerald Gutierrez\" <ggmlfs@gmail.com> writes:\n\n> I thought that's what the external diff capability is for,...\n\nIt certainly is.  Your external diff gets all the information it needs\nto generate whatever custom diff computation it may want to do.\n"},{"id":"63685","messageId":"vpqsl1zfz8r.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"000101c841b7$5f1d1060$762a14ac@na.acco.com","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-18T21:51:16Z","receivedAt":"2007-12-18T21:51:16Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Gerald Gutierrez\" <ggmlfs@gmail.com> writes:\n\n> Yes, but wouldn't it be slick to actually teach git's internal diff to do\n> things like GNU diff can, like the ignore option -I, case insensitivity,\n> etc. I thought that's what the external diff capability is for, but it is\n> not so.\n\nDon't confuse diff and commit.\n\nGit is really snapshot oriented. When you commit, you don't say\n\"record the changes I made since HEAD\", you say \"record the current\nstate of the working tree, and also record the fact that this state is\nbased on HEAD\".\n\nSee what a commit object looks like:\n\n$ git cat-file -p 183f84365d \ntree 3f9d576b4adc78188a411104bc21159d459fa3f4\nparent b9c506f7d9f05a630fa7e31b77a9cf5081d7dbba\nauthor Shun Kei Leung <kevinlsk@gmail.com> 1195614079 +0800\ncommitter Junio C Hamano <gitster@pobox.com> 1195630064 -0800\n\ngit-p4: Fix typo in --detect-labels\n\nSigned-off-by: Kevin Leung <kevinlsk@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n$ _\n\nThe \"tree\" tells you the state of the project as recorded by commit,\nand the \"parent\" tells you where the HEAD was pointing to at commit\ntime. That's really the raw information recorded by git.\n\nNow, \"diff\" comes into the picture for two things: 1) storage\nefficiency (you prefer a 1Mb pack file to a 1Gb uncompressed\nrepository), but that doesn't change the concept, and 2) user\ninterface.\n\nWhen you say \"git show HEAD\", for example, git will recompute a diff,\nand show it to you because this is what you expect. But this\ninformation is computed at \"git show\" time, not at \"git commit\" time.\n\n\nWhat you seem to expect is to tell git \"commit the changes except this\nportion\", what you have to tell git is actually \"commit the new state,\nbut not if this portion is the only change\". That sounds identical,\nbut it's actually a bit different.\n\n-- \nMatthieu\n"},{"id":"63683","messageId":"000201c841c0$2e5e08e0$762a14ac@na.acco.com","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712182124410.23902@racer.site","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-18T21:51:38Z","receivedAt":"2007-12-18T21:51:38Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":" \n> -----Original Message-----\n> From: Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de] \n> Sent: Tuesday, December 18, 2007 1:27 PM\n> To: Gerald Gutierrez\n> Cc: 'Junio C Hamano'; 'Matthieu Moy'; git@vger.kernel.org\n> Subject: RE: git with custom diff for commits\n> \n> Hi,\n> \n> On Tue, 18 Dec 2007, Gerald Gutierrez wrote:\n> \n> > Yes, but wouldn't it be slick to actually teach git's \n> internal diff to \n> > do things like GNU diff can, like the ignore option -I, case \n> > insensitivity, etc. I thought that's what the external diff \n> capability \n> > is for, but it is not so.\n> \n> I disagree.  Your statement is misleading when you say you \n> want the internal diff to do things like GNU diff can.\n> \n> What you want to do _in fact_ is not only modify the diff \n> _output_, but the commit _input_.\n> \n> And I am not so keen on such filters.  If I do not want to \n> commit,  I do not change it to begin with.  Yes, your \n> mysqldump is a special case here.  \n> But it is special anyway, as it is not source code.\n\nI don't understand how it is a benefit to have \"git commit\" and \"git diff\"\ndo different diff functions. It confuses me. A scenario: I keep doing git\ndiff's and it says there is no difference, but then git commit keeps telling\nme there is.\n\nWhile I understand it was built for the kernel and everybody likes the plain\ntext format, it is not a stretch of the imagination to have files that are\nsemantically identical but have byte-wise differences. OpenDocument files,\nimage files, XML, etc. Cases can be made either way that \"the same\" means\nsemantically or byte-wise. It's perfectly fine that the default is\nbyte-wise. But, if the user takes the time to build a custom diff, then\nwouldn't it be reasonable to assume that user means for git to do semantic\ncomparisons for diff, commit and other git functions, even if there are\ninconsequential byte-wise differences in the file itself?\n\nGerald.\n"},{"id":"63686","messageId":"Pine.LNX.4.64.0712182159560.23902@racer.site","threadId":"11331","inReplyTo":"000201c841c0$2e5e08e0$762a14ac@na.acco.com","subject":"RE: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T22:00:36Z","receivedAt":"2007-12-18T22:00:36Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Gerald Gutierrez wrote:\n\n> I don't understand how it is a benefit to have \"git commit\" and \"git \n> diff\" do different diff functions. It confuses me.\n\nMatthieu said it better than I ever could.\n\nCiao,\nDscho\n"},{"id":"63694","messageId":"000d01c841c5$386f7350$762a14ac@na.acco.com","threadId":"11331","inReplyTo":"vpqsl1zfz8r.fsf@bauges.imag.fr","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-18T22:27:38Z","receivedAt":"2007-12-18T22:27:38Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":" \n> What you seem to expect is to tell git \"commit the changes \n> except this portion\", what you have to tell git is actually \n> \"commit the new state, but not if this portion is the only \n> change\". That sounds identical, but it's actually a bit different.\n\nIt's not what I'm saying.\n\nHere's what the git-commit manpage on kernel.org says: \"git-commit - Record\nchanges to the repository\".\n\nWhat I am saying is that if the user defines a custom diff, it is reasonable\nto believe that the user wants to teach git a new definition of \"changes\".\nIf that new definition says that the files have changed, then go ahead and\ncommit the new state. If that definition says there are no changes, then\nthere is nothing to commit. In other words:\n\nif (user_redefined_changed)\n  if (user_defn_of_changed(work, head)) commit(work);\nelse\n  if (builtin_changed(work, head)) commit(work);\n\nAs it is, it's not a big deal to me. Instead of teaching git the different\nconcept of \"changes\", I teach the script that runs git instead. But teaching\ngit directly just seems cleaner and more intuitive.\n\nGerald.\n"},{"id":"63695","messageId":"000e01c841c5$8c9e0c70$762a14ac@na.acco.com","threadId":"11331","inReplyTo":"vpqsl1zfz8r.fsf@bauges.imag.fr","subject":"RE: git with custom diff for commits","fromName":"Gerald Gutierrez","fromEmail":"ggmlfs@gmail.com","sentAt":"2007-12-18T22:29:55Z","receivedAt":"2007-12-18T22:29:55Z","isPatch":false,"sender":{"key":"ggmlfs@gmail.com","avatar":null},"body":" \n> if (user_redefined_changed)\n>   if (user_defn_of_changed(work, head)) commit(work); else\n>   if (builtin_changed(work, head)) commit(work);\n\nThat didn't come out quite right. It should be:\n\nif (user_redefined_changed) {\n  if (user_defn_of_changed(work, head)) { commit(work); }\n} else {\n  if (builtin_changed(work, head)) { commit(work); }\n}\n"},{"id":"63699","messageId":"Pine.LNX.4.64.0712182246230.23902@racer.site","threadId":"11331","inReplyTo":"000d01c841c5$386f7350$762a14ac@na.acco.com","subject":"RE: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T22:48:07Z","receivedAt":"2007-12-18T22:48:07Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Gerald Gutierrez wrote:\n\n[who said that?  (I know, but would you know in a few weeks?  Right.)]\n\n> > What you seem to expect is to tell git \"commit the changes except this \n> > portion\", what you have to tell git is actually \"commit the new state, \n> > but not if this portion is the only change\". That sounds identical, \n> > but it's actually a bit different.\n> \n> It's not what I'm saying.\n> \n> Here's what the git-commit manpage on kernel.org says: \"git-commit - \n> Record changes to the repository\".\n\nYes.  Changes, as in \"take this _file_ instead\".  Not \"edit this file, \nremove those lines, add these here, etc.\".\n\nSo I think that you were saying exactly what Matthieu suggested.\n\nCiao,\nDscho\n"},{"id":"63710","messageId":"46a038f90712181552i46ecb1aof55c7cdfe0f5c079@mail.gmail.com","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712182246230.23902@racer.site","subject":"Re: git with custom diff for commits","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-12-18T23:52:58Z","receivedAt":"2007-12-18T23:52:58Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On Dec 19, 2007 11:48 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Yes.  Changes, as in \"take this _file_ instead\".  Not \"edit this file,\n> remove those lines, add these here, etc.\".\n\nExactly. GIT is a \"content tracker\" that doesn't care about any\nsemantic meaning in your files. Here's the file, git will store it, as\nis. No conversions, not fancy interpretations. Strict, safe and fast.\n(There's a small exception there for DOS-style newlines, which was\nmuch resisted.)\n\nYou can add external machinery that is aware of your content semantics\n-- as you've done with calling GNU diff with ignore patterns to decide\nwhether to commit or not. But when you tell GIT to commit something,\nthere's no guessing or transformation involved.\n\nA lot of what GIT achieves is based on that founding principle. Remove\nit, and we're toast. For starters, the internal machinery is based on\nSHA1 digests that change if you flip a single byte. That's what makes\ngit fast and realiable. It's not merely an end-user thing.\n\ncheers,\n\n\nm\n"},{"id":"63728","messageId":"vpqtzmfvz1d.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712182246230.23902@racer.site","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-19T09:01:18Z","receivedAt":"2007-12-19T09:01:18Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> Here's what the git-commit manpage on kernel.org says: \"git-commit - \n>> Record changes to the repository\".\n>\n> Yes.  Changes, as in \"take this _file_ instead\".  Not \"edit this file, \n> remove those lines, add these here, etc.\".\n\nThat said, I think the wording of the man page could be better.\nPerhaps \"Record new snapshot to the repository\" or \"Record current\nstate of the working tree to the repository\".\n\nI can't find something wich is both accurate and newbie friendly ...\n(\"accurate\" would probably be \"Record index content into the\nrepository\")\n\n-- \nMatthieu\n"},{"id":"63730","messageId":"vpqodcnvygm.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"000d01c841c5$386f7350$762a14ac@na.acco.com","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-19T09:13:45Z","receivedAt":"2007-12-19T09:13:45Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Gerald Gutierrez\" <ggmlfs@gmail.com> writes:\n\n> if (user_redefined_changed)\n>   if (user_defn_of_changed(work, head)) commit(work);\n> else\n>   if (builtin_changed(work, head)) commit(work);\n\nThat would lead to even less intuitive semantics.\n\nSuppose your working tree has two changes, like\n\n--- a/file\n+++ b/file\n@@ ... @@\n-old ignored line\n+new ignored line\n@@ ... @@\n-this is relevant\n+change\n\nWhat would git be supposed to do if you ignore anything containing\n\"ignored\"?\n\nIf git commits, it will commit both changes. People checking-out the\nnew revision will get \"new ignored line\" in the file. So, a portion of\nthe diff that you wanted to ignore has actually gone into the\nrepository. IOW, whether \"new ignored line\" would go into the\nrepository depends on the presence of another unrelated change.\n\nPerhaps you would have expected this, but I wouldn't, and I bet many\nother users wouldn't either. And usually, when you can't have people\nagree on a common reasonable semantics, the answer is \"don't put it in\ngit, let people script the semantics they want\".\n\n\nTake another example : I use an external diff tool to work with\nOpenDocument files. It converts them into text, and calls \"git diff\"\non them. My diff driver therefore ignores formatting changes. If I\nmade only content changes, I get no change with this diff driver.\nStill, if I commit, I expect git to record my new formatting.\n\n-- \nMatthieu\n"},{"id":"63759","messageId":"Pine.LNX.4.64.0712191209140.23902@racer.site","threadId":"11331","inReplyTo":"vpqtzmfvz1d.fsf@bauges.imag.fr","subject":"Re: git with custom diff for commits","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-19T12:09:41Z","receivedAt":"2007-12-19T12:09:41Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 19 Dec 2007, Matthieu Moy wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> Here's what the git-commit manpage on kernel.org says: \"git-commit - \n> >> Record changes to the repository\".\n> >\n> > Yes.  Changes, as in \"take this _file_ instead\".  Not \"edit this file, \n> > remove those lines, add these here, etc.\".\n> \n> That said, I think the wording of the man page could be better.\n> Perhaps \"Record new snapshot to the repository\" or \"Record current\n> state of the working tree to the repository\".\n\nHow about \"record a new revision\"?\n\nCiao,\nDscho\n"},{"id":"63761","messageId":"vpq1w9iopbf.fsf@bauges.imag.fr","threadId":"11331","inReplyTo":"Pine.LNX.4.64.0712191209140.23902@racer.site","subject":"Re: git with custom diff for commits","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-19T12:13:08Z","receivedAt":"2007-12-19T12:13:08Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Wed, 19 Dec 2007, Matthieu Moy wrote:\n>\n>> That said, I think the wording of the man page could be better.\n>> Perhaps \"Record new snapshot to the repository\" or \"Record current\n>> state of the working tree to the repository\".\n>\n> How about \"record a new revision\"?\n\nSounds good, yes.\n\n-- \nMatthieu\n"}]}