{"thread":{"id":"3485","subject":"someone changed the contents of my HEAD.","startedAt":"2006-02-28T03:04:46Z","lastAt":"2006-02-28T05:58:47Z","messageCount":3,"participants":["Dave Jones","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16878","messageId":"20060228030446.GA23490@redhat.com","threadId":"3485","inReplyTo":null,"subject":"someone changed the contents of my HEAD.","fromName":"Dave Jones","fromEmail":"davej@redhat.com","sentAt":"2006-02-28T03:04:46Z","receivedAt":"2006-02-28T03:04:46Z","isPatch":false,"sender":{"key":"davej@redhat.com","avatar":null},"body":"I just tried to check in some changes to some trees\non master.kernel.org, and found after the first checkin\nthat git claimed..\n\nfatal: Not a git repository\n\nA lot of head-scratching later, I think I've figured out\nwhat's happened.  It seems there was a recent upgrade\nto the version of git on m.k.o, which is incompatible\nwith the helper scripts I used before.\n\nWhen checking in changes previously, I used this..\n\n#!/bin/sh\nexport GIT_AUTHOR_NAME=\"$1\"\nexport GIT_AUTHOR_EMAIL=\"$2\"\ntree=$(git-write-tree) || exit 1\ncommit=$(git-commit-tree $tree -p HEAD) || exit 1\necho $commit > .git/HEAD\n\nand called it thus..\n\ncommit-as \"Dave Jones\" \"<davej@redhat.com>\"\n\nPreviously, this updated .git/HEAD to a ptr to the latest committed change.\nAll was well, as I only ever have one HEAD in my trees.\n\nWith the new .git however, when I clone a new tree, .git/HEAD\ncontains ref: refs/heads/master, so my script destroys the git metadata.\n\nFor my newly created repos, this isn't a problem, as I can fudge my\ncommit-as script to write to .git/refs/heads/master instead, but\nmy concern now is the unpulled changes in the existing repos\nI have on master.  Will Linus be able to pull those into his tree\nwith git 1.2.3, or will I have to recreate those repos with the\nnew-style .git/HEAD ?\n\n\t\tDave\n"},{"id":"16885","messageId":"7vlkvwt5v9.fsf@assigned-by-dhcp.cox.net","threadId":"3485","inReplyTo":"20060228030446.GA23490@redhat.com","subject":"Re: someone changed the contents of my HEAD.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-28T05:22:18Z","receivedAt":"2006-02-28T05:22:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dave Jones <davej@redhat.com> writes:\n\n> When checking in changes previously, I used this..\n>\n> #!/bin/sh\n> export GIT_AUTHOR_NAME=\"$1\"\n> export GIT_AUTHOR_EMAIL=\"$2\"\n> tree=$(git-write-tree) || exit 1\n> commit=$(git-commit-tree $tree -p HEAD) || exit 1\n> echo $commit > .git/HEAD\n\nThis has been deprecated for a looong time, but perhaps I should\nhave been louder.  \"git commit --author\" should be fine -- I do\nnot think you do not even need such a wrapper.\n\n> For my newly created repos, this isn't a problem, as I can fudge my\n> commit-as script to write to .git/refs/heads/master instead, but\n> my concern now is the unpulled changes in the existing repos\n> I have on master.  Will Linus be able to pull those into his tree\n> with git 1.2.3, or will I have to recreate those repos with the\n> new-style .git/HEAD ?\n\nA .git/HEAD symlink pointing at refs/heads/master _is_ still\n(and will be) supported, so either symlink or symref is fine.\nBare SHA1 object name in HEAD is not -- git would not know which\nbranch you are on, so \"checkin\" would not work after that.\n\nYour refs/heads/master might be stale (one rev or more older\nthan what you replaced .git/HEAD with) but still should be a\nproper ancestor.  After making sure your refs/heads/master has\nthe right commit (you may have it there already if you have been\nupdating them using \"git-push\"), running \"git-symbolic-ref HEAD\nrefs/heads/master\" would fix things.\n"},{"id":"16888","messageId":"20060228055847.GC28434@redhat.com","threadId":"3485","inReplyTo":"7vlkvwt5v9.fsf@assigned-by-dhcp.cox.net","subject":"Re: someone changed the contents of my HEAD.","fromName":"Dave Jones","fromEmail":"davej@redhat.com","sentAt":"2006-02-28T05:58:47Z","receivedAt":"2006-02-28T05:58:47Z","isPatch":false,"sender":{"key":"davej@redhat.com","avatar":null},"body":"On Mon, Feb 27, 2006 at 09:22:18PM -0800, Junio C Hamano wrote:\n > > #!/bin/sh\n > > export GIT_AUTHOR_NAME=\"$1\"\n > > export GIT_AUTHOR_EMAIL=\"$2\"\n > > tree=$(git-write-tree) || exit 1\n > > commit=$(git-commit-tree $tree -p HEAD) || exit 1\n > > echo $commit > .git/HEAD\n > \n > This has been deprecated for a looong time, but perhaps I should\n > have been louder.  \"git commit --author\" should be fine -- I do\n > not think you do not even need such a wrapper.\n\nI guess I wasn't paying attention :)\nIt's worked just fine up until a few days ago.\nI can change my habits to use the preferred approach though.\n\n > > For my newly created repos, this isn't a problem, as I can fudge my\n > > commit-as script to write to .git/refs/heads/master instead, but\n > > my concern now is the unpulled changes in the existing repos\n > > I have on master.  Will Linus be able to pull those into his tree\n > > with git 1.2.3, or will I have to recreate those repos with the\n > > new-style .git/HEAD ?\n >\n > A .git/HEAD symlink pointing at refs/heads/master _is_ still\n > (and will be) supported, so either symlink or symref is fine.\n > Bare SHA1 object name in HEAD is not -- git would not know which\n > branch you are on, so \"checkin\" would not work after that.\n > \n > Your refs/heads/master might be stale (one rev or more older\n > than what you replaced .git/HEAD with) but still should be a\n > proper ancestor.  After making sure your refs/heads/master has\n > the right commit (you may have it there already if you have been\n > updating them using \"git-push\"), running \"git-symbolic-ref HEAD\n > refs/heads/master\" would fix things.\n\nOne scary thing fell out of this.  Andrew did a pull on my trees\nand found bogons in both of them.  Both agpgart and cpufreq trees\ncontained partial (1 file) reverts of earlier commits in my last commit\nto the head of each repo.  I can't explain how that happened, and\nI'm surprised my head-munging would be the reason.\n\nI've just rebuilt those two repos as there was only 3-4 patches\nin both, so it wasn't a big deal. Something to watch out for\nthough if anyone else has been doing something similar to how\nI was doing checkins.\n\n\t\tDave\n"}]}