{"thread":{"id":"113","subject":"Add + Status patches","startedAt":"2005-04-18T20:39:00Z","lastAt":"2005-04-18T22:41:14Z","messageCount":8,"participants":["David Greaves","Petr Baudis","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"692","messageId":"42641AE4.9050700@dgreaves.com","threadId":"113","inReplyTo":null,"subject":"Add + Status patches","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-04-18T20:39:00Z","receivedAt":"2005-04-18T20:39:00Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Hi Petr\n\nThankyou for the help earlier - problem resolved.\n\nI have a trivial patch (attached).\n\nIt allows:\n find src -type f | git add -\n\nand fixes git status not reporting added files properly (on my debian \nsystem it only reported the first file in .git/add-queue)\n\nShould I send this as a patch or as some kind of git object?\n(I'm still trying to figure out git workflow)\n\nDavid\n\n-- \n\n\n\nIndex: README\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/README  (mode:100644 sha1:798476ad292cc6edf5a2f5782e1de82f6052abe2)\n+++ 1c3349b813d463ce194be06f14ccfbcc3fc2ba30/README  (mode:100644 sha1:4282af1604e429dd767fe721751b5ac4a87c410e)\n@@ -89,6 +89,10 @@\n Of course you will want to commit. If you added any new files, do\n \n \tgit add newfile1 newfile2 ...\n+\t\n+or even\n+\n+\tfind src -type f | git add -\n \n first. Then feel free to commit by\n \nIndex: git\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/git  (mode:100755 sha1:b648169640025bd68d1b27a0fcc85b65d85e4440)\n+++ 1c3349b813d463ce194be06f14ccfbcc3fc2ba30/git  (mode:100755 sha1:5f3d4d04a0adfdc26bfc6aaef5cd29eea6e5c459)\n@@ -25,7 +25,7 @@\n Usage: git COMMAND [ARG]...\n \n Available commands:\n-\tadd\t\tFILE...\n+\tadd\t\tFILE...  | -    < files on stdin\n \taddremote\tRNAME RSYNC_URL\n \tapply\t\t\t\t< patch on stdin\n \tcancel\nIndex: gitadd.sh\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitadd.sh  (mode:100755 sha1:3ed93ea0fcb995673ba9ee1982e0e7abdbe35982)\n+++ 1c3349b813d463ce194be06f14ccfbcc3fc2ba30/gitadd.sh  (mode:100755 sha1:d010d14c0c14e0ea7a2e448b667d938fe92a3bc2)\n@@ -9,10 +9,14 @@\n # FIXME: Those files are omitted from show-diff output!\n \n if [ ! \"$1\" ]; then\n-\techo \"gitadd.sh: usage: git add FILE...\" >&2\n+\techo \"gitadd.sh: usage: git add - | FILE...\" >&2\n \texit 1;\n fi\n \n-for file in \"$@\"; do\n-\techo $file >>.git/add-queue\n-done\n+if [ $1 == \"-\" ]; then\n+\tcat - >> .git/add-queue\n+else\n+\tfor file in \"$@\"; do\n+\t\techo $file >>.git/add-queue\n+\tdone\n+fi\nIndex: gitstatus.sh\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitstatus.sh  (mode:100755 sha1:6c33f805ebc2630b14a88a07dfc891a9196d66a5)\n+++ 1c3349b813d463ce194be06f14ccfbcc3fc2ba30/gitstatus.sh  (mode:100755 sha1:e2c7f9d56b6967c529453de675ffffaaeeff3d1c)\n@@ -5,8 +5,8 @@\n \n {\n \tshow-files -z -t --others --deleted --unmerged\n-\t[ -s .git/add-queue ] && cat .git/add-queue | sed 's/^/A /' | { read x; echo -ne $x'\\0'; }\n-\t[ -s .git/rm-queue ] && cat .git/rm-queue | sed 's/^/D /' | { read x; echo -ne $x'\\0'; }\n+\t[ -s .git/add-queue ] && cat .git/add-queue | sed 's/^/A /' | tr '\\n' '\\0'\n+\t[ -s .git/rm-queue ] && cat .git/rm-queue | sed 's/^/D /' | tr '\\n' '\\0'\n } | sort -z -k 2 | xargs -0 sh -c '\n while [ \"$1\" ]; do\n \ttag=$(echo \"$1\" | cut -d \" \" -f 1);\n"},{"id":"693","messageId":"20050418204814.GF5554@pasky.ji.cz","threadId":"113","inReplyTo":"42641AE4.9050700@dgreaves.com","subject":"Re: Add + Status patches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-18T20:48:14Z","receivedAt":"2005-04-18T20:48:14Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, Apr 18, 2005 at 10:39:00PM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Hi Petr\n\nHi,\n\n> Thankyou for the help earlier - problem resolved.\n> \n> I have a trivial patch (attached).\n> \n> It allows:\n> find src -type f | git add -\n> \n> and fixes git status not reporting added files properly (on my debian \n> system it only reported the first file in .git/add-queue)\n\nThanks. Could you please send the patches signed off and either with\ncontent-disposition: inline or in the mail body?\n\nI think it would be cleaner to do the testing for the dash in the for\nloop, so that I can do git add foo bar -.  Also, don't forget to update\ngit add's documentation at the top. For the usage string, I'd probably\nprefer (-|FILE)...\n\nthanks,\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":"695","messageId":"7v64yju7er.fsf@assigned-by-dhcp.cox.net","threadId":"113","inReplyTo":"42641AE4.9050700@dgreaves.com","subject":"Re: Add + Status patches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-18T21:00:44Z","receivedAt":"2005-04-18T21:00:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"DG\" == David Greaves <david@dgreaves.com> writes:\n\nDG> Hi Petr\nDG> Thankyou for the help earlier - problem resolved.\n\nDG> I have a trivial patch (attached).\n\nDG> It allows:\nDG>  find src -type f | git add -\n\nI am slow today, but have you considered using xargs?\n\n\n"},{"id":"707","messageId":"4264321F.2050107@dgreaves.com","threadId":"113","inReplyTo":"20050418204814.GF5554@pasky.ji.cz","subject":"[PATCH 1/1] add, rm + status patches","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-04-18T22:18:07Z","receivedAt":"2005-04-18T22:18:07Z","isPatch":true,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Petr Baudis wrote:\n\n>  Thanks. Could you please send the patches signed off and either with\n>  content-disposition: inline or in the mail body?\nIs this OK.\nThunderbird isn't the best for attaching patches.\n>\n>  I think it would be cleaner to do the testing for the dash in the for\n>  loop, so that I can do git add foo bar -. Also, don't forget to\n>  update git add's documentation at the top. For the usage string, I'd\n>  probably prefer (-|FILE)...\n>\n>  thanks,\n\nHere you are:\n* git add and git rm now take (-|FILE)...\n* noted some bugs to be fixed\n* introduced de-dupe code into add and rm\n* git status reports added/removed files (although there are extra entries)\n* README, git and command docs updated\n\nI realise as I write this that I should have split these patches up - I \nwill do so next time.\n\nHas a decision been reached to _not_ code the cogito part of the git \nsuite in perl?\n\nI ask because the code in git status is getting pretty ugly.\nI'd be happy to help with a preliminary port to perl.\n\nDavid\n\nSigned-off-by: David Greaves <david@dgreaves.com>\n---\nIndex: README\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/README (mode:100644 \nsha1:798476ad292cc6edf5a2f5782e1de82f6052abe2)\n+++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/README (mode:100644 \nsha1:4282af1604e429dd767fe721751b5ac4a87c410e)\n@@ -89,6 +89,10 @@\nOf course you will want to commit. If you added any new files, do\n\ngit add newfile1 newfile2 ...\n+\n+or even\n+\n+ find src -type f | git add -\n\nfirst. Then feel free to commit by\n\nIndex: git\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/git (mode:100755 \nsha1:b648169640025bd68d1b27a0fcc85b65d85e4440)\n+++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/git (mode:100755 \nsha1:2549bc3dc36ec00e747e91edb6e839be0f37ae4a)\n@@ -25,7 +25,7 @@\nUsage: git COMMAND [ARG]...\n\nAvailable commands:\n- add FILE...\n+ add (-|FILE)...\naddremote RNAME RSYNC_URL\napply < patch on stdin\ncancel\n@@ -41,7 +41,7 @@\nlsremote\nmerge -b BASE_ID FROM_ID\npull [RNAME]\n- rm FILE...\n+ rm (-|FILE)...\nseek [COMMIT_ID]\nstatus\ntag TNAME [COMMIT_ID]\nIndex: gitadd.sh\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitadd.sh (mode:100755 \nsha1:3ed93ea0fcb995673ba9ee1982e0e7abdbe35982)\n+++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/gitadd.sh (mode:100755 \nsha1:a3e83ac52abd5a9cdc6abd560f95b2f19646fd99)\n@@ -5,14 +5,26 @@\n#\n# Takes a list of file names at the command line, and schedules them\n# for addition to the GIT repository at the next commit.\n+# If one of the filenames is '-' then also read a filelist from STDIN\n#\n# FIXME: Those files are omitted from show-diff output!\n+# FIXME: No checking against git-ignore\n+# FIXME: No checking against .git/del-queue\n+\n\nif [ ! \"$1\" ]; then\n- echo \"gitadd.sh: usage: git add FILE...\" >&2\n+ echo \"gitadd.sh: usage: git add (-|FILE)...\" >&2\nexit 1;\nfi\n\nfor file in \"$@\"; do\n- echo $file >>.git/add-queue\n+ if [ $file = \"-\" -a ! \"$DONE_STDIN\" ]; then\n+ cat >> .git/add-queue\n+ DONE_STDIN=1\n+ else\n+ echo $file >>.git/add-queue\n+ fi\ndone\n+\n+# Remove duplicates\n+sort < .git/add-queue | uniq > .git/add-queue\n\\ No newline at end of file\nIndex: gitrm.sh\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitrm.sh (mode:100755 \nsha1:5c18c38a890c9fd9ad2b866ee7b529539d2f3f8f)\n+++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/gitrm.sh (mode:100755 \nsha1:d76542dd6ad892fbbdc93e475aa9b77dd2922fe5)\n@@ -5,15 +5,28 @@\n#\n# Takes a list of file names at the command line, and schedules them\n# for addition to the GIT repository at the next commit.\n+# If one of the filenames is '-' then also read a filelist from STDIN\n#\n# FIXME: Those files are omitted from show-diff output!\n+# FIXME: No checking against git-ignore\n+# FIXME: No checking against .git/add-queue\n+# FIXME: Files read in on stdin aren't validated to exist\n+\n\nif [ ! \"$1\" ]; then\n- echo \"gitrm.sh: usage: git rm FILE...\" >&2\n+ echo \"gitrm.sh: usage: git rm (-|FILE)...\" >&2\nexit 1;\nfi\n\nfor file in \"$@\"; do\n- [ -e \"$file\" ] && rm \"$file\"\n- echo $file >>.git/rm-queue\n+ if [ $file = \"-\" -a ! \"$DONE_STDIN\" ]; then\n+ cat >> .git/rm-queue\n+ DONE_STDIN=1\n+ else\n+ [ -e \"$file\" ] && rm \"$file\"\n+ echo $file >>.git/rm-queue\n+ fi\ndone\n+\n+# Remove duplicates\n+sort < .git/rm-queue | uniq > .git/rm-queue\n\\ No newline at end of file\nIndex: gitstatus.sh\n===================================================================\n--- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitstatus.sh (mode:100755 \nsha1:6c33f805ebc2630b14a88a07dfc891a9196d66a5)\n+++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/gitstatus.sh (mode:100755 \nsha1:2611d00189e5d03ba8356ec0e4c3af107bae6981)\n@@ -3,10 +3,12 @@\n# Show status of entries in your working tree.\n# Copyright (c) Petr Baudis, 2005\n\n+# FIXME: newly added files show up twice as ? _AND_ A\n+\n{\nshow-files -z -t --others --deleted --unmerged\n- [ -s .git/add-queue ] && cat .git/add-queue | sed 's/^/A /' | { read \nx; echo -ne $x'\\0'; }\n- [ -s .git/rm-queue ] && cat .git/rm-queue | sed 's/^/D /' | { read x; \necho -ne $x'\\0'; }\n+ [ -s .git/add-queue ] && cat .git/add-queue | sed 's/^/A /' | tr '\\n' '\\0'\n+ [ -s .git/rm-queue ] && cat .git/rm-queue | sed 's/^/D /' | tr '\\n' '\\0'\n} | sort -z -k 2 | xargs -0 sh -c '\nwhile [ \"$1\" ]; do\ntag=$(echo \"$1\" | cut -d \" \" -f 1);\n\n"},{"id":"708","messageId":"42643224.60407@dgreaves.com","threadId":"113","inReplyTo":"7v64yju7er.fsf@assigned-by-dhcp.cox.net","subject":"Re: Add + Status patches","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-04-18T22:18:12Z","receivedAt":"2005-04-18T22:18:12Z","isPatch":false,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Junio C Hamano wrote:\n\n>DG> It allows:\n>DG>  find src -type f | git add -\n>\n>I am slow today, but have you considered using xargs?\n>\n>  \n>\nyep thanks :)\nI know you _could_ do it with xargs - but you _could_ use the raw git \ncommands too. This is a \"be nice to the user\" layer and I was \n'surprised' that neither\ngit add .\nnor\ngit add -r .\nworked.\n\nThat meant that I had to fix it so I started with the ability to handle \na list and, since I got a friendly response, I can hopefully move on to \nhelp make git nicer to use for mere mortals.\n\nDavid\n"},{"id":"709","messageId":"7v1x97u3hj.fsf@assigned-by-dhcp.cox.net","threadId":"113","inReplyTo":"42643224.60407@dgreaves.com","subject":"Re: Add + Status patches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-18T22:25:28Z","receivedAt":"2005-04-18T22:25:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"DG\" == David Greaves <david@dgreaves.com> writes:\n\nDG> ... neither\nDG> git add .\nDG> nor\nDG> git add -r .\nDG> worked.\n\nThese would be much much much nicer than pipe the list of\nfilenames from stdin which reminds me of cpio ;-).\n\n"},{"id":"712","messageId":"20050418223529.GK5554@pasky.ji.cz","threadId":"113","inReplyTo":"42643224.60407@dgreaves.com","subject":"Re: Add + Status patches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-18T22:35:30Z","receivedAt":"2005-04-18T22:35:30Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Apr 19, 2005 at 12:18:12AM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Junio C Hamano wrote:\n> \n> >DG> It allows:\n> >DG>  find src -type f | git add -\n> >\n> >I am slow today, but have you considered using xargs?\n> >\n> > \n> >\n> yep thanks :)\n> I know you _could_ do it with xargs - but you _could_ use the raw git \n> commands too. This is a \"be nice to the user\" layer and I was \n> 'surprised' that neither\n> git add .\n> nor\n> git add -r .\n> worked.\n\nActually, when I saw your patch, the xargs solution rushed through my\nmind but I thought that '-' might be practical too. Thinking about it, I\ncouldn't come up with anything. So, what about instead making git add .\nto work? ;-)\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":"714","messageId":"20050418224114.GL5554@pasky.ji.cz","threadId":"113","inReplyTo":"4264321F.2050107@dgreaves.com","subject":"Re: [PATCH 1/1] add, rm + status patches","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-18T22:41:14Z","receivedAt":"2005-04-18T22:41:14Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Apr 19, 2005 at 12:18:07AM CEST, I got a letter\nwhere David Greaves <david@dgreaves.com> told me that...\n> Petr Baudis wrote:\n> \n> > Thanks. Could you please send the patches signed off and either with\n> > content-disposition: inline or in the mail body?\n> Is this OK.\n> Thunderbird isn't the best for attaching patches.\n\nYes. The patch you inserted is useless, whitespaces are mangled away.\n\n> > I think it would be cleaner to do the testing for the dash in the for\n> > loop, so that I can do git add foo bar -. Also, don't forget to\n> > update git add's documentation at the top. For the usage string, I'd\n> > probably prefer (-|FILE)...\n> >\n> > thanks,\n> \n> Here you are:\n> * git add and git rm now take (-|FILE)...\n> * noted some bugs to be fixed\n> * introduced de-dupe code into add and rm\n> * git status reports added/removed files (although there are extra entries)\n> * README, git and command docs updated\n> \n> I realise as I write this that I should have split these patches up - I \n> will do so next time.\n\nWell, I didn't ask you to split the patch the first time since it was\nquite trivial for me to do, but this is too much. ;-)\n\n> Has a decision been reached to _not_ code the cogito part of the git \n> suite in perl?\n> \n> I ask because the code in git status is getting pretty ugly.\n> I'd be happy to help with a preliminary port to perl.\n\nI'm fine with Perl. I chose shell for the very initial implementation since\nit actually was simplest, but now, I wouldn't have anything against Perl\nif it makes is simpler. (And as long as your Perl is nice. I'm harsh\nreviewer. ;-)\n\n> Index: gitadd.sh\n> ===================================================================\n> --- c0aff9b98c4242ab8965c428241df1d8f7a1d4bb/gitadd.sh (mode:100755 \n> sha1:3ed93ea0fcb995673ba9ee1982e0e7abdbe35982)\n> +++ cd5cd7a9272ce1966aca3bfce15f703e33cafc04/gitadd.sh (mode:100755 \n> sha1:a3e83ac52abd5a9cdc6abd560f95b2f19646fd99)\n> \\ No newline at end of file\n\nNote this. Something is wrong with your text editor, too.\n\nKind regards,\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"}]}