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

Re: [PATCH v5 2/3] Refactor submodule push check to use string list instead of integer

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Mar 26, 2012, 19:55 UTC
Message-ID
<20120326195535.GA41511@book.hvoigt.net>
In-Reply-To
<20120326193317.GB41087@book.hvoigt.net>
On Mon, Mar 26, 2012 at 09:33:17PM +0200, Heiko Voigt wrote:
Show 16 quoted lines
> On Mon, Feb 13, 2012 at 07:28:24PM -0800, Junio C Hamano wrote:
> > Heiko Voigt <hvoigt@hvoigt.net> writes:
> > > -			*needs_pushing = 1;
> > > -			break;
> > > +			if (!string_list_has_string(needs_pushing, p->two->path))
> > > +				string_list_insert(needs_pushing, p->two->path);
> > 
> > Does string_list API have "look for this and insert if it doesn't exist
> > but otherwise don't do anything"?  Running get_entry_index() to answer
> > has_string() once and then calling it again to find where to insert to
> > respond to insert() looks a bit wasteful.
> > 
> > Just wondering.
> 
> If I see correctly currently it has no such functionality. I can have a
> look at adding another patch implementing this.

It seems my guess was wrong. As far as I read in the code string_list_insert() already skips inserting existing strings and just returns the existing items in the list. So it should be fine to remove the string_list_has_string() call.

Cheers Heiko
Previous: Heiko VoigtNext: Junio C Hamano
Message 9 of 17 in “push: submodule support”
  1. 0/3 push: submodule supportHeiko Voigt, Feb 13, 2012
  2. 1/3 Teach revision walking machinery to walk multiple times sequenciallyHeiko Voigt, Feb 13, 2012
  3. Junio C HamanoFeb 14, 2012
  4. Heiko VoigtMar 26, 2012
  5. Junio C HamanoMar 26, 2012
  6. 2/3 Refactor submodule push check to use string list instead of integerHeiko Voigt, Feb 13, 2012
  7. Junio C HamanoFeb 14, 2012
  8. Heiko VoigtMar 26, 2012
  9. Heiko VoigtMar 26, 2012
  10. Junio C HamanoMar 26, 2012
  11. 3/3 push: teach --recurse-submodules the on-demand optionHeiko Voigt, Feb 13, 2012
  12. Junio C HamanoFeb 14, 2012
  13. Jens LehmannFeb 15, 2012
  14. Heiko VoigtMar 26, 2012
  15. read from 2 filedescriptors simultaneously into one strbufHeiko Voigt, May 13, 2012
  16. Zbigniew Jędrzejewski-SzmekMar 26, 2012
  17. Heiko VoigtMar 28, 2012

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.