git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2] count-objects: add human-readable size option

From
Alex Riesen <raa.lkml@gmail.com>
Date
Aug 14, 2008, 18:51 UTC
Message-ID
<20080814185131.GA14858@steel.home>
In-Reply-To
<48A43B2A.7010702@griep.us>
Marcus Griep, Thu, Aug 14, 2008 16:03:22 +0200:
Show 6 quoted lines
> Alex Riesen wrote:
> > GNU ls and du use "-h", with du using -H for SI units.
> 
> git's parse options plays interference here and injects the usage
> and exits if it finds the '-h' option.  Is there a way to get around
> that?

AFAICS - no. I'd suggest removing "-h" from the unconditionally reserved list of options (untested patch attached). "--help" is well known (which could be a reason why coreutils uses just it).

On somewhat similar note, how about be a bit _less_ user-friendly in the text messages? IOW, make things like "something didn't work, please try doing 'git something-else'" configurable (ok, active by default, by deactivatable). These take an awful lot of screen space. The builtin fetch, checkout, add (the most often used commands) are the chattiest. The text in commit buffer takes almost half of screen, too.

--
diff --git a/parse-options.c b/parse-options.c
index fd08bb4..7f85cd7 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -267,8 +267,6 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 
 		if (arg[1] != '-') {
 			ctx->opt = arg + 1;
-			if (*ctx->opt == 'h')
-				return parse_options_usage(usagestr, options);
 			switch (parse_short_opt(ctx, options)) {
 			case -1:
 				return parse_options_usage(usagestr, options);
@@ -278,8 +276,6 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 			if (ctx->opt)
 				check_typos(arg + 1, options);
 			while (ctx->opt) {
-				if (*ctx->opt == 'h')
-					return parse_options_usage(usagestr, options);
 				switch (parse_short_opt(ctx, options)) {
 				case -1:
 					return parse_options_usage(usagestr, options);
Previous: Marcus GriepNext: Pierre Habouzit
Message 10 of 18 in “count-objects: Add total pack size to verbose output”
  1. count-objects: Add total pack size to verbose outputMarcus Griep, Aug 13, 2008
  2. count-objects: add human-readable size optionMarcus Griep, Aug 14, 2008
  3. Shawn O. PearceAug 14, 2008
  4. Marcus GriepAug 14, 2008
  5. Junio C HamanoAug 14, 2008
  6. Johannes SchindelinAug 14, 2008
  7. Marcus GriepAug 14, 2008
  8. Alex RiesenAug 14, 2008
  9. Marcus GriepAug 14, 2008
  10. Alex RiesenAug 14, 2008
  11. Pierre HabouzitAug 15, 2008
  12. Alex RiesenAug 18, 2008
  13. Johannes SixtAug 14, 2008
  14. Marcus GriepAug 14, 2008
  15. Petr BaudisAug 14, 2008
  16. Marcus GriepAug 14, 2008
  17. Petr BaudisAug 14, 2008
  18. Marcus GriepAug 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.