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

Re: [PATCH] revisions.c: put promisor option in specialized struct

From
Matthew DeVore <matvore@comcast.net>
Date
Dec 3, 2018, 22:01 UTC
Message-ID
<0809e859-b3a6-79ef-031c-9ff3326da31d@comcast.net>
In-Reply-To
<20181203212431.GB8700@sigill.intra.peff.net>
On 12/03/2018 01:24 PM, Jeff King wrote:
Show 15 quoted lines
>> @@ -297,7 +296,8 @@ struct setup_revision_opt {
>>   	const char *def;
>>   	void (*tweak)(struct rev_info *, struct setup_revision_opt *);
>>   	const char *submodule;	/* TODO: drop this and use rev_info->repo */
>> -	int assume_dashdash;
>> +	int assume_dashdash : 1;
>> +	int allow_exclude_promisor_objects : 1;
>>   	unsigned revarg_opt;
>>   };
> 
> I don't know that we need to penny-pinch bytes in this struct, but in
> general it shouldn't hurt either awy. However, a signed bit-field with 1
> bit is funny. I'm not even sure what the standard has to say, but in
> twos-complement that would store "-1" and "0" (gcc -Wpedantic also
> complains about overflow in assigning "1" to it).
Interesting. I hadn't suspected this. But I confirmed it with this:
#include <stdio.h>
struct x {
   int y : 1;
   int z : 1;
};
int main() {
   struct x x;
   x.y = 1;
   x.z = 1;
   printf("%d %d\n", (int) x.y, (int) x.z);
   return 0;
}

-- Output -- -1 -1

> 
> So this probably ought to be "unsigned".
Earlier in this file we define bit fields this way:
	/* Traversal flags */
	unsigned int	dense:1,
			prune:1,
... using \t to align the field names, so I'll mimic that style.
Previous: Jeff KingNext: Matthew DeVore
Message 16 of 19 in “[RFC 0/2] explicitly support or not support --exclude-promisor-objects”
  1. Matthew DeVoreOct 23, 2018
  2. 1/2 Documentation/git-log.txt: do not show --exclude-promisor-objectsMatthew DeVore, Oct 23, 2018
  3. 2/2 exclude-promisor-objects: declare when option is allowedMatthew DeVore, Oct 23, 2018
  4. Junio C HamanoOct 23, 2018
  5. Matthew DeVoreOct 23, 2018
  6. Junio C HamanoOct 24, 2018
  7. Jeff KingNov 21, 2018
  8. Matthew DeVoreDec 1, 2018
  9. Jeff KingDec 1, 2018
  10. Matthew DeVoreDec 3, 2018
  11. Jeff KingDec 3, 2018
  12. Matthew DeVoreDec 3, 2018
  13. Junio C HamanoDec 4, 2018
  14. revisions.c: put promisor option in specialized structMatthew DeVore, Dec 3, 2018
  15. Jeff KingDec 3, 2018
  16. Matthew DeVoreDec 3, 2018
  17. Matthew DeVoreOct 23, 2018
  18. Junio C HamanoOct 23, 2018
  19. Matthew DeVoreOct 23, 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.