{"thread":{"id":"12077","subject":"[PATCH] hash-object: don't rely on order of --stdin, -w arguments","startedAt":"2008-02-13T19:03:38Z","lastAt":"2008-02-21T10:06:47Z","messageCount":7,"participants":["Gerrit Pape","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"68668","messageId":"20080213190338.7393.qmail@d70c5cbe18d4bd.315fe32.mid.smarden.org","threadId":"12077","inReplyTo":null,"subject":"[PATCH] hash-object: don't rely on order of --stdin, -w arguments","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-13T19:03:38Z","receivedAt":"2008-02-13T19:03:38Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"Fix 'git hash-object --stdin -w' to actually write the object, just as\n'git hash-object -w --stdin' does.\n\nReported by Josh Triplett through\n http://bugs.debian.org/464432\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n hash-object.c |    8 +++++---\n 1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/hash-object.c b/hash-object.c\nindex 0a58f3f..ff60f0f 100644\n--- a/hash-object.c\n+++ b/hash-object.c\n@@ -41,6 +41,7 @@ int main(int argc, char **argv)\n \tconst char *prefix = NULL;\n \tint prefix_length = -1;\n \tint no_more_flags = 0;\n+\tint hashstdin = 0;\n \n \tgit_config(git_default_config);\n \n@@ -64,9 +65,8 @@ int main(int argc, char **argv)\n \t\t\t}\n \t\t\telse if (!strcmp(argv[i], \"--help\"))\n \t\t\t\tusage(hash_object_usage);\n-\t\t\telse if (!strcmp(argv[i], \"--stdin\")) {\n-\t\t\t\thash_stdin(type, write_object);\n-\t\t\t}\n+\t\t\telse if (!strcmp(argv[i], \"--stdin\"))\n+\t\t\t\thashstdin = 1;\n \t\t\telse\n \t\t\t\tusage(hash_object_usage);\n \t\t}\n@@ -79,5 +79,7 @@ int main(int argc, char **argv)\n \t\t\tno_more_flags = 1;\n \t\t}\n \t}\n+\tif (hashstdin)\n+\t\thash_stdin(type, write_object);\n \treturn 0;\n }\n-- \n1.5.4.1\n"},{"id":"68673","messageId":"7v7ih8pre6.fsf@gitster.siamese.dyndns.org","threadId":"12077","inReplyTo":"20080213190338.7393.qmail@d70c5cbe18d4bd.315fe32.mid.smarden.org","subject":"Re: [PATCH] hash-object: don't rely on order of --stdin, -w arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-13T19:50:41Z","receivedAt":"2008-02-13T19:50:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> Fix 'git hash-object --stdin -w' to actually write the object, just as\n> 'git hash-object -w --stdin' does.\n\nCan we have additions to the test scripts to illustrate:\n\n - what used to happen if you had \"--stdin -w\" on the command\n   line (presumably you did not get the object written, which is\n   a buggy behaviour and the patch should fix it);\n\n - what used to happen if you had \"-w --stdin --stdin\" on the\n   command line (I imagine you used to be able to feed two\n   separate streams when you are on a terminal by typing ^Ds in\n   between?);\n\n - any other combination that may deserve testing.\n\nin order to (1) show existing bugs the patch is trying to\naddress, (2) demonstrate that the patch fixes them without\nregressing, and (3) protect the fix from being broken by future\nchanges, pretty please?\n"},{"id":"68682","messageId":"20080213224941.18121.qmail@c0fdbb95c1b5f1.315fe32.mid.smarden.org","threadId":"12077","inReplyTo":"7v7ih8pre6.fsf@gitster.siamese.dyndns.org","subject":"[PATCH/selftest] hash-object: don't rely on order of --stdin, -w arguments","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-13T22:49:41Z","receivedAt":"2008-02-13T22:49:41Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"Fix 'git hash-object --stdin -w' to actually write the object, just as\n'git hash-object -w --stdin' does.\n\nReported by Josh Triplett through\n http://bugs.debian.org/464432\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n hash-object.c          |    8 +++++---\n t/t5303-hash-object.sh |   19 +++++++++++++++++++\n 2 files changed, 24 insertions(+), 3 deletions(-)\n create mode 100755 t/t5303-hash-object.sh\n\ndiff --git a/hash-object.c b/hash-object.c\nindex 0a58f3f..ff60f0f 100644\n--- a/hash-object.c\n+++ b/hash-object.c\n@@ -41,6 +41,7 @@ int main(int argc, char **argv)\n \tconst char *prefix = NULL;\n \tint prefix_length = -1;\n \tint no_more_flags = 0;\n+\tint hashstdin = 0;\n \n \tgit_config(git_default_config);\n \n@@ -64,9 +65,8 @@ int main(int argc, char **argv)\n \t\t\t}\n \t\t\telse if (!strcmp(argv[i], \"--help\"))\n \t\t\t\tusage(hash_object_usage);\n-\t\t\telse if (!strcmp(argv[i], \"--stdin\")) {\n-\t\t\t\thash_stdin(type, write_object);\n-\t\t\t}\n+\t\t\telse if (!strcmp(argv[i], \"--stdin\"))\n+\t\t\t\thashstdin = 1;\n \t\t\telse\n \t\t\t\tusage(hash_object_usage);\n \t\t}\n@@ -79,5 +79,7 @@ int main(int argc, char **argv)\n \t\t\tno_more_flags = 1;\n \t\t}\n \t}\n+\tif (hashstdin)\n+\t\thash_stdin(type, write_object);\n \treturn 0;\n }\ndiff --git a/t/t5303-hash-object.sh b/t/t5303-hash-object.sh\nnew file mode 100755\nindex 0000000..23dcfcb\n--- /dev/null\n+++ b/t/t5303-hash-object.sh\n@@ -0,0 +1,19 @@\n+#!/bin/sh\n+\n+test_description=git-hash-object\n+\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'git hash-object -w --stdin saves the object' \\\n+    'echo foo | git hash-object -w --stdin &&\n+    test -r .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 &&\n+    rm -f .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99'\n+    \n+test_expect_success \\\n+    'git hash-object --stdin -w saves the object' \\\n+    'echo foo | git hash-object --stdin -w &&\n+    test -r .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 &&\n+    rm -f .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99'    \n+\n+test_done\n-- \n1.5.4.1\n"},{"id":"68684","messageId":"7v8x1oo2w8.fsf@gitster.siamese.dyndns.org","threadId":"12077","inReplyTo":"20080213224941.18121.qmail@c0fdbb95c1b5f1.315fe32.mid.smarden.org","subject":"Re: [PATCH/selftest] hash-object: don't rely on order of --stdin, -w arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-13T23:25:11Z","receivedAt":"2008-02-13T23:25:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> Fix 'git hash-object --stdin -w' to actually write the object, just as\n> 'git hash-object -w --stdin' does.\n>\n> Reported by Josh Triplett through\n>  http://bugs.debian.org/464432\n>\n> Signed-off-by: Gerrit Pape <pape@smarden.org>\n\nThanks.  I think the patch itself is a good fix to the old\ndesign mistake we made.\n\nHowever, I would _really_ like to see something like the\nfollowing mentioned in the proposed commit log message for\ndiscussion:\n\n    This regresses the use case of running:\n\n        $ git hash-object --stdin Makefile <cache.h\n\n    to obtain hash values for cache.h and then Makefile.  It\n    used to report the object names in order, but now it always\n    processes --stdin at the end.  It is not an issue if\n    everything is file (i.e. \"git hash-object cache.h Makefile\"\n    is an easy replacement), but if existing scripts used the\n    option to read from a pipe, this might become problematic.\n\n    Similarly, when typing from terminal:\n\n        $ git hash-object --stdin --stdin\n        foo\n        ^D\n        bar\n        ^D\n\n    used to work, but not anymore.  The latter however should\n    not be something we need to worry about.  It is an insane\n    usage.\n\nGranted, we _should have_ prevented such insane usages (the\nsecond one is definitely insane and not so useful, and the first\none is but to a much lessor degree).  We _should have_ forced\nscripted users to do these with two separate invocations of \"git\nhash-object\", by refusing more than one --stdin and --stdin with\nfilename on the command line.  But we didn't, and this earlier\ndesign mistake has already been in the field for a long time.\nPeople may have been depending on the existing misbehaviour.\n\nSo I am Ok with the patch, and I strongly suspect that we should\neven detect more than one --stdin and --stdin with filename on\nthe command line to reject the usage your saner version behaves\ndifferently from before, instead of accepting and silently doing\nan unexpected thing.\n\nBut at the same time I would really like our commit messages,\nand Release Notes that is based on these commit messages, to be\n_candid_ about our previous mistakes and the incompatibility we\nare incurring to the existing users.\n\n> +test_expect_success \\\n> +    'git hash-object -w --stdin saves the object' \\\n> +    'echo foo | git hash-object -w --stdin &&\n> +    test -r .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99 &&\n> +    rm -f .git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99'\n\nI'd feel better if tests outside t0000 did not hardcode the\nactual values, like this:\n\n\tobname=$(echo foo | git hash-object -w --stdin) &&\n        ob=$(expr \"$obname\" : \"\\(..\\)\") &&\n        name=$(expr \"$obname\" : \"..\\(.*\\)\") &&\n        test -f \".git/objects/$ob/$name\"\n"},{"id":"68769","messageId":"20080214201355.6021.qmail@6a68c4de06516f.315fe32.mid.smarden.org","threadId":"12077","inReplyTo":"7v8x1oo2w8.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] hash-object: cleanup handling of command line options","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-14T20:13:55Z","receivedAt":"2008-02-14T20:13:55Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"git hash-object used to process the --stdin command line argument\nbefore reading subsequent arguments.  This caused 'git hash-object\n--stdin -w' to fail to actually write the object into the\ndatabase, while '-w --stdin' properly did.  Now git hash-object\nprocesses --stdin at the end, after all other arguments.\n\nThis regresses the use case of running:\n\n   $ git hash-object --stdin Makefile <cache.h\n\nto obtain hash values for cache.h and then Makefile.  It used to\nreport the object names in order, but now it always processes\n--stdin at the end.  It is not an issue if everything is file\n(i.e.  \"git hash-object cache.h Makefile\" is an easy replacement),\nbut if existing scripts used the option to read from a pipe, this\nmight become problematic.\n\nFurthermore git hash-object used to allow multiple --stdin\narguments on the command line, supporting insane usage, such as\n\n   $ git hash-object --stdin --stdin\n     foo\n     ^D\n     bar\n     ^D\n\nNow git hash-object errors out if --stdin is given more than once.\n\nReported by Josh Triplett through\n http://bugs.debian.org/464432\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n hash-object.c          |    7 ++++++-\n t/t5303-hash-object.sh |   35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 1 deletions(-)\n create mode 100755 t/t5303-hash-object.sh\n\ndiff --git a/hash-object.c b/hash-object.c\nindex 0a58f3f..67d9922 100644\n--- a/hash-object.c\n+++ b/hash-object.c\n@@ -41,6 +41,7 @@ int main(int argc, char **argv)\n \tconst char *prefix = NULL;\n \tint prefix_length = -1;\n \tint no_more_flags = 0;\n+\tint hashstdin = 0;\n \n \tgit_config(git_default_config);\n \n@@ -65,7 +66,9 @@ int main(int argc, char **argv)\n \t\t\telse if (!strcmp(argv[i], \"--help\"))\n \t\t\t\tusage(hash_object_usage);\n \t\t\telse if (!strcmp(argv[i], \"--stdin\")) {\n-\t\t\t\thash_stdin(type, write_object);\n+\t\t\t\tif (hashstdin)\n+\t\t\t\t\tdie(\"Multiple --stdin arguments are not supported\");\n+\t\t\t\thashstdin = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t\tusage(hash_object_usage);\n@@ -79,5 +82,7 @@ int main(int argc, char **argv)\n \t\t\tno_more_flags = 1;\n \t\t}\n \t}\n+\tif (hashstdin)\n+\t\thash_stdin(type, write_object);\n \treturn 0;\n }\ndiff --git a/t/t5303-hash-object.sh b/t/t5303-hash-object.sh\nnew file mode 100755\nindex 0000000..14be455\n--- /dev/null\n+++ b/t/t5303-hash-object.sh\n@@ -0,0 +1,35 @@\n+#!/bin/sh\n+\n+test_description=git-hash-object\n+\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'git hash-object -w --stdin saves the object' \\\n+    'obname=$(echo foo | git hash-object -w --stdin) &&\n+    obpath=$(echo $obname | sed -e \"s/\\(..\\)/\\1\\//\") &&\n+    test -r .git/objects/\"$obpath\" &&\n+    rm -f .git/objects/\"$obpath\"'\n+    \n+test_expect_success \\\n+    'git hash-object --stdin -w saves the object' \\\n+    'obname=$(echo foo | git hash-object --stdin -w) &&\n+    obpath=$(echo $obname | sed -e \"s/\\(..\\)/\\1\\//\") &&\n+    test -r .git/objects/\"$obpath\" &&\n+    rm -f .git/objects/\"$obpath\"'    \n+\n+test_expect_success \\\n+    'git hash-object --stdin file0 <file1 first operates on file0, then file1' \\\n+    'echo foo > file0 &&\n+    obname0=$(git hash-object file0) &&\n+    obname1=$(echo bar | git hash-object --stdin) &&\n+    obname0new=$(echo bar | git hash-object --stdin file0 | sed -n -e 1p) &&\n+    obname1new=$(echo bar | git hash-object --stdin file0 | sed -n -e 2p) &&\n+    test \"$obname0\" = \"$obname0new\" &&\n+    test \"$obname1\" = \"$obname1new\"'\n+\n+test_expect_success \\\n+    'git hash-object refuses multiple --stdin arguments' \\\n+    '! git hash-object --stdin --stdin < file0'\n+\n+test_done\n-- \n1.5.4.1\n"},{"id":"68821","messageId":"7vskzugm8x.fsf@gitster.siamese.dyndns.org","threadId":"12077","inReplyTo":"20080214201355.6021.qmail@6a68c4de06516f.315fe32.mid.smarden.org","subject":"Re: [PATCH] hash-object: cleanup handling of command line options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-15T17:31:10Z","receivedAt":"2008-02-15T17:31:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> This regresses the use case of running:\n>\n>    $ git hash-object --stdin Makefile <cache.h\n>\n> to obtain hash values for cache.h and then Makefile.  It used to\n> report the object names in order, but now it always processes\n> --stdin at the end.\n\nIsn't this change of behaviour more serious than the made up\n\"--stdin --stdin\" example?  The made-up insane usage is rejected\nwith your patch now, so it would be fine, but that is so insane\nthat we probably even did not need to explicitly reject.  On the\nother hand, running \"--stdin file2 <file1\" and expecting the\noutput to be given for file1 first and then file2 is much less\ninsane, and it would make more sense to reject it if we cannot\nsupport that earlier behaviour.  Not rejecting such a use and\ndoing different thing from what we used to will break existing\nuses silently.\n\nI suppose we could first see if there is -w in the first pass\nand then in the second pass do exactly what we used to do, if we\nwant to fix this without regressing at all.  Then there won't\nbe any regression, even \"--stdin --stdin\" would keep working.\n\nExcept for one case.\n\nEarlier you could \"hash-object --stdin -w cache.h <Makefile\" to\nget the hash of Makefile without writing to the object store,\nand get the hash of cache.h and write that to the object store.\n\nWith such a fix with less regression, we will get the two object\nnames in the right order (--stdin first and then explicit\nfilename, as the user wanted to have), but now we write what we\nget from --stdin to the object database, even though the user\ndid _not_ want to (that is why he wrote -w after --stdin, not\nbefore).\n\nHmmmm.  Why is it so bad if \"--stdin -w\" and \"-w --stdin\" works\ndifferently?\n\nHaving said all that, I think \"--stdin file2 <file1\" behaviour\ncan be kept without regressing by a patch like this on top of\nyour fix, and we can drop the first \"regression warning\" in the\ncommit log message if we did so.\n\n---\n\n hash-object.c          |    5 +++++\n t/t5303-hash-object.sh |    4 ++--\n 2 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/hash-object.c b/hash-object.c\nindex 67d9922..61e7160 100644\n--- a/hash-object.c\n+++ b/hash-object.c\n@@ -75,6 +75,11 @@ int main(int argc, char **argv)\n \t\t}\n \t\telse {\n \t\t\tconst char *arg = argv[i];\n+\n+\t\t\tif (hashstdin) {\n+\t\t\t\thash_stdin(type, write_object);\n+\t\t\t\thashstdin = 0;\n+\t\t\t}\n \t\t\tif (0 <= prefix_length)\n \t\t\t\targ = prefix_filename(prefix, prefix_length,\n \t\t\t\t\t\t      arg);\ndiff --git a/t/t5303-hash-object.sh b/t/t5303-hash-object.sh\nindex 14be455..7c4f9fa 100755\n--- a/t/t5303-hash-object.sh\n+++ b/t/t5303-hash-object.sh\n@@ -21,8 +21,8 @@ test_expect_success \\\n test_expect_success \\\n     'git hash-object --stdin file0 <file1 first operates on file0, then file1' \\\n     'echo foo > file0 &&\n-    obname0=$(git hash-object file0) &&\n-    obname1=$(echo bar | git hash-object --stdin) &&\n+    obname0=$(echo bar | git hash-object --stdin) &&\n+    obname1=$(git hash-object file0) &&\n     obname0new=$(echo bar | git hash-object --stdin file0 | sed -n -e 1p) &&\n     obname1new=$(echo bar | git hash-object --stdin file0 | sed -n -e 2p) &&\n     test \"$obname0\" = \"$obname0new\" &&\n"},{"id":"69467","messageId":"20080221100647.27841.qmail@2fb9ba03eba069.315fe32.mid.smarden.org","threadId":"12077","inReplyTo":"7vskzugm8x.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] hash-object: cleanup handling of command line options","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2008-02-21T10:06:47Z","receivedAt":"2008-02-21T10:06:47Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"git hash-object used to process the --stdin command line argument\nbefore reading subsequent arguments.  This caused 'git hash-object\n--stdin -w' to fail to actually write the object into the\ndatabase, while '-w --stdin' properly did.  Now git hash-object\nfirst reads all arguments, and then processes them.\n\nThis regresses one insane use case.  git hash-object used to allow\nmultiple --stdin arguments on the command line:\n\n   $ git hash-object --stdin --stdin\n     foo\n     ^D\n     bar\n     ^D\n\nNow git hash-object errors out if --stdin is given more than once.\n\nReported by Josh Triplett through\n http://bugs.debian.org/464432\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n\nOn Fri, Feb 15, 2008 at 09:31:10AM -0800, Junio C Hamano wrote:\n> Having said all that, I think \"--stdin file2 <file1\" behaviour\n> can be kept without regressing by a patch like this on top of\n> your fix, and we can drop the first \"regression warning\" in the\n> commit log message if we did so.\n\nYes, this seems the better choice.  I adapted the commit message a bit,\nand swapped file0 and file1 in the test description and the selftest\nwhere appropriate, it's been mixed up.\n\nRegards, Gerrit.\n\n\n hash-object.c          |   12 +++++++++++-\n t/t5303-hash-object.sh |   35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 46 insertions(+), 1 deletions(-)\n create mode 100755 t/t5303-hash-object.sh\n\ndiff --git a/hash-object.c b/hash-object.c\nindex 0a58f3f..61e7160 100644\n--- a/hash-object.c\n+++ b/hash-object.c\n@@ -41,6 +41,7 @@ int main(int argc, char **argv)\n \tconst char *prefix = NULL;\n \tint prefix_length = -1;\n \tint no_more_flags = 0;\n+\tint hashstdin = 0;\n \n \tgit_config(git_default_config);\n \n@@ -65,13 +66,20 @@ int main(int argc, char **argv)\n \t\t\telse if (!strcmp(argv[i], \"--help\"))\n \t\t\t\tusage(hash_object_usage);\n \t\t\telse if (!strcmp(argv[i], \"--stdin\")) {\n-\t\t\t\thash_stdin(type, write_object);\n+\t\t\t\tif (hashstdin)\n+\t\t\t\t\tdie(\"Multiple --stdin arguments are not supported\");\n+\t\t\t\thashstdin = 1;\n \t\t\t}\n \t\t\telse\n \t\t\t\tusage(hash_object_usage);\n \t\t}\n \t\telse {\n \t\t\tconst char *arg = argv[i];\n+\n+\t\t\tif (hashstdin) {\n+\t\t\t\thash_stdin(type, write_object);\n+\t\t\t\thashstdin = 0;\n+\t\t\t}\n \t\t\tif (0 <= prefix_length)\n \t\t\t\targ = prefix_filename(prefix, prefix_length,\n \t\t\t\t\t\t      arg);\n@@ -79,5 +87,7 @@ int main(int argc, char **argv)\n \t\t\tno_more_flags = 1;\n \t\t}\n \t}\n+\tif (hashstdin)\n+\t\thash_stdin(type, write_object);\n \treturn 0;\n }\ndiff --git a/t/t5303-hash-object.sh b/t/t5303-hash-object.sh\nnew file mode 100755\nindex 0000000..543c078\n--- /dev/null\n+++ b/t/t5303-hash-object.sh\n@@ -0,0 +1,35 @@\n+#!/bin/sh\n+\n+test_description=git-hash-object\n+\n+. ./test-lib.sh\n+\n+test_expect_success \\\n+    'git hash-object -w --stdin saves the object' \\\n+    'obname=$(echo foo | git hash-object -w --stdin) &&\n+    obpath=$(echo $obname | sed -e \"s/\\(..\\)/\\1\\//\") &&\n+    test -r .git/objects/\"$obpath\" &&\n+    rm -f .git/objects/\"$obpath\"'\n+    \n+test_expect_success \\\n+    'git hash-object --stdin -w saves the object' \\\n+    'obname=$(echo foo | git hash-object --stdin -w) &&\n+    obpath=$(echo $obname | sed -e \"s/\\(..\\)/\\1\\//\") &&\n+    test -r .git/objects/\"$obpath\" &&\n+    rm -f .git/objects/\"$obpath\"'    \n+\n+test_expect_success \\\n+    'git hash-object --stdin file1 <file0 first operates on file0, then file1' \\\n+    'echo foo > file1 &&\n+    obname0=$(echo bar | git hash-object --stdin) &&\n+    obname1=$(git hash-object file1) &&\n+    obname0new=$(echo bar | git hash-object --stdin file1 | sed -n -e 1p) &&\n+    obname1new=$(echo bar | git hash-object --stdin file1 | sed -n -e 2p) &&\n+    test \"$obname0\" = \"$obname0new\" &&\n+    test \"$obname1\" = \"$obname1new\"'\n+\n+test_expect_success \\\n+    'git hash-object refuses multiple --stdin arguments' \\\n+    '! git hash-object --stdin --stdin < file1'\n+\n+test_done\n-- \n1.5.4.2\n"}]}