{"thread":{"id":"11405","subject":"Using git for file archival/backup purposes - deletion strategy","startedAt":"2007-12-26T22:43:48Z","lastAt":"2007-12-27T22:08:20Z","messageCount":4,"participants":["Martin Langhoff","Johannes Sixt","Charles Bailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64107","messageId":"46a038f90712261443t6aa0cd76u46d8ae88fc7c1eba@mail.gmail.com","threadId":"11405","inReplyTo":null,"subject":"Using git for file archival/backup purposes - deletion strategy","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-12-26T22:43:48Z","receivedAt":"2007-12-26T22:43:48Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"Hi list!\n\nI am drafting a tool to use GIT as a behind-the-scenes archival/backup\ntool for web applications. There's been countless threads covering\ngeneric file archival, discussing /etc and homedirs, so I am pretty\ncomfortable with the mechanics and the whole idea. This is a fairly\nnarrow use, where the web apps are reasonable well behaved -- most\n(all?) of the caveats in ~ and /etc archival seem to be under control.\n\nWhat I am not 100% clear on is the \"old history\" deletion strategy.\nThe history will be *strictly* linear, so my intention is to keep the\nlast N commits, by overriding the parent of the Nth commit that git\nlog lists with a \"shallow\" entry in $GIT_DIR/shallow as documented in\nDocumentation/technical/shallow.txt , and call gc after that.\n\nIs that the correct way to \"forget\" old history? Searching high and\nlow in the list, I fail to find a definitive answer. Shallow and\ngrafts entries are discussed as ways of doing this, but I can't find a\n\"correct\" way of doing this.\n\nBTW I've just done a git clone --depth 10 ~/src/git and while I do get\na clearly \"shallow\" checkout, with a tiny .git/objects directory, I\ncan't find any file called shallow, or grafts. .git/config doesn't say\nanything either, and alternates is empty. I frankly cannot tell how\ngit recognizes it as a shallow repo.\n\nAh! Local clones won't honour --depth!. A clone from git.kernel.org\ndoes get its .git/shallow file.\n\nSo the question is: is it safe (and enough) to add the SHA1 to the\n.git/shallow file and call git gc? Is there a better way?\n\ncheers,\n\n\nm\n"},{"id":"64119","messageId":"47736DE5.40509@viscovery.net","threadId":"11405","inReplyTo":"46a038f90712261443t6aa0cd76u46d8ae88fc7c1eba@mail.gmail.com","subject":"Re: Using git for file archival/backup purposes - deletion strategy","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2007-12-27T09:18:29Z","receivedAt":"2007-12-27T09:18:29Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Martin Langhoff schrieb:\n> What I am not 100% clear on is the \"old history\" deletion strategy.\n> The history will be *strictly* linear, so my intention is to keep the\n> last N commits, by overriding the parent of the Nth commit that git\n> log lists with a \"shallow\" entry in $GIT_DIR/shallow as documented in\n> Documentation/technical/shallow.txt , and call gc after that.\n> \n> Is that the correct way to \"forget\" old history? Searching high and\n> low in the list, I fail to find a definitive answer. Shallow and\n> grafts entries are discussed as ways of doing this, but I can't find a\n> \"correct\" way of doing this.\n\nI'm doing something like this. Basically:\n\n   git rev-parse \"HEAD~$N\" > .git/info/grafts\n   git filter-branch -f HEAD\n\nIf you omit filter-branch, then a repack -a -d will corrupt the repository\n(I think) unless you keep the grafts file with it and in all its clones\nforever.\n\n-- Hannes\n"},{"id":"64123","messageId":"4773D498.8040204@hashpling.org","threadId":"11405","inReplyTo":"46a038f90712261443t6aa0cd76u46d8ae88fc7c1eba@mail.gmail.com","subject":"Re: Using git for file archival/backup purposes - deletion strategy","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2007-12-27T16:36:40Z","receivedAt":"2007-12-27T16:36:40Z","isPatch":false,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"Martin Langhoff wrote:\n> Ah! Local clones won't honour --depth!. A clone from git.kernel.org\n> does get its .git/shallow file.\n\nThis should be fixed in git v1.5.4-rc0 and later.  For reference \nwhat version of git are you using?\n\nCharles.\n"},{"id":"64125","messageId":"46a038f90712271408k7763d60ai93491f59c75d0e35@mail.gmail.com","threadId":"11405","inReplyTo":"4773D498.8040204@hashpling.org","subject":"Re: Using git for file archival/backup purposes - deletion strategy","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-12-27T22:08:20Z","receivedAt":"2007-12-27T22:08:20Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On Dec 28, 2007 5:36 AM, Charles Bailey <charles@hashpling.org> wrote:\n> Martin Langhoff wrote:\n> > Ah! Local clones won't honour --depth!. A clone from git.kernel.org\n> > does get its .git/shallow file.\n>\n> This should be fixed in git v1.5.4-rc0 and later.  For reference\n> what version of git are you using?\n\nGood point. I was using a 1.5.3xx. I can confirm it's fixed with\n1.5.4.rc1.1136.g2794f - I get the shallow clone I expected.\n\ncheers!\n\n\nm\n"}]}