{"thread":{"id":"24548","subject":"finding if a commit is needed","startedAt":"2010-07-28T08:53:38Z","lastAt":"2010-07-30T10:16:54Z","messageCount":3,"participants":["Geoff Russell","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146594","messageId":"AANLkTin4o=uNBFELYMb8TDA=taGJyqpLvgxZcPFr+Pq+@mail.gmail.com","threadId":"24548","inReplyTo":null,"subject":"finding if a commit is needed","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2010-07-28T08:53:38Z","receivedAt":"2010-07-28T08:53:38Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"We have an interface which \"rolls back\" commits to a previous time in\na set of data files using read-tree.\n\nWorks great ... but sometimes there are files which have\nbeen changed in the working tree which cause read-tree to fail.\nThe files should have been committed but weren't.\n\"git read-tree -i\" isn't appropriate because\nwe want to commit these files before the read-tree rolls\nthem back ... because they are changes which might be\nresurrected and we don't want to lose them altogether.\n\nSo ...\n\n       git commit -a -m \"something\" && git read-tree ...\n\nDoesn't work when there are no files which need committing ...\n\n       git commit -a -m \"something\" || git read-tree ...\n\nDoesn't work when there are.\n\nIs there something which can test whether a commit is needed?\n\nI define \"needed\" as meaning when git commit -a would make a non-identical\ncommit.\n\nMany thanks,\nGeoff.\n"},{"id":"146667","messageId":"20100729000647.GB29156@dert.cs.uchicago.edu","threadId":"24548","inReplyTo":"AANLkTin4o=uNBFELYMb8TDA=taGJyqpLvgxZcPFr+Pq+@mail.gmail.com","subject":"Re: finding if a commit is needed","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-29T00:06:48Z","receivedAt":"2010-07-29T00:06:48Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Geoff Russell wrote:\n\n> Is there something which can test whether a commit is needed?\n> \n> I define \"needed\" as meaning when git commit -a would make a non-identical\n> commit.\n\nMaybe \"git diff --exit-code HEAD\"?\n\nRegards,\nJonathan\n"},{"id":"146771","messageId":"AANLkTinvLVJbnZ4ZnrszV1taDUS3B-0aWYoD1Q5UyFtA@mail.gmail.com","threadId":"24548","inReplyTo":"20100729000647.GB29156@dert.cs.uchicago.edu","subject":"Re: finding if a commit is needed","fromName":"Geoff Russell","fromEmail":"geoffrey.russell@gmail.com","sentAt":"2010-07-30T10:16:54Z","receivedAt":"2010-07-30T10:16:54Z","isPatch":false,"sender":{"key":"geoffrey.russell@gmail.com","avatar":"https://gravatar.com/avatar/c30f497ccfa6bf06d86f30bd2ba092a2dd124c61c6bc902f7cb5c3f6486947de?d=mp&s=160"},"body":"On Thu, Jul 29, 2010 at 9:36 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Geoff Russell wrote:\n>\n>> Is there something which can test whether a commit is needed?\n>>\n>> I define \"needed\" as meaning when git commit -a would make a non-identical\n>> commit.\n>\n> Maybe \"git diff --exit-code HEAD\"?\n\nThanks ... \"git diff --quiet || echo differences\"\n\nCheers,\nGeoff.\n\n>\n> Regards,\n> Jonathan\n>\n\n\n\n-- \n6 Fifth Ave,\nSt Morris, S.A. 5068\nAustralia\nPh: 041 8805 184 / 08 8332 5069\nhttp://perfidy.com.au\n"}]}