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

Re: [PATCH 3/5 v2] unpack_trees_options: update porcelain messages

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 15, 2010, 13:05 UTC
Message-ID
<vpqfx0ozbs5.fsf@bauges.imag.fr>
In-Reply-To
<1276604576-28092-4-git-send-email-diane.gasselin@ensimag.imag.fr>
Diane Gasselin <diane.gasselin@ensimag.imag.fr> writes:
Show 5 quoted lines
> -	msgs.would_overwrite = malloc(sizeof(char) * 72);
> +	msgs.would_overwrite = malloc(sizeof(char) * 80);
>  	sprintf((char *)msgs.would_overwrite,
> -		"Your local changes to '%%s' would be overwritten by %s.  Aborting.",
> +		"Your local changes to the following files would be overwritten by %s:\n%%s",

I hate hardcoded string length (these magic 80 and 72). Can't it be stg like

const char * const msg = "Your local changes to ...."; msg.would_overwrite = malloc(strlen(msg) + strlen(cmd) + something); sprintf(msg.would_overwrite, msg, ...);

instead?
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Matthieu MoyNext: Matthieu Moy
Message 8 of 13 in “unpack_trees: nicer error messages”
  1. 0/5 unpack_trees: nicer error messagesDiane Gasselin, Jun 15, 2010
  2. 1/5 merge-recursive: porcelain messages for checkoutDiane Gasselin, Jun 15, 2010
  3. 2/5 unpack_trees: group errors by typeDiane Gasselin, Jun 15, 2010
  4. 3/5 unpack_trees_options: update porcelain messagesDiane Gasselin, Jun 15, 2010
  5. 4/5 tests: update porcelain expected messageDiane Gasselin, Jun 15, 2010
  6. 5/5 t7609: test merge and checkout error messagesDiane Gasselin, Jun 15, 2010
  7. Matthieu MoyJun 15, 2010
  8. Matthieu MoyJun 15, 2010
  9. Matthieu MoyJun 15, 2010
  10. Diane GasselinJun 15, 2010
  11. Matthieu MoyJun 15, 2010
  12. Diane GasselinJun 15, 2010
  13. Matthieu MoyJun 15, 2010

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.