From: Gerrit Pape Date: Wed, 13 Feb 2008 19:03:38 GMT Subject: [PATCH] hash-object: don't rely on order of --stdin, -w arguments Message-ID: <20080213190338.7393.qmail@d70c5cbe18d4bd.315fe32.mid.smarden.org> Fix 'git hash-object --stdin -w' to actually write the object, just as 'git hash-object -w --stdin' does. Reported by Josh Triplett through http://bugs.debian.org/464432 Signed-off-by: Gerrit Pape --- hash-object.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hash-object.c b/hash-object.c index 0a58f3f..ff60f0f 100644 --- a/hash-object.c +++ b/hash-object.c @@ -41,6 +41,7 @@ int main(int argc, char **argv) const char *prefix = NULL; int prefix_length = -1; int no_more_flags = 0; + int hashstdin = 0; git_config(git_default_config); @@ -64,9 +65,8 @@ int main(int argc, char **argv) } else if (!strcmp(argv[i], "--help")) usage(hash_object_usage); - else if (!strcmp(argv[i], "--stdin")) { - hash_stdin(type, write_object); - } + else if (!strcmp(argv[i], "--stdin")) + hashstdin = 1; else usage(hash_object_usage); } @@ -79,5 +79,7 @@ int main(int argc, char **argv) no_more_flags = 1; } } + if (hashstdin) + hash_stdin(type, write_object); return 0; } -- 1.5.4.1