Skip to content

Commit 2d649cc

Browse files
committed
remote: drop bitfields in git_remote_fetch_options
In attempting to make a clever change that added fetch options as flags, while keeping ABI and API compatibility, we screwed up. Bitfields in structs are implementation-specific and are not necessarily ABI compatible across compilers. Make `update_fetchhead` a flags value which is weirdly named, but that's a future problem. This removes the `report_unchanged` option from API.
1 parent e5e233c commit 2d649cc

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

include/git2/remote.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,7 @@ typedef struct {
746746
/**
747747
* How to handle reference updates; see `git_remote_update_flags`.
748748
*/
749-
unsigned int update_fetchhead : 1,
750-
report_unchanged : 1;
749+
unsigned int update_fetchhead;
751750

752751
/**
753752
* Determines how to behave regarding tags on the remote, such
@@ -790,8 +789,7 @@ typedef struct {
790789
GIT_FETCH_OPTIONS_VERSION, \
791790
GIT_REMOTE_CALLBACKS_INIT, \
792791
GIT_FETCH_PRUNE_UNSPECIFIED, \
793-
1, \
794-
0, \
792+
GIT_REMOTE_UPDATE_FETCHHEAD, \
795793
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, \
796794
GIT_PROXY_OPTIONS_INIT }
797795

src/libgit2/remote.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,12 +1376,7 @@ int git_remote_fetch(
13761376
return error;
13771377

13781378
if (opts) {
1379-
if (opts->update_fetchhead)
1380-
update_flags |= GIT_REMOTE_UPDATE_FETCHHEAD;
1381-
1382-
if (opts->report_unchanged)
1383-
update_flags |= GIT_REMOTE_UPDATE_REPORT_UNCHANGED;
1384-
1379+
update_flags = opts->update_fetchhead;
13851380
tagopt = opts->download_tags;
13861381
}
13871382

0 commit comments

Comments
 (0)