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

Re: [PATCH v2] git-merge: ignore space support

From
Justin Frankel <justin@cockos.com>
Date
Aug 25, 2010, 18:21 UTC
Message-ID
<4C755F0E.5080705@cockos.com>
In-Reply-To
<7vy6bushjx.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 43 quoted lines
> Justin Frankel <justin@cockos.com> writes:
>
>   
>> The only danger is that ll_merge()'s signature didn't change in such a
>> way to break compilation, i.e:
>>
>> int ll_merge(mmbuffer_t *result_buf,
>>             const char *path,
>>             mmfile_t *ancestor, const char *ancestor_label,
>>             mmfile_t *ours, const char *our_label,
>>             mmfile_t *theirs, const char *their_label,
>>             int flag);
>>
>> becomes:
>>
>> int ll_merge(mmbuffer_t *result_buf,
>>             const char *path,
>>             mmfile_t *ancestor, const char *ancestor_label,
>>             mmfile_t *ours, const char *our_label,
>>             mmfile_t *theirs, const char *their_label,
>>             struct whatever *conf);
>>
>> In this case, passing 0 as the last parameter will compile either way.
>>
>> Sure, we can grep all of the source, but who knows when something else
>> will get merged in...
>>     
>
> That is technically a valid concern but I suspect it does not matter in
> this particular case, where integer 0 used to mean "use the default" and
> the new API uses NULL to mean the same.
>
> If an existing call site used to pass 0 and the patch forgot to update it,
> it will look ugly (we encourage to spell a NULL pointer "NULL", not "0",
> in our codebase) but no harm is done.  If an existing call site asked for
> a non-default behaviour by passing a non-zero integer flag, and the patch
> forgot to update it, the compiler would have caught it.  Merging a side
> branch is the same deal; if it adds a call with a non-zero argument to ask
> for a non-default behaviour, that will be done via an expression over some
> integer variables or constants, and that won't be casted silently to a
> pointer to "struct whatever", no?
>
>   

Agreed, I was responding to Bert's email, in which he stated that he hadn't seen NULL-for-default anywhere else in git. Using NULL for default behavior is good in that it handles un-updated code and merges correctly (passing 0 uses defaults, passing nonzero fails compile).

Show 5 quoted lines
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 23 in “git-merge: ignore space support”
  1. git-merge: ignore space supportJustin Frankel, Aug 23, 2010
  2. Jonathan NiederAug 24, 2010
  3. merge-recursive: expose merge options for builtin mergeJonathan Nieder, Aug 24, 2010
  4. Junio C HamanoAug 24, 2010
  5. Jonathan NiederAug 25, 2010
  6. Justin FrankelAug 24, 2010
  7. Jonathan NiederAug 25, 2010
  8. Bert WesargAug 25, 2010
  9. Justin FrankelAug 25, 2010
  10. Junio C HamanoAug 25, 2010
  11. Justin FrankelAug 25, 2010
  12. Junio C HamanoAug 24, 2010
  13. Bert WesargAug 24, 2010
  14. Jonathan NiederAug 25, 2010
  15. 0/4 git-merge: ignore space supportJonathan Nieder, Aug 26, 2010
  16. 1/4 merge-recursive: expose merge options for builtin mergeJonathan Nieder, Aug 26, 2010
  17. 2/4 ll-merge: replace flag argument with options structJonathan Nieder, Aug 26, 2010
  18. Junio C HamanoAug 26, 2010
  19. ll-merge: simplify opts == NULL caseJonathan Nieder, Jan 16, 2011
  20. 3/4 merge-recursive --patienceJonathan Nieder, Aug 26, 2010
  21. 4/4 merge-recursive: options to ignore whitespace changesJonathan Nieder, Aug 26, 2010
  22. Junio C HamanoAug 26, 2010
  23. Jonathan NiederAug 27, 2010

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.