{"thread":{"id":"403","subject":"questions about cg-update, cg-pull, and cg-clone.","startedAt":"2005-04-30T00:53:22Z","lastAt":"2005-05-03T17:20:57Z","messageCount":8,"participants":["Zack Brown","David A. Wheeler","Petr Baudis","Joel Becker","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2223","messageId":"20050430005322.GA5408@tumblerings.org","threadId":"403","inReplyTo":null,"subject":"questions about cg-update, cg-pull, and cg-clone.","fromName":"Zack Brown","fromEmail":"zbrown@tumblerings.org","sentAt":"2005-04-30T00:53:22Z","receivedAt":"2005-04-30T00:53:22Z","isPatch":false,"sender":{"key":"zbrown@tumblerings.org","avatar":null},"body":"Hi,\n\nI'm trying to figure out the new Cogito syntax. What is the difference between\ncg-update and cg-pull? Here is my take so far, please correct me:\n\n'cg-update branch-name' grabs any new changes from the upstream repository and\nmerges them into my local repository. If I've been editing files in my local\nrepository, the update attempts to merge the changes cleanly.\n\nNow, if the update is clean, a cg-commit is invoked automatically, and if the\nupdate is not clean, I then have to resolve any conflicts and give the cg-commit\ncommand by hand. But: what is the significance of either of these cg-commit\ncommands? Why should I have to write a changelog entry recording this merge? All\nI'm doing is updating my tree to be current. Why should I have to 'commit' that\nupdate?\n\nNow I look at 'cg-pull'. What does this do? The readme says something about\nprinting two ids, and being useful for diffs. But can't I do a diff after a\ncg-update and get the same result? I'm very confused about cg-pull right now.\n\nAlso, the README says that cg-clone and cg-init are identical, except that\ncg-clone creates a new directory for the repository. Is that really the only\ndifference? Why do we have cg-clone then?\n\nBe well,\nZack\n\n-- \nZack Brown\n"},{"id":"2229","messageId":"4272EF69.2090806@dwheeler.com","threadId":"403","inReplyTo":"20050430005322.GA5408@tumblerings.org","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"David A. Wheeler","fromEmail":"dwheeler@dwheeler.com","sentAt":"2005-04-30T02:37:29Z","receivedAt":"2005-04-30T02:37:29Z","isPatch":false,"sender":{"key":"dwheeler@dwheeler.com","avatar":"https://avatars.githubusercontent.com/u/813150?v=4"},"body":"Zack Brown wrote:\n> Hi,\n> \n> I'm trying to figure out the new Cogito syntax. What is the difference between\n> cg-update and cg-pull? Here is my take so far, please correct me:\n> \n> 'cg-update branch-name' grabs any new changes from the upstream repository and\n> merges them into my local repository. If I've been editing files in my local\n> repository, the update attempts to merge the changes cleanly.\n\nYes. \"cg-update branch-name\" is EXACTLY the same as\n  cg-pull branch-name && cg-merge branch-name\nYou can see this by examining the last lines of the cg-update script.\nBecause updating is one of the single most common operations for an SCM,\nit makes sense to have a single command that does it.\n\nCurrently cg-update without a branch name does \"recover deleted files\"\ninstead, but I think that's a wart & Petr agrees (that will probably\nget moved to a different command, see separate discussion).\n\n\n> Now, if the update is clean, a cg-commit is invoked automatically,\n\nCorrect; cg-merge calls \"cg-commit -C\" (ignore cache)\nif the merge is clean.\n\n> and if the\n> update is not clean, I then have to resolve any conflicts and give the cg-commit\n> command by hand.\n\nCorrect.\n\n> But: what is the significance of either of these cg-commit\n> commands? Why should I have to write a changelog entry recording this merge? All\n> I'm doing is updating my tree to be current. Why should I have to 'commit' that\n> update?\n\nI can't speak Petr, but I would guess that he's doing that because\nhe's trying to avoid data loss.\n\n> Now I look at 'cg-pull'. What does this do? The readme says something about\n> printing two ids, and being useful for diffs. But can't I do a diff after a\n> cg-update and get the same result? I'm very confused about cg-pull right now.\n\ncg-pull BRANCH copies any changes from the named branch into your\nrepository.  You could do a diff afterwards, yes, to get the\nsame results as long as the data is in your repository.  However,\nafter a successful merge the HEAD will be different from before\na successful merge, so the DEFAULT answers from a\ndiff will be different.\n\n\n> Also, the README says that cg-clone and cg-init are identical, except that\n> cg-clone creates a new directory for the repository. Is that really the only\n> difference? Why do we have cg-clone then?\n\nYou'll have to ask Petr.  My guess is that he has bigger plans\nfor cg-clone, what you're seeing is just the current stub.\n\nAnyway, hope my guessing helps.\n\n--- David A. Wheeler\n"},{"id":"2259","messageId":"20050430154808.GB5408@tumblerings.org","threadId":"403","inReplyTo":"4272EF69.2090806@dwheeler.com","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Zack Brown","fromEmail":"zbrown@tumblerings.org","sentAt":"2005-04-30T15:48:08Z","receivedAt":"2005-04-30T15:48:08Z","isPatch":false,"sender":{"key":"zbrown@tumblerings.org","avatar":null},"body":"On Fri, Apr 29, 2005 at 10:37:29PM -0400, David A. Wheeler wrote:\n> Zack Brown wrote:\n> >Now, if the update is clean, a cg-commit is invoked automatically,\n> \n> Correct; cg-merge calls \"cg-commit -C\" (ignore cache)\n> if the merge is clean.\n> \n> >and if the\n> >update is not clean, I then have to resolve any conflicts and give the \n> >cg-commit\n> >command by hand.\n> \n> Correct.\n> \n> >But: what is the significance of either of these cg-commit\n> >commands? Why should I have to write a changelog entry recording this \n> >merge? All\n> >I'm doing is updating my tree to be current. Why should I have to 'commit' \n> >that\n> >update?\n> \n> I can't speak Petr, but I would guess that he's doing that because\n> he's trying to avoid data loss.\n\nSo, what would be an appropriate comment for that commit? I have no idea\nwhat is changing on my tree in that case, all I know is that I'm merging from\nsomeone else. All I really want is their changes and their commit messages,\nnot one of my own that is meaningless.\n\nSo far I just type ^d when this happens, and leave the commit message blank.\n\nBe well,\nZack\n\n> \n> \n> --- David A. Wheeler\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n-- \nZack Brown\n"},{"id":"2398","messageId":"20050502195846.GC20818@pasky.ji.cz","threadId":"403","inReplyTo":"20050430005322.GA5408@tumblerings.org","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-02T19:58:46Z","receivedAt":"2005-05-02T19:58:46Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Apr 30, 2005 at 02:53:22AM CEST, I got a letter\nwhere Zack Brown <zbrown@tumblerings.org> told me that...\n> 'cg-update branch-name' grabs any new changes from the upstream repository and\n> merges them into my local repository. If I've been editing files in my local\n> repository, the update attempts to merge the changes cleanly.\n\nYes.\n\n> Now, if the update is clean, a cg-commit is invoked automatically, and if the\n> update is not clean, I then have to resolve any conflicts and give the cg-commit\n> command by hand. But: what is the significance of either of these cg-commit\n> commands? Why should I have to write a changelog entry recording this merge? All\n\nYou might want to write some special notes regarding the merge, e.g.\nwhen you want to describe some non-trivial conflict resolution, or even\ngive a short blurb of the changes you are merging.\n\nIf you don't know what to say, just press Ctrl-D. The first line of the\ncommit always says \"Merge with what_you_are_merging_with\".\n\n> I'm doing is updating my tree to be current. Why should I have to 'commit' that\n> update?\n\nIf you are only updating your tree to be current, you don't have to\ncommit, and in fact you don't commit (you do so-called \"fast-forward\nmerge\", which will just update your HEAD pointer to point at the newer\ncommit). You commit only when you were merging stuff (so-called \"tree\nmerge\"; well, that's at least how I call it to differentiate it from the\nfast-forward merge). That means you have some local commits over there -\nI can't just update your tree to be current, sorry. That would lose your\ncommit. I have to merge the changes into your tree through a merge\ncommit.\n\n> Now I look at 'cg-pull'. What does this do? The readme says something about\n> printing two ids, and being useful for diffs. But can't I do a diff after a\n> cg-update and get the same result? I'm very confused about cg-pull right now.\n\ncg-pull does the first part of cg-update. It is concerned by fetching\nthe stuff from the remote repository to the local one. cg-merge then\ndoes the second part, merging the stuff to your local tree (doing either\nfast-forward or tree merge).\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2475","messageId":"20050503152214.GA1704@tumblerings.org","threadId":"403","inReplyTo":"20050502195846.GC20818@pasky.ji.cz","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Zack Brown","fromEmail":"zbrown@tumblerings.org","sentAt":"2005-05-03T15:22:15Z","receivedAt":"2005-05-03T15:22:15Z","isPatch":false,"sender":{"key":"zbrown@tumblerings.org","avatar":null},"body":"On Mon, May 02, 2005 at 09:58:46PM +0200, Petr Baudis wrote:\n> Dear diary, on Sat, Apr 30, 2005 at 02:53:22AM CEST, I got a letter\n> where Zack Brown <zbrown@tumblerings.org> told me that...\n> > 'cg-update branch-name' grabs any new changes from the upstream repository and\n> > merges them into my local repository. If I've been editing files in my local\n> > repository, the update attempts to merge the changes cleanly.\n> \n> Yes.\n> \n> > Now, if the update is clean, a cg-commit is invoked automatically, and if the\n> > update is not clean, I then have to resolve any conflicts and give the cg-commit\n> > command by hand. But: what is the significance of either of these cg-commit\n> > commands? Why should I have to write a changelog entry recording this merge? All\n> \n> You might want to write some special notes regarding the merge, e.g.\n> when you want to describe some non-trivial conflict resolution, or even\n> give a short blurb of the changes you are merging.\n> \n> If you don't know what to say, just press Ctrl-D. The first line of the\n> commit always says \"Merge with what_you_are_merging_with\".\n> \n> > I'm doing is updating my tree to be current. Why should I have to 'commit' that\n> > update?\n> \n> If you are only updating your tree to be current, you don't have to\n> commit, and in fact you don't commit (you do so-called \"fast-forward\n> merge\", which will just update your HEAD pointer to point at the newer\n> commit). You commit only when you were merging stuff (so-called \"tree\n> merge\"; well, that's at least how I call it to differentiate it from the\n> fast-forward merge). That means you have some local commits over there -\n> I can't just update your tree to be current, sorry. That would lose your\n> commit. I have to merge the changes into your tree through a merge\n> commit.\n\nHm.\n\nSo, suppose I'm working on your Cogito HEAD. I make some changes to my local\ntree and commit them to my tree, and then before I go forward, I want to grab\nwhatever you've done recently, to make sure we're not in conflict before I add\nnew changes. If I understand you right, this situation would be a 'fast forward\nmerge'. So what is the command I give to just 'merge' your HEAD with mine,\nwithout requiring a changelog entry?\n\nAlternatively, suppose I'm you, the project lead, and Zackdude has some\nchanges for me, based on my HEAD. I want to 'merge' his tree into mine. If\nI'm still understanding you, this is a 'tree merge'. Now I give a cg-update,\nand now I *want* to give a changelog entry to record the merge.  Correct?\n\nNo, I still don't see it. I don't see why I would want to add an additional\nchangelog entry on top of whatever changelog entries Zackdude has made himself.\nIt just seems to pollute the changelog with entries that are essentially\nmeaningless. When I read back over the logs, I'm not going to be interested in\nthe bookkeeping of when I merged with various developers, I'm going to be\ninterested in what those developers actually did to the code, and what *I*\nactually did to the code.\n\n> \n> > Now I look at 'cg-pull'. What does this do? The readme says something about\n> > printing two ids, and being useful for diffs. But can't I do a diff after a\n> > cg-update and get the same result? I'm very confused about cg-pull right now.\n> \n> cg-pull does the first part of cg-update. It is concerned by fetching\n> the stuff from the remote repository to the local one. cg-merge then\n> does the second part, merging the stuff to your local tree (doing either\n> fast-forward or tree merge).\n\nOK, I don't understand this either. What is the difference between fetching the\nstuff and merging the stuff? Suppose I am working on a local repo of Cogito\nHEAD. I make some changes, commit them, and then I do a cg-pull. What happens?\nAre my changes overwritten? Do they show up at all? Do they exist in some\nnebulous ether that I will never see until I do a merge?\n\nBe well,\nZack\n\n> \n> -- \n> \t\t\t\tPetr \"Pasky\" Baudis\n> Stuff: http://pasky.or.cz/\n> C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n-- \nZack Brown\n"},{"id":"2480","messageId":"20050503155915.GV4747@ca-server1.us.oracle.com","threadId":"403","inReplyTo":"20050503152214.GA1704@tumblerings.org","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Joel Becker","fromEmail":"joel.becker@oracle.com","sentAt":"2005-05-03T15:59:15Z","receivedAt":"2005-05-03T15:59:15Z","isPatch":false,"sender":{"key":"joel.becker@oracle.com","avatar":null},"body":"On Tue, May 03, 2005 at 08:22:15AM -0700, Zack Brown wrote:\n> So, suppose I'm working on your Cogito HEAD. I make some changes to my local\n> tree and commit them to my tree, and then before I go forward, I want to grab\n> whatever you've done recently, to make sure we're not in conflict before I add\n> new changes. If I understand you right, this situation would be a 'fast forward\n> merge'. So what is the command I give to just 'merge' your HEAD with mine,\n> without requiring a changelog entry?\n\n\tRemember that HEAD is merely a SHA1 of the toplevel tree object.\nImagine you have the simplest tree, one directory containing one file.\nThe file has the has hash aaaaaa.  The tree object containing it has the\nhash bbbbbb.  So, HEAD contains bbbbbb.\n\tNow you update from Petr, having made no changes.  You pull his\nnewest tree, which also has a new file.  That new file has the hash\ncccccc.  The new tree object, containing both files, now has the hash\ndddddd.  HEAD now contains dddddd.  As you are in a matching state to\nhis tree, you have not done anything interesting to your tree, and there\nis no commit.  This is a \"fast-forward\" merge.\n\tThen you change the first file, adding a few functions.  You\ncommit it, and it now has the hash 111111.  This change means the tree\nhash becomes 222222.  So, HEAD contains 222222.\n\tYou then update from Petr again.  He's changed the second file.\nIt's hash is no longer cccccc, it's eeeeee.  In his tree, the hash of\nthe tree is 333333 (from file 1's aaaaaa and file 2's eeeeee).  But the\nhash of your tree is 444444 (from your local file 1's 111111 and file 2's eeeeee).  So, the hash of the your tree becomes 444444.  Your HEAD contains 444444.\nThis does _not_ match his 333333 HEAD.  You are committing the\ncombination of his change and yours.  He is saying that this work, which\nmay have required hand-merging or commit resolution, is \"interesting\"\ninformation.\n\nJoel\n\n-- \n\nLife's Little Instruction Book #69\n\n\t\"Whistle\"\n\nJoel Becker\nSenior Member of Technical Staff\nOracle\nE-mail: joel.becker@oracle.com\nPhone: (650) 506-8127\n"},{"id":"2483","messageId":"Pine.LNX.4.21.0505031144280.30848-100000@iabervon.org","threadId":"403","inReplyTo":"20050503152214.GA1704@tumblerings.org","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-05-03T16:30:47Z","receivedAt":"2005-05-03T16:30:47Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 3 May 2005, Zack Brown wrote:\n\n> So, suppose I'm working on your Cogito HEAD. I make some changes to my local\n> tree and commit them to my tree, and then before I go forward, I want to grab\n> whatever you've done recently, to make sure we're not in conflict before I add\n> new changes. If I understand you right, this situation would be a 'fast forward\n> merge'. So what is the command I give to just 'merge' your HEAD with mine,\n> without requiring a changelog entry?\n\nIn this case, you have to do a tree merge, because you have some commits\nand he has some commits, and you want to be in a state where you have your\ncommits and his; this state is new, so you need a new commit with both\nlines as parents.\n\n> Alternatively, suppose I'm you, the project lead, and Zackdude has some\n> changes for me, based on my HEAD. I want to 'merge' his tree into mine. If\n> I'm still understanding you, this is a 'tree merge'. Now I give a cg-update,\n> and now I *want* to give a changelog entry to record the merge.  Correct?\n\nIn this case, you don't have any commits that the other guy doesn't\nhave. Zackdude took your tree, made some changes, and that's his\nhead. Your head is still the same. He's already specified what happens\nwhen you go from your head to his head; that's what he did, so the answer\nhas to be his head. That's a fast-forward.\n\nNow, if the project lead decided to update from a second contributor who\nhadn't rebased their contribution on the new head, then a merge is\nrequired, to resolve the potential conflicts, and this merge needs a\ncommit.\n\n> No, I still don't see it. I don't see why I would want to add an additional\n> changelog entry on top of whatever changelog entries Zackdude has made himself.\n> It just seems to pollute the changelog with entries that are essentially\n> meaningless. When I read back over the logs, I'm not going to be interested in\n> the bookkeeping of when I merged with various developers, I'm going to be\n> interested in what those developers actually did to the code, and what *I*\n> actually did to the code.\n\nIf developer A's changes work, and developer B's changes work, but they\ndon't work in your merge of them, you'll want to see that. Furthermore,\nwithout a commit with both of their commits as parents, you can't reach\nboth of their histories from anywhere.\n\n> OK, I don't understand this either. What is the difference between fetching the\n> stuff and merging the stuff? Suppose I am working on a local repo of Cogito\n> HEAD. I make some changes, commit them, and then I do a cg-pull. What happens?\n> Are my changes overwritten? Do they show up at all? Do they exist in some\n> nebulous ether that I will never see until I do a merge?\n\nIf you do a \"cg-pull pasky\", this doesn't change any of your stuff, but it\nmeans that \"cg-diff -r pasky\" will now compare against his new head,\nrather than the head he had when you previously did stuff. \"cg-log\npasky\" will include the new messages, and so forth. Also, you can then do\nthe merge without a network connection; you can pull overnight and merge\non the train.\n\nYou don't see anything different in your working directory, but your\nrepository essentially \"knows more\".\n\n\t-Daniel\n*This .sig left intentionally blank*\n\n\n"},{"id":"2488","messageId":"20050503172057.GW4747@ca-server1.us.oracle.com","threadId":"403","inReplyTo":"20050503155915.GV4747@ca-server1.us.oracle.com","subject":"Re: questions about cg-update, cg-pull, and cg-clone.","fromName":"Joel Becker","fromEmail":"joel.becker@oracle.com","sentAt":"2005-05-03T17:20:57Z","receivedAt":"2005-05-03T17:20:57Z","isPatch":false,"sender":{"key":"joel.becker@oracle.com","avatar":null},"body":"On Tue, May 03, 2005 at 08:59:15AM -0700, Joel Becker wrote:\n> \tThen you change the first file, adding a few functions.  You\n> commit it, and it now has the hash 111111.  This change means the tree\n> hash becomes 222222.  So, HEAD contains 222222.\n> \tYou then update from Petr again.  He's changed the second file.\n> It's hash is no longer cccccc, it's eeeeee.  In his tree, the hash of\n> the tree is 333333 (from file 1's aaaaaa and file 2's eeeeee).  But the\n> hash of your tree is 444444 (from your local file 1's 111111 and file 2's eeeeee).  So, the hash of the your tree becomes 444444.  Your HEAD contains 444444.\n> This does _not_ match his 333333 HEAD.  You are committing the\n> combination of his change and yours.  He is saying that this work, which\n> may have required hand-merging or commit resolution, is \"interesting\"\n> information.\n\n\tActually, it is more than interesting.  The tree has gone from a\nHEAD of 222222 to a HEAD of 444444.  When HEAD changes, you need a\ncommit to describe the path.  Otherwise, you have a breakdown in the\nhistory.  cg-log (or any other command) would have no way to get back\nfrom 444444 to 222222 (or Petr's 333333) without the commit object\nspecifying its parent(s).\n\tIf you have made no commits on your side, then the old HEAD is\nPetr's old HEAD, the new HEAD is Petr's new 333333, and he's already\ncreated a commit object describing this.  You're just fast-forwarding.\n\nJoel\n\n-- \n\n\"The nice thing about egotists is that they don't talk about other\n people.\"\n         - Lucille S. Harper\n\nJoel Becker\nSenior Member of Technical Staff\nOracle\nE-mail: joel.becker@oracle.com\nPhone: (650) 506-8127\n"}]}