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

Re: [RFC/PATCH] fetch: bigger forced-update warnings

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2011, 21:53 UTC
Message-ID
<7vty8o10kj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110907212042.GG13364@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> Subject: fetch: bigger forced-update warnings
>
> The default fetch refspec allows forced-updates. We already
> print "forced update" in the status table, but it's easy to
> miss. Let's make the warning a little more prominent.
>
> Some branches are expected to rewind, so the prominent
> warning would be annoying. However, git doesn't know what
> the expectation is for a particular branch. We can have it
> guess by peeking at the lost couple of reflog entries. If we
s/lost/last/
Show 7 quoted lines
> see all fast forwards, then a new forced-update is probably
> noteworthy. If we see something that force-updates all the
> time, it's probably boring and not worth displaying the big
> warning (we keep the status table "forced update" note, of
> course).
>
> Signed-off-by: Jeff King <peff@peff.net>

This is slightly offtopic, but I have been wondering if this approach do the right thing for "git pull". Wouldn't the underlying "git fetch" give a warning, and then the calling "git pull" go ahead and make a merge, scrolling the warning away with the merge/update summary diffstat? That would be a larger change if "git pull" needs to stash away the warning message, do its thing and then spit out the warning later.

Show 8 quoted lines
> +static int forced_update_is_uncommon(const char *ref)
> +{
> +	struct update_counts uc;
> +	memset(&uc, 0, sizeof(&uc));
> +	if (for_each_recent_reflog_ent(ref, count_updates, 4096, &uc) < 0)
> +		for_each_reflog_ent(ref, count_updates, &uc);
> +	return uc.fastforward && uc.forced <= 1; /* 1 for the one we just did */
> +}
Looks sensible.
Previous: Shawn PearceNext: Jeff King
Message 23 of 27 in “Dropping '+' from fetch = +refs/heads/*:refs/remotes/origin/*?”
  1. Junio C HamanoSep 1, 2011
  2. Junio C HamanoSep 1, 2011
  3. Shawn PearceSep 1, 2011
  4. Michael J GruberSep 1, 2011
  5. Matthieu MoySep 1, 2011
  6. Shawn PearceSep 1, 2011
  7. Matthieu MoySep 2, 2011
  8. Jeff KingSep 2, 2011
  9. Johannes SixtSep 2, 2011
  10. Jeff KingSep 2, 2011
  11. Michael J GruberSep 2, 2011
  12. Jeff KingSep 2, 2011
  13. Junio C HamanoSep 2, 2011
  14. Jeff KingSep 2, 2011
  15. Junio C HamanoSep 2, 2011
  16. Shawn PearceSep 5, 2011
  17. Jeff KingSep 5, 2011
  18. Shawn PearceSep 5, 2011
  19. Jeff KingSep 5, 2011
  20. Shawn PearceSep 5, 2011
  21. fetch: bigger forced-update warningsJeff King, Sep 7, 2011
  22. Shawn PearceSep 7, 2011
  23. Junio C HamanoSep 7, 2011
  24. Jeff KingSep 7, 2011
  25. Thomas RastSep 7, 2011
  26. Matthieu MoySep 6, 2011
  27. Michael J GruberSep 6, 2011

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.