git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hash-object: don't rely on order of --stdin, -w arguments
@ 2008-02-13 19:03 Gerrit Pape
  2008-02-13 19:50 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Gerrit Pape @ 2008-02-13 19:03 UTC (permalink / raw)
  To: git, Junio C Hamano

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 <pape@smarden.org>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-21 10:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 19:03 [PATCH] hash-object: don't rely on order of --stdin, -w arguments Gerrit Pape
2008-02-13 19:50 ` Junio C Hamano
2008-02-13 22:49   ` [PATCH/selftest] " Gerrit Pape
2008-02-13 23:25     ` Junio C Hamano
2008-02-14 20:13       ` [PATCH] hash-object: cleanup handling of command line options Gerrit Pape
2008-02-15 17:31         ` Junio C Hamano
2008-02-21 10:06           ` Gerrit Pape

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).