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

Re: [PATCH 1/6] remote.c: drop default_remote_name variable

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 31, 2015, 20:37 UTC
Message-ID
<xmqqzj6sq4xc.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150331173437.GA18912@peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> When we read the remote config from disk, we update a
> default_remote_name variable if we see branch.*.remote
> config for the current branch. This isn't wrong, or even all
> that complicated, but it is a bit simpler (because it
> reduces our overall state) to just lazily compute the
> default when we need it.
>
> The ulterior motive here is that the push config uses a
> similar structure, and _is_ much more complicated as a
> result. That will be simplified in a future patch, and it's
> more readable if the logic remotes and push-remotes matches.

I cannot quite parse the part after "if..."; "the logic used by remotes and push-remotes matches"?

Show 19 quoted lines
> Note that we also used default_remote_name as a signal that
> the remote config has been loaded; after this patch, we now
> use an explicit flag.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  remote.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 68901b0..fcd868d 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -39,6 +39,8 @@ struct rewrites {
>  	int rewrite_nr;
>  };
>  
> +static int loaded_remotes_config;
> +

I expect that the reason why this is not a function scope static in read_config() will be revealed in the later patch in this series...

Previous: Jeff KingNext: Jeff King
Message 3 of 18 in “implement @{push} shorthand”
  1. 0/6 implement @{push} shorthandJeff King, Mar 31, 2015
  2. 1/6 remote.c: drop default_remote_name variableJeff King, Mar 31, 2015
  3. Junio C HamanoMar 31, 2015
  4. Jeff KingMar 31, 2015
  5. 2/6 remote.c: drop "remote" pointer from "struct branch"Jeff King, Mar 31, 2015
  6. Junio C HamanoMar 31, 2015
  7. Jeff KingMar 31, 2015
  8. Junio C HamanoMar 31, 2015
  9. 3/6 remote.c: hoist branch.*.remote lookup out of remote_get_1Jeff King, Mar 31, 2015
  10. 4/6 remote.c: provide per-branch pushremote nameJeff King, Mar 31, 2015
  11. Junio C HamanoMar 31, 2015
  12. 5/6 sha1_name: refactor upstream_markJeff King, Mar 31, 2015
  13. 6/6 sha1_name: implement @{push} shorthandJeff King, Mar 31, 2015
  14. Junio C HamanoMar 31, 2015
  15. Jeff KingMar 31, 2015
  16. Junio C HamanoMar 31, 2015
  17. Eric SunshineMar 31, 2015
  18. Jeff KingMar 31, 2015

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.