{"thread":{"id":"6223","subject":"clarification on git-update-index --remove","startedAt":"2007-01-04T19:29:32Z","lastAt":"2007-01-04T20:27:43Z","messageCount":2,"participants":["David Tweed","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"30831","messageId":"e1dab3980701041129l3944df8ep985141d8f436d0a7@mail.gmail.com","threadId":"6223","inReplyTo":null,"subject":"clarification on git-update-index --remove","fromName":"David Tweed","fromEmail":"david.tweed@gmail.com","sentAt":"2007-01-04T19:29:32Z","receivedAt":"2007-01-04T19:29:32Z","isPatch":false,"sender":{"key":"david.tweed@gmail.com","avatar":null},"body":"Hi, can someone who understands the index in git please clarify something\nfor me? Looking at the documentation it's not totally clear which entites\nare referred to by \"removed\" and what that then implies.\n\nfrom git-1.4.4.3/Documentation/git-update-index.txt <<<<<<<<<<<\n--remove::\n\tIf a specified file is in the index but is missing then it's\n\tremoved.\n\tDefault behavior is to ignore removed file.\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n\nI currently take this to mean\n\n\"With --remove, if there is a filepath in the index\nand that filepath is in the list of files being fed to this instance\nof git-update-index but in the working directory tree that filepath\ndoes not currently exist, then upon termination remove the\nfilepath's record from the index.\n[This means at the next commit it will not be present\nat all in the set of files recorded via this commit.]\n\nDefault behaviour in that situation is to leave the index's\ncurrent record unaltered.\n[This means that that filename will be, upon a commit,\nrecorded as having whatever sha-content the index currently records\nit as having.]\"\n\nIf this reading is right, this means that I have to pass the names of\nfiles that have been removed otherwise they'll stay with their \"last\ncontents before removal\"? I'm currently finding removed files\n\"stay around in snapshots with their ultimate contents\", and I now\n_think_ this is the reason but I'm not sure.\n\n(In case anyone's wants to know the context, I traced through and\ndistilled git-commit.sh to what I think\nI need (rexpressed in python) with the core \"make snapshot\" code being\n\n<<<<<<<<<<<<<<<<\n    p1=loggedPopen([\"git-update-index\",\"-z\",\"--add\",\"--remove\",\"--stdin\"],\n                   stdin=PIPE)\n    for (d,fs) in files.iteritems(): # enters only \"to be recorded\" items\n        for f in fs:\n            p1.stdin.write(os.path.join(d,f)+\"\\0\")\n    p1.stdin.close()\n    p1.wait()\n    tree=loggedPopen([\"git-write-tree\"],stdout=PIPE).communicate()[0].rstrip()\n    commit=loggedPopen([\"git-commit-tree\",tree,\"-p\",\"HEAD\"],\n                       stdin=PIPE,stdout=PIPE).communicate(\"cv\")[0].rstrip()\n<<<<<<<<<<<<<<<<<\n\nHere files contains the set of files to be recorded in the current snapshot,\nstructured as (directory,set of files in directory).)\n\nMany thanks for any insight,\n-- \ncheers, dave tweed__________________________\ndavid \"DOT\" tweed \"AT\" gmail \"DOT\" com\nRm 124, School of Systems Engineering, University of Reading.\nDetails are all that matters; God dwells there, and you never get to\nsee Him if you don't struggle to get them right. -- Stephen Jay Gould\n"},{"id":"30835","messageId":"7vwt42k05c.fsf@assigned-by-dhcp.cox.net","threadId":"6223","inReplyTo":"e1dab3980701041129l3944df8ep985141d8f436d0a7@mail.gmail.com","subject":"Re: clarification on git-update-index --remove","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-04T20:27:43Z","receivedAt":"2007-01-04T20:27:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"David Tweed\" <david.tweed@gmail.com> writes:\n\n> --remove::\n> \tIf a specified file is in the index but is missing then it's\n> \tremoved.\n> \tDefault behavior is to ignore removed file.\n\nIf necessary, better rewording to remove confusion is very much\nappreciated.\n\n\"update-index <path>...\" without options (that is \"Default\nbehaviour\") updates the index using the contents of the named\n<path> found on the filesystem.  It does _not_ add new paths to\nthe index, nor remove paths (that exists in the index) from the\nindex.\n\nGiving --add allows new paths to be added to the index if named\npaths are found on the filesystem.  Giving --remove allows\nexisting paths to be removed from the index if named paths are\nnot found on the filesystem.\n"}]}