{"thread":{"id":"5958","subject":"\"stage files\" vs \"cached files\"","startedAt":"2006-10-19T13:45:25Z","lastAt":"2006-10-19T15:58:52Z","messageCount":3,"participants":["Jerome Lovy","Linus Torvalds","Andy Whitcroft"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"29243","messageId":"eh7vl2$unr$1@sea.gmane.org","threadId":"5958","inReplyTo":null,"subject":"\"stage files\" vs \"cached files\"","fromName":"Jerome Lovy","fromEmail":"t2a2e9z8ncbs9qg@brefemail.com","sentAt":"2006-10-19T13:45:25Z","receivedAt":"2006-10-19T13:45:25Z","isPatch":false,"sender":{"key":"t2a2e9z8ncbs9qg@brefemail.com","avatar":null},"body":"Hi,\n\nafter having read tutorial1+2, I thought the following were more or less \nsynonyms: index ~ directory cache ~ staging area\n\nBut then I discover that --cache and --staged are two different things, \nnotably when using ls-files.\n\nThe documentation states indeed:\n  \"--cached   Show cached files in the output\"\n  \"--stage    Show stage files in the output\"\n\nI'm a bit confused. Is maybe a \"stage file\" entry missing in the glossary?\n\nTIA for clarification/pointer.\nJérôme\n"},{"id":"29244","messageId":"Pine.LNX.4.64.0610190853180.3962@g5.osdl.org","threadId":"5958","inReplyTo":"eh7vl2$unr$1@sea.gmane.org","subject":"Re: \"stage files\" vs \"cached files\"","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-10-19T15:58:27Z","receivedAt":"2006-10-19T15:58:27Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 19 Oct 2006, Jerome Lovy wrote:\n> \n> after having read tutorial1+2, I thought the following were more or less\n> synonyms: index ~ directory cache ~ staging area\n> \n> But then I discover that --cache and --staged are two different things,\n> notably when using ls-files.\n> \n> The documentation states indeed:\n>  \"--cached   Show cached files in the output\"\n>  \"--stage    Show stage files in the output\"\n\nThat is indeed confusing.\n\nIt shouldn't be \"stage files\". It should be \"file stages\".\n\nThe \"stage\" of a file is something that is meaningful on merges. Normally \nall files are in \"stage 0\", which means that it's fully merged. So when \nyou do\n\n\tgit ls-files --stage\n\nyou'll see a listing of all the files, with their file modes, SHA1's, \n\"stage\" and filename. And you'll basically always see \"0\" in the stage \ncolumn.\n\nBut if you have had a merge that didn't resolve automatically, you can see \nthe same filename listed up to three times, with stages 1, 2 and 3 (a zero \nwill never be combined with any other stage - you'll only see a zero \nalone).\n\nThat just shows how that particular file came to be: a \"stage 1\" entry is \nthe base branch version (the \"common ancestor\"), while stages 2 and 3 are \nthe first and second branch respectively.\n\n> I'm a bit confused. Is maybe a \"stage file\" entry missing in the glossary?\n\nThat term doesn't exist, so it shouldn't be in the glossary (or in any \nman-pages). But the \"merge stage\" _of_ a file is a real concept.\n\n\t\t\tLinus\n"},{"id":"29245","messageId":"4537A0BC.5040301@shadowen.org","threadId":"5958","inReplyTo":"eh7vl2$unr$1@sea.gmane.org","subject":"Re: \"stage files\" vs \"cached files\"","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-10-19T15:58:52Z","receivedAt":"2006-10-19T15:58:52Z","isPatch":false,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Jerome Lovy wrote:\n> Hi,\n> \n> after having read tutorial1+2, I thought the following were more or less\n> synonyms: index ~ directory cache ~ staging area\n> \n> But then I discover that --cache and --staged are two different things,\n> notably when using ls-files.\n> \n> The documentation states indeed:\n>  \"--cached   Show cached files in the output\"\n>  \"--stage    Show stage files in the output\"\n> \n> I'm a bit confused. Is maybe a \"stage file\" entry missing in the glossary?\n> \n> TIA for clarification/pointer.\n> Jérôme\n\nThis is not stage as in staging area, its stage as in 'at a cirtain\nstage'.  It refers to files which are in the index but are in conflict.\n\nThe cache doesn't just contain an entry for each file.  It contains an\nentry for each file version in a merge situation.  These are referred to\nas 'stages'.  There is a description in the documentation about how they\nget pushed 'down' to stage 0 and then are deemed merged (see\nDocumentation/core-tutorial.txt).\n\nBelow is the git ls-files --cached, and --stage output from a repo which\nhas one file 'bar' which is fine and another 'bar' which has a conflict.\n\n  apw@pinky$ git ls-files --cached\n  bar\n  this\n  this\n  this\n  apw@pinky$ git ls-files --stage\n  100644 8dc5f23c673e9c1ac8dd3499f9acab11b093527f 0       bar\n  100644 01e79c32a8c99c557f0757da7cb6d65b3414466d 1       this\n  100644 fbbafbfdaadbff9c7f8db580f91a8ab5a0653704 2       this\n  100644 10c8337d3d240283bdf35af68d17d1319ca069a4 3       this\n\nNote that there is in fact three 'this's in the index.  The first entry\nis bar which is in stage 0 and is merged fine.  'this' however appears\nthree times.  1 represents the common parent of the merge (I believe)\nand 2 and 3 represent the conflicting options for that.  The 'this' on\ndisk has the mangled version with both sets of changes in, but this\ninformation can be used to show the actual files in the various forms.\n\n  apw@pinky$ git cat-file blob :1:this\n  1\n  2\n  3\n  apw@pinky$ git cat-file blob :2:this\n  1\n  2b\n  3\n  apw@pinky$ git cat-file blob :3:this\n  1\n  2a\n  3\n  apw@pinky$ cat this\n  1\n  <<<<<<< HEAD/this\n  2b\n  =======\n  2a\n  >>>>>>> c2acfdd8e6a50e571a007744e023c65c7b188dbf/this\n  3\n\n-apw\n"}]}