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

Re: [PATCH] submodule: check for NULL return of get_submodule_ref_store()

From
René Scharfe <l.s.r@web.de>
Date
Mar 28, 2018, 22:24 UTC
Message-ID
<096248bf-0a33-7360-e82b-b7a36e362604@web.de>
In-Reply-To
<CAGZ79kYL55+=9UbW7H-c7OUg6CHbnzdkxs0ZMsFnEAaoVXRwLw@mail.gmail.com>
Am 28.03.2018 um 23:37 schrieb Stefan Beller:
Show 10 quoted lines
>> This looks nicer here in the script, but doesn't test exactly what users
>> type most of the time, I suppose.
>>
>> So how about this?
> 
> Looks good to me, though I had a nagging feeling at first that the
> regex could be made more concise.
> Why do we need the optional "[^ ]" inside \1 ?
> 
>> +       sed -e "s/^ \([^ ]* repo\) .*/-\1/" <actual >expect &&

[:xdigit:] would match the hash more precisely, but I don't know how widely this character class is supported among sed implementations. And being so strict may require changes once SHA1 is replaced -- new hashes might be marked with a special character. And it's longer anyway.

\S could be used instead, but I also don't know how widely this is supported.

. could be used as well, of course, but that feels a bit sloppy to me.

Using separate s commands for beginning and end of the line would be shorter. This here is slightly longer, anyway:

	/ repo / {s/^ /-/; s/ (.*//}
What do you have in mind?  How to transform this:
 b2613938d15a18d9d4a504cacd9654fd1c879197 repo (heads/master)
... into this:
-b2613938d15a18d9d4a504cacd9654fd1c879197 repo
... while keeping other lines unchanged?
René
Previous: Stefan BellerNext: Junio C Hamano
Message 13 of 14 in “Re: Null pointer dereference in git-submodule”
  1. Jeremy FeusiMar 25, 2018
  2. René ScharfeMar 25, 2018
  3. Stefan BellerMar 27, 2018
  4. Junio C HamanoMar 28, 2018
  5. Stefan BellerMar 28, 2018
  6. submodule: check for NULL return of get_submodule_ref_store()Stefan Beller, Mar 28, 2018
  7. Eric SunshineMar 28, 2018
  8. Stefan BellerMar 28, 2018
  9. Eric SunshineMar 28, 2018
  10. Stefan BellerMar 28, 2018
  11. René ScharfeMar 28, 2018
  12. Stefan BellerMar 28, 2018
  13. René ScharfeMar 28, 2018
  14. Junio C HamanoMar 28, 2018

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.