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

Re: Git 2 force commits but Git 1 doesn't

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 23, 2020, 19:13 UTC
Message-ID
<20200623191339.GT6531@camp.crustytoothpaste.net>
In-Reply-To
<83e99359-2c24-d8cd-bd4a-6ba90ed54b7f@web.de>
On 2020-06-23 at 16:42:48, René Scharfe wrote:
Show 5 quoted lines
> We could save 4 bytes on x64 by reducing FLAG_BITS from 29 to 28, by the
> way.  Increasing it to 32 would be free.  That's because parsed (1),
> type (3) and flags (29) currently occupy 33 bits, which are padded to 8
> bytes.  And bits 22-24 are only used by builtin/show-branch.c, so it
> should be easy to tighten the flags range just a bit.  Weird.

Actually, as you've just shown, we're already using 8 bytes, so increasing FLAG_BITS to 60 wouldn't actually allocate any additional memory. Unfortunately, C11 says that a "bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type," so using uint64_t here wouldn't be portable. So in that case we may want to shrink it to be just 4 bytes.

Show 42 quoted lines
> > Assuming we don't want to do that right now, may I have your sign-off
> > for the following code, René, so I can add it to a patch along with my
> > test?
> >
> >> diff --git a/http-push.c b/http-push.c
> >> index 822f326599..99adbebdcf 100644
> >> --- a/http-push.c
> >> +++ b/http-push.c
> >> @@ -70,10 +70,10 @@ enum XML_Status {
> >>  #define LOCK_REFRESH 30
> >>
> >>  /* Remember to update object flag allocation in object.h */
> >> -#define LOCAL    (1u<<16)
> >> -#define REMOTE   (1u<<17)
> >> -#define FETCHING (1u<<18)
> >> -#define PUSHING  (1u<<19)
> >> +#define LOCAL    (1u<<11)
> >> +#define REMOTE   (1u<<12)
> >> +#define FETCHING (1u<<13)
> >> +#define PUSHING  (1u<<14)
> >>
> >>  /* We allow "recursive" symbolic refs. Only within reason, though */
> >>  #define MAXDEPTH 5
> >> diff --git a/object.h b/object.h
> >> index b22328b838..a496d2e4e1 100644
> >> --- a/object.h
> >> +++ b/object.h
> >> @@ -67,7 +67,7 @@ struct object_array {
> >>   * builtin/blame.c:                        12-13
> >>   * bisect.c:                                        16
> >>   * bundle.c:                                        16
> >> - * http-push.c:                                     16-----19
> >> + * http-push.c:                          11-----14
> >>   * commit-graph.c:                                15
> >>   * commit-reach.c:                                  16-----19
> >>   * sha1-name.c:                                              20
> >>
> 
> You're welcome to use it.  Not sure if a sign-off is necessary, but
> here you have it:
> 
> Signed-off-by: René Scharfe <l.s.r@web.de>

Thanks. You did the work here and I'd much prefer to add your sign-off to give you credit for that.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: René ScharfeNext: René Scharfe
Message 13 of 19 in “Git 2 force commits but Git 1 doesn't”
  1. Michael WardJun 22, 2020
  2. brian m. carlsonJun 22, 2020
  3. Michael WardJun 22, 2020
  4. Michael WardJun 22, 2020
  5. brian m. carlsonJun 22, 2020
  6. Michael WardJun 22, 2020
  7. brian m. carlsonJun 22, 2020
  8. Michael WardJun 22, 2020
  9. brian m. carlsonJun 23, 2020
  10. René ScharfeJun 23, 2020
  11. brian m. carlsonJun 23, 2020
  12. René ScharfeJun 23, 2020
  13. brian m. carlsonJun 23, 2020
  14. René ScharfeJun 24, 2020
  15. http-push: ensure unforced pushes fail when data would be lostbrian m. carlson, Jun 23, 2020
  16. Eric SunshineJun 23, 2020
  17. brian m. carlsonJun 23, 2020
  18. http-push: ensure unforced pushes fail when data would be lostbrian m. carlson, Jun 23, 2020
  19. Junio C HamanoJun 23, 2020

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.