{"thread":{"id":"62171","subject":"Using Git as a Database","startedAt":"2024-09-23T03:28:43Z","lastAt":"2024-09-25T16:47:55Z","messageCount":6,"participants":["Mateusz Wielgos","韩仰","email@mateuszwielgos.com","Andreas Schwab","rsbecker@nexbridge.com","Sergey Organov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"503238","messageId":"4B2B1EC7-6B08-4B57-A50F-702C031C2792@mateuszwielgos.com","threadId":"62171","inReplyTo":null,"subject":"Using Git as a Database","fromName":"Mateusz Wielgos","fromEmail":"email@mateuszwielgos.com","sentAt":"2024-09-23T03:28:26Z","receivedAt":"2024-09-23T03:28:43Z","isPatch":false,"sender":{"key":"email@mateuszwielgos.com","avatar":null},"body":"Hello,\n\nI would like to use Git as a database of sorts. Let’s say I want to track weight of something in a file. When the value changes I can commit the new one. I can also figure out all previous values. That’s awesome.\n\nWhat I am having trouble with is… What if a measurement is taken but there’s no change? I want to commit a file that hasn’t changed.\n\nThe only workaround I figured out is to toggle the executable bit.\n\nIs there anything else?\n\nThanks,\nMateusz\n\n"},{"id":"503240","messageId":"CAG1j3zEg47RLYrVfJQi7WubgcdtbK2RWFBtj5rd8NtkPyXU5Rg@mail.gmail.com","threadId":"62171","inReplyTo":"4B2B1EC7-6B08-4B57-A50F-702C031C2792@mateuszwielgos.com","subject":"Re: [External] Using Git as a Database","fromName":"韩仰","fromEmail":"hanyang.tony@bytedance.com","sentAt":"2024-09-23T03:48:23Z","receivedAt":"2024-09-23T03:48:35Z","isPatch":false,"sender":{"key":"hanyang.tony@bytedance.com","avatar":"https://avatars.githubusercontent.com/u/108711387?v=4"},"body":"You can use the --allow-empty option in git-commit to allow\nsuch commits.\n\nThanks,\nHan\n"},{"id":"503256","messageId":"0D0BB87D-9BF0-48BA-8F2D-83F8D326ECEC@mateuszwielgos.com","threadId":"62171","inReplyTo":"CAG1j3zEg47RLYrVfJQi7WubgcdtbK2RWFBtj5rd8NtkPyXU5Rg@mail.gmail.com","subject":"Re: [External] Using Git as a Database","fromName":"","fromEmail":"email@mateuszwielgos.com","sentAt":"2024-09-23T12:32:53Z","receivedAt":"2024-09-23T12:33:11Z","isPatch":false,"sender":{"key":"email@mateuszwielgos.com","avatar":null},"body":"Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is that the resulting commit is not associated with any particular file. I tried ‘git commit —allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log myfile.txt’ does not show the empty commit.\n\n> On Sep 22, 2024, at 10:48 PM, 韩仰 <hanyang.tony@bytedance.com> wrote:\n> \n> You can use the --allow-empty option in git-commit to allow\n> such commits.\n> \n> Thanks,\n> Han\n\n"},{"id":"503276","messageId":"87r09aus7v.fsf@igel.home","threadId":"62171","inReplyTo":"0D0BB87D-9BF0-48BA-8F2D-83F8D326ECEC@mateuszwielgos.com","subject":"Re: [External] Using Git as a Database","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2024-09-23T18:42:44Z","receivedAt":"2024-09-23T18:52:18Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Sep 23 2024, email@mateuszwielgos.com wrote:\n\n> Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is that the resulting commit is not associated with any particular file. I tried ‘git commit —allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log myfile.txt’ does not show the empty commit.\n\nSince the git model is snapshot based, there is no way around that,\napart from putting the reference in the commit message which you can\nsearch with git log --grep=myfile.txt.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"503280","messageId":"00d001db0dec$1c8fa320$55aee960$@nexbridge.com","threadId":"62171","inReplyTo":"87r09aus7v.fsf@igel.home","subject":"RE: [External] Using Git as a Database","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2024-09-23T19:09:22Z","receivedAt":"2024-09-23T19:09:49Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On September 23, 2024 2:43 PM, Andreas Schwab wrote:\n>On Sep 23 2024, email@mateuszwielgos.com wrote:\n>\n>> Thank you for your reply, Han. The problem that I have with ‘—allow-empty’ is\n>that the resulting commit is not associated with any particular file. I tried ‘git commit\n>—allow-empty myfile.txt’ but the file argument is effectively ignored. ‘git log\n>myfile.txt’ does not show the empty commit.\n>\n>Since the git model is snapshot based, there is no way around that, apart from\n>putting the reference in the commit message which you can search with git log --\n>grep=myfile.txt.\n\nOne way around this is to inject a date/timestamp in the file. Be careful about conflicts\nIf you every try to merge. This forces a signature change in the internal blob on\ncommit.\n\nI am not recommending this, just suggesting a way to force the issue.\n\n"},{"id":"503475","messageId":"87jzezhe89.fsf@osv.gnss.ru","threadId":"62171","inReplyTo":"4B2B1EC7-6B08-4B57-A50F-702C031C2792@mateuszwielgos.com","subject":"Re: Using Git as a Database","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2024-09-25T16:47:50Z","receivedAt":"2024-09-25T16:47:55Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Mateusz Wielgos <email@mateuszwielgos.com> writes:\n\n> Hello,\n>\n> I would like to use Git as a database of sorts. Let’s say I want to\n> track weight of something in a file. When the value changes I can\n> commit the new one. I can also figure out all previous values. That’s\n> awesome.\n>\n> What I am having trouble with is… What if a measurement is taken but\n> there’s no change? I want to commit a file that hasn’t changed.\n>\n> The only workaround I figured out is to toggle the executable bit.\n\nAs you are tracking weight or something like that over time, it's likely\nuseless without date, so just put time-stamp into the file as well:\n\n85kg 2024-09-25 19:45:14\n\n-- Sergey\n"}]}