{"thread":{"id":"9387","subject":"way to automatically add untracked files?","startedAt":"2007-08-05T03:31:42Z","lastAt":"2007-08-07T00:08:35Z","messageCount":40,"participants":["Miles Bader","Shawn O. Pearce","Junio C Hamano","Linus Torvalds","Johannes Schindelin","David Kastrup","Steffen Prohaska","Johan Herland","Theodore Tso","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"49800","messageId":"873ayymzc1.fsf@catnip.gol.com","threadId":"9387","inReplyTo":null,"subject":"way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T03:31:42Z","receivedAt":"2007-08-05T03:31:42Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"One thing I often want to do is git-add all untracked files, and also\nautomatically git-rm all \"disappeared\" files (I keep my .gitignore files\nwell maintained, so the list of adding/missing files shown by git status\nis almost always correct).  At the same time, I usually want to do \"git\nadd -u\" to git-add modified files.\n\nOne way to do this seems to be just \"git add .\", but I'm always slightly\nnervous using it because it sits there and churns the disk for an awful\nlong time (whereas \"git status\" is instantaneous).  Is this the right\nthing to do?  Is there something funny causing the churning?\n\nThanks,\n\n-Miles\n\n-- \nSaa, shall we dance?  (from a dance-class advertisement)\n"},{"id":"49802","messageId":"20070805035854.GF9527@spearce.org","threadId":"9387","inReplyTo":"873ayymzc1.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-08-05T03:58:54Z","receivedAt":"2007-08-05T03:58:54Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Miles Bader <miles@gnu.org> wrote:\n> One way to do this seems to be just \"git add .\", but I'm always slightly\n> nervous using it because it sits there and churns the disk for an awful\n> long time (whereas \"git status\" is instantaneous).  Is this the right\n> thing to do?  Is there something funny causing the churning?\n\nThat's the correct way to add those new files that aren't ignored.\nThe problem is actually a small bug in git-add; we did not take the\nobvious performance optimization of skipping files that are stat\nclean in the index.  So what is happening here during `git add .`\nis we are reading and hashing every single file, even if it is\nalready tracked and is not modified.  In short we're just working\nharder than we need to during this operation.\n\nI believe this has been fixed in git 1.5.3-rc3 or rc4.  Not sure\nwhich one; I don't have access to a git repository right now to\nlook it up.\n\n-- \nShawn.\n"},{"id":"49804","messageId":"fc339e4a0708042100jdf0a0f1jd1fddfb5dc1c1052@mail.gmail.com","threadId":"9387","inReplyTo":"873ayymzc1.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T04:00:13Z","receivedAt":"2007-08-05T04:00:13Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"I previously wrote\n> One thing I often want to do is git-add all untracked files, and also\n> automatically git-rm all \"disappeared\" files\n...\n> One way to do this seems to be just \"git add .\"\n\nOh, also, \"git add .\" doesn't seem to do the right thing with\n\"dissapeared\" files:  If I do:\n\n    mv foo.cc bar.cc\n    git add .\n\nthen git-status will show a new  file \"bar.cc\", but will list \"foo.cc\"\nas \"deleted \" in the \"Changed but not updated\" section.  Perhaps the\nright thing will happen if I do \"git-commit -a\" (though I don't know,\nI don't really want to try it), this still results in incorrect\n\"git-diff --cached\" output (it shows bar.cc as a new file, not as a\nrename of foo.cc).\n\nAm I doing something wrong, or is this just missing functionality?\n\nThanks,\n\n-Miles\n-- \nDo not taunt Happy Fun Ball.\n"},{"id":"49806","messageId":"20070805041320.GH9527@spearce.org","threadId":"9387","inReplyTo":"fc339e4a0708042100jdf0a0f1jd1fddfb5dc1c1052@mail.gmail.com","subject":"Re: way to automatically add untracked files?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-08-05T04:13:20Z","receivedAt":"2007-08-05T04:13:20Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Miles Bader <miles@gnu.org> wrote:\n> I previously wrote\n> > One thing I often want to do is git-add all untracked files, and also\n> > automatically git-rm all \"disappeared\" files\n> ...\n> > One way to do this seems to be just \"git add .\"\n> \n> Oh, also, \"git add .\" doesn't seem to do the right thing with\n> \"dissapeared\" files:  If I do:\n> \n>     mv foo.cc bar.cc\n>     git add .\n\nRight.  Who wants \"add\" to actually mean \"add and delete\"?\nShouldn't that be then called \"git-add-and-rm\"?\n\nWe recently talked about this on the mailing list and decided that\ngit-add shouldn't remove files that have disappeared, as doing so\nmight break most user's expections of what git-add does.\n\n> then git-status will show a new  file \"bar.cc\", but will list \"foo.cc\"\n> as \"deleted \" in the \"Changed but not updated\" section.  Perhaps the\n> right thing will happen if I do \"git-commit -a\" (though I don't know,\n> I don't really want to try it),\n\n\"git commit -a\" will remove disappeared files.  It has for quite\nsome time.\n\n> this still results in incorrect\n> \"git-diff --cached\" output (it shows bar.cc as a new file, not as a\n> rename of foo.cc).\n> \n> Am I doing something wrong, or is this just missing functionality?\n\nTry adding the -M option to \"git-diff\".  That will enable the rename\ndetection, and show the rename you are looking to see.\n\n-- \nShawn.\n"},{"id":"49807","messageId":"7vhcneipp3.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"20070805035854.GF9527@spearce.org","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-05T04:13:28Z","receivedAt":"2007-08-05T04:13:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> I believe this has been fixed in git 1.5.3-rc3 or rc4.\n\nThat performance fix is in rc4.\n"},{"id":"49809","messageId":"87lkcqlif2.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"20070805041320.GH9527@spearce.org","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T04:22:25Z","receivedAt":"2007-08-05T04:22:25Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n>>     mv foo.cc bar.cc\n>>     git add .\n>\n> Right.  Who wants \"add\" to actually mean \"add and delete\"?\n> Shouldn't that be then called \"git-add-and-rm\"?\n\n\"git-add .\" can just as easily be thought as meaning \"add the current\nstate of directory \".\", including additions and removals\"; removals,\nare, after all, part of the directory's state.\n\n>> Am I doing something wrong, or is this just missing functionality?\n>\n> Try adding the -M option to \"git-diff\".  That will enable the rename\n> detection, and show the rename you are looking to see.\n\nNo, it doesn't.\n\nThe problem seems to be not because git's rename detection isn't enabled\n(I have it turned on by default in my globaing settings), but rather\nbecause git hasn't been told about the removal.\n\nAnd I don't see anyway to automatically tell git \"please mark for\nremoval all files that seem to have disappeared\" -- \"git-add .\" doesn't do\nit, and git-rm doesn't seem to have any option for doing this.\n\nReally I want a single command that just tells git \"please add to the\nindex _all changes that you can find_\".\n\nThanks,\n\n-Miles\n\n-- \nA zen-buddhist walked into a pizza shop and\nsaid, \"Make me one with everything.\"\n"},{"id":"49810","messageId":"7v8x8qip7n.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"87lkcqlif2.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-05T04:23:56Z","receivedAt":"2007-08-05T04:23:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miles Bader <miles@gnu.org> writes:\n\n> Really I want a single command that just tells git \"please add to the\n> index _all changes that you can find_\".\n\n\"git add -u\"\n"},{"id":"49811","messageId":"87d4y2li2c.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"7v8x8qip7n.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T04:30:03Z","receivedAt":"2007-08-05T04:30:03Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n>> Really I want a single command that just tells git \"please add to the\n>> index _all changes that you can find_\".\n>\n> \"git add -u\"\n\nSo, to _really_ add all changes, I should give two commands:\n\n   git add .\n   git add -u\n\n?\n\n(I tried combining them:  \"git add -u .\", but that didn't seem to do\nanything useful)\n\n-Miles\n-- \no The existentialist, not having a pillow, goes everywhere with the book by\n  Sullivan, _I am going to spit on your graves_.\n"},{"id":"49814","messageId":"7v4pjeioi6.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"87d4y2li2c.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-05T04:39:13Z","receivedAt":"2007-08-05T04:39:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"You are talking about two different operations.\n\nAdding _new_ files, unless you are just beginning a new project,\nare much more rare than updating modified files that you are\nalready tracking; and \"git add new-file...\" is what people\nusually use for the former.  \"git add .\" is almost always the\n\"initial import\" and not used later (after all you ought to know\nwhat files you are creating and controlling ;-)).  You get into\nan illusion that that is often used, only when you have just\nstarted.  As your project progresses, that feeling will fade\naway.\n\nAnd that is natural, if you think about it for 5 seconds.\n\n\"Add everything in sight, although I do not know what they are\",\nwhich is essentially what \"git add .\" is, makes perfect sense\nfor the initial import and vendor drop (after perhaps rm -fr\n?*).  If you are doing your own development, with your working\ntree littered with build products and temporary notes files and\nwhatnot, \"git add .\" is usually the last thing you would want to\ndo.\n\nUpdating modified files, \"git add -u\", is more like \"git commit\n-a\" (without creating commit).  You do not add _new_ files, and\nthat is quite deliberate.\n\nYou _could_ argue that people should be more disciplined and\nwrite perfect .gitignore files so that \"git add .\" is always\nsafe, but the world does not work that way.\n"},{"id":"49816","messageId":"874pjelgyz.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"7v4pjeioi6.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T04:53:40Z","receivedAt":"2007-08-05T04:53:40Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n> You get into an illusion that that is often used, only when you have\n> just started.  As your project progresses, that feeling will fade\n> away.\n\nI imagine this depends strongly on the nature of the project.\n\nMy current comments stem from using git a personal project which I've\nbeen working on for about 2 years; maybe I'm weird, but I seem to\nadd/remove files fairly regularly (as far as I can tell, it's not an\nillusion :-).\n\n> And that is natural, if you think about it for 5 seconds.\n...\n> You _could_ argue that people should be more disciplined and\n> write perfect .gitignore files so that \"git add .\" is always\n> safe, but the world does not work that way.\n\nSigh.  There are all sorts of people using git, and everybody has their\nown working style.  My personal style involves keeping .gitignore\nup-to-date so that there's no cruft in the git-status output.\n\nAnyway, I wouldn't be complaining except that I _keep_ running into\ncircumstances where I need to type \"git-add NEWFILE1 NEWFILE2\nNEWFILE3...; git rm OLD_FILE1...\" -- which is kind of annoying after\nseeing a list of _exactly_ the files I need to add/remove output just\npreviously by git-status.  Thus my wish to have git \"do it\nautomatically.\"\n\n\"git-add -u; git-add .\" seems like it should do the job though.\n\nThanks,\n\n-Miles\n\n-- \nWe live, as we dream -- alone....\n"},{"id":"49818","messageId":"alpine.LFD.0.999.0708042157150.5037@woody.linux-foundation.org","threadId":"9387","inReplyTo":"fc339e4a0708042100jdf0a0f1jd1fddfb5dc1c1052@mail.gmail.com","subject":"Re: way to automatically add untracked files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-08-05T05:03:03Z","receivedAt":"2007-08-05T05:03:03Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 5 Aug 2007, Miles Bader wrote:\n\n> I previously wrote\n> > One thing I often want to do is git-add all untracked files, and also \n> > automatically git-rm all \"disappeared\" files\n> ...\n> > One way to do this seems to be just \"git add .\"\n> \n> Oh, also, \"git add .\" doesn't seem to do the right thing with \n> \"dissapeared\" files:  If I do:\n> \n>     mv foo.cc bar.cc\n>     git add .\n\nDo \"git status -a\" to figure out the removed ones.\n\nI actually think we should probably make \"git add .\" do it too, but it's \nnot how we've done it historically (\"git add .\" really ends up just \nreading the working directory tree and addign all the files it sees: so by \ndefinition it doesn't do anything at all to files it does *not* see, ie \nthe removed ones).\n\n> Am I doing something wrong, or is this just missing functionality?\n\nWell, it's just \"behaviour\". It's probably largely historical, in that \n\"git add\" used to be thought of as \"adding new files\", but obviously then \nit got extended to mean \"stage old files for commit\" too, but in that \nextension, the \"remove old files\" never came up.\n\nBut git certainly has the capability. \"git commit -a\" will notice all the \nfiles that went away and automatically remove them, so\n\n\tgit add .\n\tgit commit -a\n\nwill do what you want (except, as we found out last week, we've had a huge \nperformance regression, so that's actually a really slow way to do it, and \nso it's actually faster to do\n\n\tgit ls-files -o | git update-index --add --stdin\n\tgit commit -a\n\ninstead (where the first one just adds the *new* files, and then obviously \nthe \"git commit -a\" does the right thing for old files, whether deleted or \nmodified)\n\n\t\tLinus\n"},{"id":"49819","messageId":"7vzm16h8qw.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"874pjelgyz.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-05T05:04:55Z","receivedAt":"2007-08-05T05:04:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miles Bader <miles@gnu.org> writes:\n\n> Anyway, I wouldn't be complaining except that I _keep_ running into\n> circumstances where I need to type \"git-add NEWFILE1 NEWFILE2\n> NEWFILE3...; git rm OLD_FILE1...\" -- which is kind of annoying after\n> seeing a list of _exactly_ the files I need to add/remove output just\n> previously by git-status.  Thus my wish to have git \"do it\n> automatically.\"\n\nAs Linus explained in another thread, \"git rm\" is largely\nunneeded.  Just work with the filesystem in normal UNIX way, and\nbe done with \"git add -u\" or even \"git commit -a\" and you will\nbe fine.\n\nIf you are more perfect than most other people in maintaining\nthe .gitignore file, you do not even have to name individual\nfiles like \"git add NEWFILE1...\" -- you can always safely run\n\"git add .\".\n\nMost of us are not as perfect as you are, as you might have\nnoticed that Randal pointed out this morning that we missed a\nnew entry from our own .gitignore ;-) I highly suspect that we\nwill be hated by most of our users if we changed \"git add -u\" to\nadd everything in sight for this reason, and I also suspect they\nwill feel that \"git add-remove --all\" will be code bloat for\nlittle gain.\n"},{"id":"49822","messageId":"7vr6mih8a8.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"alpine.LFD.0.999.0708042157150.5037@woody.linux-foundation.org","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-05T05:14:55Z","receivedAt":"2007-08-05T05:14:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> ... (except, as we found out last week, we've had a huge \n> performance regression, so that's actually a really slow way to do it, and \n> so it's actually faster to do\n>\n> \tgit ls-files -o | git update-index --add --stdin\n> \tgit commit -a\n>\n> instead...\n\nIs it still the case after the fix in rc4?  Other than the\ntheoretical \"on multi-core, ls-files and update-index can run in\nparallel\" performance boost potential, I thought the fixed\n\"git-add .\" would be the same...\n"},{"id":"49823","messageId":"87y7gqk1ac.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"7vzm16h8qw.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T05:17:47Z","receivedAt":"2007-08-05T05:17:47Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n> I highly suspect that we will be hated by most of our users if we\n> changed \"git add -u\" to add everything in sight for this reason, and I\n> also suspect they will feel that \"git add-remove --all\" will be code\n> bloat for little gain.\n\nI agree that a change to \"git-add -u\" would be silly... :-)\n\nI was just looking for a convenient way to reduce my typing on those\noccasions when I do have a bunch of added/removed/renamed files;\n\"git-add -u; git add .\" seems to do the trick (of course I always\ncheck what git-status says first!).\n\nThanks,\n\n-Miles\n\n-- \nThe automobile has not merely taken over the street, it has dissolved the\nliving tissue of the city.  Its appetite for space is absolutely insatiable;\nmoving and parked, it devours urban land, leaving the buildings as mere islands\nof habitable space in a sea of dangerous and ugly traffic.\n[James Marston Fitch, New York Times, 1 May 1960]\n"},{"id":"49825","messageId":"Pine.LNX.4.64.0708050623040.14781@racer.site","threadId":"9387","inReplyTo":"87y7gqk1ac.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-05T05:23:37Z","receivedAt":"2007-08-05T05:23:37Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 5 Aug 2007, Miles Bader wrote:\n\n> I was just looking for a convenient way to reduce my typing on those\n> occasions when I do have a bunch of added/removed/renamed files;\n\nWhy didn't you say so?  You can always create an alias.  Problem solved.\n\nCiao,\nDscho\n"},{"id":"49826","messageId":"87sl6yk0un.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"Pine.LNX.4.64.0708050623040.14781@racer.site","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T05:27:12Z","receivedAt":"2007-08-05T05:27:12Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> I was just looking for a convenient way to reduce my typing on those\n>> occasions when I do have a bunch of added/removed/renamed files;\n>\n> Why didn't you say so?\n\nI did, I thought... :-)\n\n-Miles \n\n-- \nSomebody has to do something, and it's just incredibly pathetic that it\nhas to be us.  -- Jerry Garcia\n"},{"id":"49833","messageId":"85fy2ycu7n.fsf@lola.goethe.zz","threadId":"9387","inReplyTo":"7vr6mih8a8.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-05T07:32:28Z","receivedAt":"2007-08-05T07:32:28Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Linus Torvalds <torvalds@linux-foundation.org> writes:\n>\n>> ... (except, as we found out last week, we've had a huge \n>> performance regression, so that's actually a really slow way to do it, and \n>> so it's actually faster to do\n>>\n>> \tgit ls-files -o | git update-index --add --stdin\n>> \tgit commit -a\n>>\n>> instead...\n>\n> Is it still the case after the fix in rc4?  Other than the\n> theoretical \"on multi-core, ls-files and update-index can run in\n> parallel\" performance boost potential,\n\nWhen I did my apprenticeship, one thing I learnt was that to\naccomplish a repetitive task comprised of several steps, you organize\nit in a way that does not require you to change the tool you are\nholding/using until you have finished using it.\n\nWhat's good for the user is good for the computer: even on single core\nsystems, working off a complete pipeline buffer before switching\ncontext again will help keeping disk positioning and cache poisoning\ndown.  However, it will depend on the scheduler: if it never allows\npipes to even slighly fill up (which has been the normal behavior of\nthe Linux scheduler for years in spite of complaints I voiced several\ntimes), you don't get the advantages from this sort of processing.\nCFS could conceivably help in many use cases since then the context\nswitch depends on more than just \"pipe has some minimal content?\"\nwhich is pretty much the worst choice for context switches in batch\nprocessing.  However, as long as we are talking buffered I/O (FILE*\nand block buffering), we are losing some parallelism potential and\ngaining some blocking advantage.\n\n> I thought the fixed \"git-add .\" would be the same...\n\nPossibly.  After all, there _is_ overhead associated with pipes, and\ncurrently released kernels' scheduling behavior reaps no cache\npoisoning gains.  Whatever.  I think I'll do a large test.\nSpeculation is not everything.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49834","messageId":"87hcnejuxp.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"alpine.LFD.0.999.0708042157150.5037@woody.linux-foundation.org","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-05T07:34:58Z","receivedAt":"2007-08-05T07:34:58Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n> But git certainly has the capability. \"git commit -a\" will notice all the \n> files that went away and automatically remove them, so\n>\n> \tgit add .\n> \tgit commit -a\n>\n> will do what you want (except, as we found out last week, we've had a huge \n> performance regression, so that's actually a really slow way to do it, and \n> so it's actually faster to do\n>\n> \tgit ls-files -o | git update-index --add --stdin\n> \tgit commit -a\n\nI notice that \"git ls-files -o\" doesn't do normal ignore-processing, so\nfor instance all my .o and editor backup files show up in the output...\nIs that expected or is it a bug (I tried versions \"1.5.2.4\" and\n\"1.5.3.rc3.91.g5c75-dirty\")?\n\nIf I do:\n\n   git-ls-files -o --exclude-per-directory=.gitignore --exclude-from=$HOME/.gitignore\n\nit works more like I'd expect.\n\nThanks,\n\n-Miles\n\n-- \n`The suburb is an obsolete and contradictory form of human settlement'\n"},{"id":"49860","messageId":"85vebu9sot.fsf_-_@lola.goethe.zz","threadId":"9387","inReplyTo":"85fy2ycu7n.fsf@lola.goethe.zz","subject":"Benchmarking git-add vs git-ls-files+update-index (was: way to automatically add untracked files?)","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-05T10:33:38Z","receivedAt":"2007-08-05T10:33:38Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Linus Torvalds <torvalds@linux-foundation.org> writes:\n>>\n>>> ... (except, as we found out last week, we've had a huge \n>>> performance regression, so that's actually a really slow way to do it, and \n>>> so it's actually faster to do\n>>>\n>>> \tgit ls-files -o | git update-index --add --stdin\n>>> \tgit commit -a\n>>>\n>>> instead...\n>>\n>> Is it still the case after the fix in rc4?  Other than the\n>> theoretical \"on multi-core, ls-files and update-index can run in\n>> parallel\" performance boost potential,\n\ndak@lola:/home/tmp/texlive$ git-init\nInitialized empty Git repository in .git/\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist add .\n\nreal    9m36.256s\nuser    2m2.408s\nsys     0m25.874s\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist add .\n\nreal    0m34.161s\nuser    0m0.448s\nsys     0m2.212s\n\n[So the rc4 fix seems to have made it.]\n\ndak@lola:/home/tmp/texlive$ rm -rf .git;git-init\nInitialized empty Git repository in .git/\n\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)\n\nreal    8m9.370s\nuser    2m1.172s\nsys     0m25.138s\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)\n\nreal    6m4.447s\nuser    0m16.801s\nsys     0m12.333s\ndak@lola:/home/tmp/texlive$ \n\n[Hm.  Maybe \"modified\" files are not what I think they are?]\n\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -o .|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)\n\nreal    6m0.120s\nuser    0m16.977s\nsys     0m12.653s\n\n[No, doesn't help.]\n\n[Just for kicks, let's try getting the Linux scheduler out of our hair\nin the initial case.]\n\ndak@lola:/home/tmp/texlive$ time git --work-tree=/usr/local/texlive/2007/texmf-dist ls-files -z -m -o .|dd bs=8k|(cd /usr/local/texlive/2007/texmf-dist;git --git-dir=/home/tmp/texlive/.git update-index --add -z --stdin)\n201+1 records in\n201+1 records out\n1650230 bytes (1.7 MB) copied, 513.125 seconds, 3.2 kB/s\n\nreal    8m45.088s\nuser    2m2.052s\nsys     0m25.870s\n\n[Hm, does more damage than it helps.]\n\nSo in summary: git-ls-files -m is apparently lacking the optimization\nof git-add for unchanged inodes.  Bad.  Using it together with\ngit-update-index in the initial case saves some time over git-add, but\nnot breathtakingly so.  This is on a single core.\n\nMost of the time is spent waiting for I/O.  Threaded execution should\nsupposedly help in having less waiting time, but at least in this\ncombination, the payoff does not seem overwhelming.\n\nOne should mention that the stuff I tested it on is actually sitting\non a reiserfs file system (though the repository is on ext3).\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49867","messageId":"8EA2C4F4-F947-427B-A1E8-ABAEB06C1360@zib.de","threadId":"9387","inReplyTo":"7v4pjeioi6.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-05T11:22:22Z","receivedAt":"2007-08-05T11:22:22Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 5, 2007, at 6:39 AM, Junio C Hamano wrote:\n\n>\n> Adding _new_ files, unless you are just beginning a new project,\n> are much more rare than updating modified files that you are\n> already tracking; and \"git add new-file...\" is what people\n> usually use for the former.  \"git add .\" is almost always the\n> \"initial import\" and not used later (after all you ought to know\n> what files you are creating and controlling ;-)).  You get into\n> an illusion that that is often used, only when you have just\n> started.  As your project progresses, that feeling will fade\n> away.\n\nI exactly need the functionality that Miles is describing for\nthe following good reason:\n\nMac OS X has the notion of a bundle, which is a directory that\ncontains related files that are fully controlled by the application\nthat is writing that bundle. The bundle functionality is\ndirectly supported by the OS and most applications save their\ndata as bundles. For example on Mac OS X, the Openoffice format,\nwhich packs related files in a zip file, would just be a directory\nwith all related files grouped together (no ZIP archive needed).\n\nSo here is what I need: I want to be able to track a directory\nwith all its contents. The data inside the directory are not\nunder my control. It's only the directory that matters for me.\n\nGit is already quite good at that because it doesn't need to\nplace anything inside the opaque directory! Subversion for example\nhas no chance because it clutters the directory with .svn\ndirectories, which will be removed by the next Save (an\napplication first creates a new temporary directory, stores\nall data there, moves the old directory to a backup location,\nand renames the new directory to the final destination only\nif no problems occurred).\n\nWhen I started with git I figured out that\n\n    git-ls-files -z --others dir | git-update-index --add -z --stdin\n    git commit -a\n\ndoes the job for me. Would\n\n    git add dir\n    git add -u dir\n    git commit\n\nbe equivalent, but restricted to the changes in dir?\n\n\tSteffen\n"},{"id":"49873","messageId":"200708051411.25238.johan@herland.net","threadId":"9387","inReplyTo":"20070805041320.GH9527@spearce.org","subject":"Re: way to automatically add untracked files?","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2007-08-05T12:11:24Z","receivedAt":"2007-08-05T12:11:24Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Sunday 05 August 2007, Shawn O. Pearce wrote:\n> Miles Bader <miles@gnu.org> wrote:\n> > I previously wrote\n> > > One thing I often want to do is git-add all untracked files, and also\n> > > automatically git-rm all \"disappeared\" files\n> > ...\n> > > One way to do this seems to be just \"git add .\"\n> > \n> > Oh, also, \"git add .\" doesn't seem to do the right thing with\n> > \"dissapeared\" files:  If I do:\n> > \n> >     mv foo.cc bar.cc\n> >     git add .\n> \n> Right.  Who wants \"add\" to actually mean \"add and delete\"?\n> Shouldn't that be then called \"git-add-and-rm\"?\n> \n> We recently talked about this on the mailing list and decided that\n> git-add shouldn't remove files that have disappeared, as doing so\n> might break most user's expections of what git-add does.\n\nSo different users seem to have two different (almost incompatible) \nexpectations to git-add:\n\n1. git-add adds new files into the index. git-add has _no_ business removing \ndeleted files from the index.\n\n2. git-add updates the index according to the state of the working tree. \nThis includes adding new files and removing deleted files.\n\n\nBoth interpretations are useful and worth supporting, but git-add currently \nseems focused on #1 (and rightly so, IMHO).\n\nEven though #2 can be achieved by using a couple of git-add commmands (or a \nlonger series of more obscure plumbing-level commands), it might be worth \nconsidering the more user-friendly alternative of adding a dedicated \ncommand for supporting #2. Such a command already exists in a similar RCS:\n\n---\n$ hg addremove --help\nhg addremove [OPTION]... [FILE]...\n\nadd all new files, delete all missing files\n\n    Add all new files and remove all missing files from the repository.\n\n    New files are ignored if they match any of the patterns in .hgignore. As\n    with add, these changes take effect at the next commit.\n\n[...]\n---\n\nAdding a git-addremove command should not be much work, and it would be a \nlot friendlier to people whose workflow is more aligned with #2 than #1.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"49876","messageId":"85bqdm89al.fsf@lola.goethe.zz","threadId":"9387","inReplyTo":"200708051411.25238.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-05T12:17:54Z","receivedAt":"2007-08-05T12:17:54Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Johan Herland <johan@herland.net> writes:\n\n> So different users seem to have two different (almost incompatible) \n> expectations to git-add:\n>\n> 1. git-add adds new files into the index. git-add has _no_ business removing \n> deleted files from the index.\n>\n> 2. git-add updates the index according to the state of the working tree. \n> This includes adding new files and removing deleted files.\n>\n>\n> Both interpretations are useful and worth supporting, but git-add\n> currently seems focused on #1 (and rightly so, IMHO).\n>\n> Even though #2 can be achieved by using a couple of git-add\n> commmands (or a longer series of more obscure plumbing-level\n> commands), it might be worth considering the more user-friendly\n> alternative of adding a dedicated command for supporting #2. Such a\n> command already exists in a similar RCS:\n\n[...]\n\n> Adding a git-addremove command should not be much work, and it would\n> be a lot friendlier to people whose workflow is more aligned with #2\n> than #1.\n\nMaybe just git-add -a?\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49908","messageId":"20070805161117.GE28263@thunk.org","threadId":"9387","inReplyTo":"200708051411.25238.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2007-08-05T16:11:17Z","receivedAt":"2007-08-05T16:11:17Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n> $ hg addremove --help\n> hg addremove [OPTION]... [FILE]...\n> \n> add all new files, delete all missing files\n> \n>     Add all new files and remove all missing files from the repository.\n> \n>     New files are ignored if they match any of the patterns in .hgignore. As\n>     with add, these changes take effect at the next commit.\n> \n> Adding a git-addremove command should not be much work, and it would be a \n> lot friendlier to people whose workflow is more aligned with #2 than #1.\n\nNot much work at alll:\n\n# git config --system --add alias.addremove \"git add . ; git add -u\"\n\n:-)\n\n(And the performance problem with git add . is fixed in 1.5.3-rc4,\nright?)\n\n\t\t\t\t\t\t- Ted\n"},{"id":"49914","messageId":"alpine.LFD.0.999.0708051000130.5037@woody.linux-foundation.org","threadId":"9387","inReplyTo":"87hcnejuxp.fsf@catnip.gol.com","subject":"Re: way to automatically add untracked files?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-08-05T17:04:32Z","receivedAt":"2007-08-05T17:04:32Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 5 Aug 2007, Miles Bader wrote:\n> \n> I notice that \"git ls-files -o\" doesn't do normal ignore-processing, so\n> for instance all my .o and editor backup files show up in the output...\n\nYeah, I'm a moron.\n\n> Is that expected or is it a bug\n\nIt's expected (I just didn't try the command line I gave you).\n\n\"git ls-files\" is low-level plumbing, and those things generally do only \nwhat you ask from them and never anything user-friendly. In particular, \nthey tend to avoid policy decisions. An example of this is \"git diff\" that \ncolorizes the output by default as you have specified, but \"git diff-tree\" \nthat does not.\n\n\t\t\tLinus\n"},{"id":"49942","messageId":"200708052116.04140.johan@herland.net","threadId":"9387","inReplyTo":"20070805161117.GE28263@thunk.org","subject":"Re: way to automatically add untracked files?","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2007-08-05T19:16:03Z","receivedAt":"2007-08-05T19:16:03Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Sunday 05 August 2007, Theodore Tso wrote:\n> On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n> > Adding a git-addremove command should not be much work, and it would be\n> > a lot friendlier to people whose workflow is more aligned with #2 than \n> > #1. \n> Not much work at all:\n> \n> # git config --system --add alias.addremove \"git add . ; git add -u\"\n> \n> :-)\n\nNice :)\n\nBut I'm wondering whether we'd want to include it in git by default (instead \nof having to tell confused users to add the alias).\n\n> (And the performance problem with git add . is fixed in 1.5.3-rc4,\n> right?)\n\nYes, according to Junio elsewhere in this thread.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"49938","messageId":"C3725674-7B33-4B2F-9386-704540D51C0E@zib.de","threadId":"9387","inReplyTo":"20070805161117.GE28263@thunk.org","subject":"Re: way to automatically add untracked files?","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-05T20:04:41Z","receivedAt":"2007-08-05T20:04:41Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 5, 2007, at 6:11 PM, Theodore Tso wrote:\n\n> On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n>> $ hg addremove --help\n>> hg addremove [OPTION]... [FILE]...\n>>\n>> add all new files, delete all missing files\n>>\n>>     Add all new files and remove all missing files from the  \n>> repository.\n>>\n>>     New files are ignored if they match any of the patterns  \n>> in .hgignore. As\n>>     with add, these changes take effect at the next commit.\n>>\n>> Adding a git-addremove command should not be much work, and it  \n>> would be a\n>> lot friendlier to people whose workflow is more aligned with #2  \n>> than #1.\n>\n> Not much work at all:\n>\n> # git config --system --add alias.addremove \"git add . ; git add -u\"\n\nBut how can I handle the [FILE]... from above?\n\n\tSteffen\n"},{"id":"49957","messageId":"87fy2xh6r7.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"200708052116.04140.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-06T00:00:12Z","receivedAt":"2007-08-06T00:00:12Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"Johan Herland <johan@herland.net> writes:\n>> # git config --system --add alias.addremove \"git add . ; git add -u\"\n>\n> But I'm wondering whether we'd want to include it in git by default (instead \n> of having to tell confused users to add the alias).\n\nAn easier-to-type name e.g. \"addrm\" would be good though...\n\n-miles\n\n-- \n`Life is a boundless sea of bitterness'\n"},{"id":"49962","messageId":"Pine.LNX.4.64.0708060112330.14781@racer.site","threadId":"9387","inReplyTo":"200708052116.04140.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-06T00:16:46Z","receivedAt":"2007-08-06T00:16:46Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 5 Aug 2007, Johan Herland wrote:\n\n> On Sunday 05 August 2007, Theodore Tso wrote:\n> > On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n> > > Adding a git-addremove command should not be much work, and it would be\n> > > a lot friendlier to people whose workflow is more aligned with #2 than \n> > > #1. \n> > Not much work at all:\n> > \n> > # git config --system --add alias.addremove \"git add . ; git add -u\"\n\nNote that this will not work: you have to add an exclamation mark before \n\"git add\", because it has to execute two commands.\n\nNote also that I do _not_ suggest using --system.  This option forces you \nto run git as root on sane systems, which I think is wrong.  Rather use \n\"--global\" to make it globally available to _you_.\n\n> But I'm wondering whether we'd want to include it in git by default \n> (instead of having to tell confused users to add the alias).\n\nI recommend against that, too.  All too often, I have some temporary files \nin the working tree, and I'll be dimmed if I'm the only one.  So \n\"addremove\" adds too much possibility for pilot errors.\n\nMy opinion here is not set in stone, though.  Maybe you can convince me.\n\nCiao,\nDscho\n"},{"id":"49963","messageId":"Pine.LNX.4.64.0708060116590.14781@racer.site","threadId":"9387","inReplyTo":"C3725674-7B33-4B2F-9386-704540D51C0E@zib.de","subject":"Re: way to automatically add untracked files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-06T00:17:52Z","receivedAt":"2007-08-06T00:17:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 5 Aug 2007, Steffen Prohaska wrote:\n\n> \n> On Aug 5, 2007, at 6:11 PM, Theodore Tso wrote:\n> \n> > On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n> > > $ hg addremove --help\n> > > hg addremove [OPTION]... [FILE]...\n> > > \n> > > add all new files, delete all missing files\n> > > \n> > >    Add all new files and remove all missing files from the repository.\n> > > \n> > >    New files are ignored if they match any of the patterns in .hgignore.\n> > > As\n> > >    with add, these changes take effect at the next commit.\n> > > \n> > > Adding a git-addremove command should not be much work, and it would be a\n> > > lot friendlier to people whose workflow is more aligned with #2 than #1.\n> > \n> > Not much work at all:\n> > \n> > # git config --system --add alias.addremove \"git add . ; git add -u\"\n> \n> But how can I handle the [FILE]... from above?\n\nSee \nhttp://git.or.cz/gitwiki/Aliases#head-714f0aa64cb53eda636d41e16bf2b99477588685\n\nHth,\nDscho\n"},{"id":"49968","messageId":"f95q7l$8lv$2@sea.gmane.org","threadId":"9387","inReplyTo":"200708051411.25238.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-06T00:32:56Z","receivedAt":"2007-08-06T00:32:56Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johan Herland wrote:\n\n> So different users seem to have two different (almost incompatible) \n> expectations to git-add:\n> \n> 1. git-add adds new files into the index. git-add has _no_ business removing \n> deleted files from the index.\n> \n> 2. git-add updates the index according to the state of the working tree. \n> This includes adding new files and removing deleted files.\n> \n> \n> Both interpretations are useful and worth supporting, but git-add currently \n> seems focused on #1 (and rightly so, IMHO).\n> \n> Even though #2 can be achieved by using a couple of git-add commmands (or a \n> longer series of more obscure plumbing-level commands), it might be worth \n> considering the more user-friendly alternative of adding a dedicated \n> command for supporting #2. Such a command already exists in a similar RCS:\n> \n> ---\n> $ hg addremove --help\n> hg addremove [OPTION]... [FILE]...\n> \n> add all new files, delete all missing files\n\ngit update-index --add --remove?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"49972","messageId":"buo1wehxssa.fsf@dhapc248.dev.necel.com","threadId":"9387","inReplyTo":"Pine.LNX.4.64.0708060112330.14781@racer.site","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles.bader@necel.com","sentAt":"2007-08-06T03:09:57Z","receivedAt":"2007-08-06T03:09:57Z","isPatch":false,"sender":{"key":"miles.bader@necel.com","avatar":"https://gravatar.com/avatar/be062d4050eb88e04229cbdb60f803e1bd647923a015996c2439e76f23e336a7?d=mp&s=160"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> But I'm wondering whether we'd want to include it in git by default \n>> (instead of having to tell confused users to add the alias).\n>\n> I recommend against that, too.  All too often, I have some temporary files \n> in the working tree, and I'll be dimmed if I'm the only one.  So \n> \"addremove\" adds too much possibility for pilot errors.\n\n\"Recommend against it\"?  Why?\n\nIt's a separate command, so if it doesn't fit your working style, don't\nuse it.  I think it _is_ a well-defined and useful action (\"snapshot the\nworking dir\") that people would sometimes like to perform, and having a\nsimple git command to do it would be good.\n\nMorever, as an almost trivial alias, \"code bloat\" is hardly an argument\nagainst it!\n\n[But please, call it \"addrm\" -- \"addremove\" is just gratuitously long...] \n\n-Miles\n\n-- \no The existentialist, not having a pillow, goes everywhere with the book by\n  Sullivan, _I am going to spit on your graves_.\n"},{"id":"49973","messageId":"Pine.LNX.4.64.0708060419230.14781@racer.site","threadId":"9387","inReplyTo":"buo1wehxssa.fsf@dhapc248.dev.necel.com","subject":"Re: way to automatically add untracked files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-06T03:21:30Z","receivedAt":"2007-08-06T03:21:30Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n[please, netiquette says that you should Cc _at least_ the one you're \nresponding to]\n\nOn Mon, 6 Aug 2007, Miles Bader wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> >> But I'm wondering whether we'd want to include it in git by default \n> >> (instead of having to tell confused users to add the alias).\n> >\n> > I recommend against that, too.  All too often, I have some temporary files \n> > in the working tree, and I'll be dimmed if I'm the only one.  So \n> > \"addremove\" adds too much possibility for pilot errors.\n> \n> \"Recommend against it\"?  Why?\n\nDidn't I say that? It just _asks_ for pilot errors.\n\n> It's a separate command, so if it doesn't fit your working style, don't\n> use it.\n\nHah!  If that were true, we'd have a lot less mails like \"I tried this and \nit did not work\", only to find out that the person assumed that \ndocumentation is for wimps, and tried a command that \"sounded\" like it \nwould do the right thing.\n\nCiao,\nDscho\n"},{"id":"49975","messageId":"buovebtwckw.fsf@dhapc248.dev.necel.com","threadId":"9387","inReplyTo":"Pine.LNX.4.64.0708060419230.14781@racer.site","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles.bader@necel.com","sentAt":"2007-08-06T03:45:19Z","receivedAt":"2007-08-06T03:45:19Z","isPatch":false,"sender":{"key":"miles.bader@necel.com","avatar":"https://gravatar.com/avatar/be062d4050eb88e04229cbdb60f803e1bd647923a015996c2439e76f23e336a7?d=mp&s=160"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> > I recommend against that, too.  All too often, I have some temporary files \n>> > in the working tree, and I'll be dimmed if I'm the only one.  So \n>> > \"addremove\" adds too much possibility for pilot errors.\n>> \n>> \"Recommend against it\"?  Why?\n>\n> Didn't I say that? It just _asks_ for pilot errors.\n\nHuh?  How is it any worse than the underlying commands it uses\n(\"git add .\" in particular)?!  Indeed, it seems rather less likely to\ncause problems, because it has a rather odd name.\n\n>> It's a separate command, so if it doesn't fit your working style, don't\n>> use it.\n>\n> Hah!  If that were true, we'd have a lot less mails like \"I tried this and \n> it did not work\", only to find out that the person assumed that \n> documentation is for wimps, and tried a command that \"sounded\" like it \n> would do the right thing.\n\nGit is not exactly a user-coddling, ultra-hand-holding application, nor\ndoes it seem to have that as a goal.  It offers _tons_ of rope to hang\nyourself if you wish (though it usually offers lots of ways to recover).\n\nRather git seems to have as a goal being a useful toolkit for managing\nsource trees, and based on what I've seen, tries to accomodate many\ndifferent styles of usage (rather than trying to force a certain style\ndown the users' throats -- as some VCSs try to do ...).\n\n-miles\n\n-- \n/\\ /\\\n(^.^)\n(\")\")\n*This is the cute kitty virus, please copy this into your sig so it can spread.\n"},{"id":"49984","messageId":"4AF672E9-5D0A-4CD0-BC01-D9BB79A5C8EA@zib.de","threadId":"9387","inReplyTo":"Pine.LNX.4.64.0708060116590.14781@racer.site","subject":"Re: way to automatically add untracked files?","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-06T04:58:33Z","receivedAt":"2007-08-06T04:58:33Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 6, 2007, at 2:17 AM, Johannes Schindelin wrote:\n\n> Hi,\n>\n> On Sun, 5 Aug 2007, Steffen Prohaska wrote:\n>\n>>\n>> On Aug 5, 2007, at 6:11 PM, Theodore Tso wrote:\n>>\n>>> On Sun, Aug 05, 2007 at 02:11:24PM +0200, Johan Herland wrote:\n>>>> $ hg addremove --help\n>>>> hg addremove [OPTION]... [FILE]...\n>>>>\n>>>> add all new files, delete all missing files\n>>>>\n>>>>    Add all new files and remove all missing files from the  \n>>>> repository.\n>>>>\n>>>>    New files are ignored if they match any of the patterns  \n>>>> in .hgignore.\n>>>> As\n>>>>    with add, these changes take effect at the next commit.\n>>>>\n>>>> Adding a git-addremove command should not be much work, and it  \n>>>> would be a\n>>>> lot friendlier to people whose workflow is more aligned with #2  \n>>>> than #1.\n>>>\n>>> Not much work at all:\n>>>\n>>> # git config --system --add alias.addremove \"git add . ; git add -u\"\n>>\n>> But how can I handle the [FILE]... from above?\n>\n> See\n> http://git.or.cz/gitwiki/ \n> Aliases#head-714f0aa64cb53eda636d41e16bf2b99477588685\n\nThanks.\n\n\"Starting with version 1.5.3, git supports appending the\narguments to commands prefixed with \"!\", too. If you need\nto perform a reordering, or to use an argument twice, you\ncan use this trick:\n\n[alias]\n         example = !sh -c \"ls $1 $0\"\n\nNOTE: the arguments start with $0, not with $1 as you are\nused from shell scripts.\" [cited from the link above]\n\nshould do the job.\n\n\tSteffen\n"},{"id":"49990","messageId":"200708060930.13967.johan@herland.net","threadId":"9387","inReplyTo":"f95q7l$8lv$2@sea.gmane.org","subject":"Re: way to automatically add untracked files?","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2007-08-06T07:30:13Z","receivedAt":"2007-08-06T07:30:13Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 06 August 2007, Jakub Narebski wrote:\n> Johan Herland wrote:\n> \n> > So different users seem to have two different (almost incompatible) \n> > expectations to git-add:\n> > \n> > 1. git-add adds new files into the index. git-add has _no_ business removing \n> > deleted files from the index.\n> > \n> > 2. git-add updates the index according to the state of the working tree. \n> > This includes adding new files and removing deleted files.\n> > \n> > \n> > Both interpretations are useful and worth supporting, but git-add currently \n> > seems focused on #1 (and rightly so, IMHO).\n> > \n> > Even though #2 can be achieved by using a couple of git-add commmands (or a \n> > longer series of more obscure plumbing-level commands), it might be worth \n> > considering the more user-friendly alternative of adding a dedicated \n> > command for supporting #2. Such a command already exists in a similar RCS:\n> > \n> > ---\n> > $ hg addremove --help\n> > hg addremove [OPTION]... [FILE]...\n> > \n> > add all new files, delete all missing files\n> \n> git update-index --add --remove?\n\nThis is actually the nicest looking command I've seen so far in this thread.\nIt's reasonably simple to deduce what it does, or rather, should do...\n\nOf course it has some shortcomings:\n\n- It only works on individual files. Supplying a directory (subdir or '.')\n  is not supported.\n\n- It _seems_ to not support .gitignore, i.e. new files that are already in\n  .gitignore give the same feedback (add 'foo') as new files that are not\n  ignored. But when you commit, the ignored files will in fact _not_ be\n  committed (which is correct, AFAICS). It would be nice if git-update-index\n  told me that up front.\n\nOf course, It may be that git-update-index is too low-level (i.e. plumbing)\nto support the above use case in a user-friendly fashion. In that case, feel\nfree to ignore the above issues.\n\n\nHave fun!\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"49991","messageId":"200708060946.12793.johan@herland.net","threadId":"9387","inReplyTo":"Pine.LNX.4.64.0708060419230.14781@racer.site","subject":"Re: way to automatically add untracked files?","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2007-08-06T07:46:12Z","receivedAt":"2007-08-06T07:46:12Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Monday 06 August 2007, Johannes Schindelin wrote:\n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > >> But I'm wondering whether we'd want to include it in git by default \n> > >> (instead of having to tell confused users to add the alias).\n> > >\n> > > I recommend against that, too.  All too often, I have some temporary files \n> > > in the working tree, and I'll be dimmed if I'm the only one.  So \n> > > \"addremove\" adds too much possibility for pilot errors.\n> > \n> > \"Recommend against it\"?  Why?\n> \n> Didn't I say that? It just _asks_ for pilot errors.\n\nOk, in that spirit I also suggest removing _all_ git plumbing-level commands\nfrom the default installation. I also suggest adding confirmation dialog to\nany command that alters the repo, since we have to protect the user against\n\"pilot errors\".\n\nGet real. Adding a separate command (provided it's well implemented and\ndocumented) does not push the user off a cliff. Just because the command\ndoesn't fit your workflow doesn't mean it's dangerous and should never be\nincluded. Just don't use it.\n\nIf git were only to support the (probably non-existing) intersection of its\nuser's workflows, we would probably have to pull e.g. git-rebase out of the\ntree, because (according to some) rewriting history is evil, and extremely\nprone to \"pilot errors\".\n\n> > It's a separate command, so if it doesn't fit your working style, don't\n> > use it.\n> \n> Hah!  If that were true, we'd have a lot less mails like \"I tried this and \n> it did not work\", only to find out that the person assumed that \n> documentation is for wimps, and tried a command that \"sounded\" like it \n> would do the right thing.\n\nHaving commands that \"sound\" like they do the right thing is not a bad idea\nat all. We should have more of those.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"49997","messageId":"7vwsw9capl.fsf@assigned-by-dhcp.cox.net","threadId":"9387","inReplyTo":"20070805041320.GH9527@spearce.org","subject":"Re: way to automatically add untracked files?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-06T08:45:58Z","receivedAt":"2007-08-06T08:45:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> We recently talked about this on the mailing list and decided that\n> git-add shouldn't remove files that have disappeared, as doing so\n> might break most user's expections of what git-add does.\n> ...\n> \"git commit -a\" will remove disappeared files.  It has for quite\n> some time.\n\nIt obviously is not the time to do this as I have already said\nthat I won't look at anything but fixes and documentation\nupdates until 1.5.3, but I am not opposed to have \"git add -a $paths\"\nwhich would do something like \"git add $paths && git add -u $paths\".\nWe also might want to add \"git add --refresh $paths\" while at\nit, which were brought up recently in a separate thread.\n"},{"id":"50013","messageId":"Pine.LNX.4.64.0708061317101.14781@racer.site","threadId":"9387","inReplyTo":"200708060946.12793.johan@herland.net","subject":"Re: way to automatically add untracked files?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-06T12:17:38Z","receivedAt":"2007-08-06T12:17:38Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 6 Aug 2007, Johan Herland wrote:\n\n> On Monday 06 August 2007, Johannes Schindelin wrote:\n> > > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > > >> But I'm wondering whether we'd want to include it in git by default \n> > > >> (instead of having to tell confused users to add the alias).\n> > > >\n> > > > I recommend against that, too.  All too often, I have some temporary files \n> > > > in the working tree, and I'll be dimmed if I'm the only one.  So \n> > > > \"addremove\" adds too much possibility for pilot errors.\n> > > \n> > > \"Recommend against it\"?  Why?\n> > \n> > Didn't I say that? It just _asks_ for pilot errors.\n> \n> Ok, in that spirit I also suggest removing _all_ git plumbing-level commands\n> from the default installation.\n\nOh, come on.  You were talking about a porcelain command.\n\nCiao,\nDscho\n"},{"id":"50035","messageId":"85tzrcfrue.fsf@lola.goethe.zz","threadId":"9387","inReplyTo":"7vwsw9capl.fsf@assigned-by-dhcp.cox.net","subject":"Re: way to automatically add untracked files?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-06T18:19:53Z","receivedAt":"2007-08-06T18:19:53Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n>\n>> We recently talked about this on the mailing list and decided that\n>> git-add shouldn't remove files that have disappeared, as doing so\n>> might break most user's expections of what git-add does.\n>> ...\n>> \"git commit -a\" will remove disappeared files.  It has for quite\n>> some time.\n>\n> It obviously is not the time to do this as I have already said\n> that I won't look at anything but fixes and documentation\n> updates until 1.5.3, but I am not opposed to have \"git add -a $paths\"\n> which would do something like \"git add $paths && git add -u $paths\".\n\nI'm all for it.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"50062","messageId":"87y7goryt8.fsf@catnip.gol.com","threadId":"9387","inReplyTo":"85tzrcfrue.fsf@lola.goethe.zz","subject":"Re: way to automatically add untracked files?","fromName":"Miles Bader","fromEmail":"miles@gnu.org","sentAt":"2007-08-07T00:08:35Z","receivedAt":"2007-08-07T00:08:35Z","isPatch":false,"sender":{"key":"miles@gnu.org","avatar":"https://gravatar.com/avatar/01069b69593af7bff28e2f97afeb3644ae6fe2f5f56cb3a8cf34c5fb8c36efe5?d=mp&s=160"},"body":"David Kastrup <dak@gnu.org> writes:\n>> I am not opposed to have \"git add -a $paths\"\n>> which would do something like \"git add $paths && git add -u $paths\".\n>\n> I'm all for it.\n\nMe too... :-)\n\n[I think it's good that it be part of the \"add\" command (instead of a\nseparate command/alias), because a new user stands a better chance of\nfinding it in the documentation... when I was trying to figure out how\nto do this by myself, I certainly started by reading the man page for\ngit-add!]\n\nThanks,\n\n-Miles\n\n-- \n((lambda (x) (list x x)) (lambda (x) (list x x)))\n"}]}