diff --git a/include/git2/remote.h b/include/git2/remote.h index 7ad820ad3c3..7067c88b0b1 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -744,10 +744,10 @@ typedef struct { git_fetch_prune_t prune; /** - * How to handle reference updates; a combination of - * `git_remote_update_flags`. + * How to handle reference updates; see `git_remote_update_flags`. */ - unsigned int update_flags; + unsigned int update_fetchhead : 1, + report_unchanged : 1; /** * Determines how to behave regarding tags on the remote, such @@ -790,7 +790,8 @@ typedef struct { GIT_FETCH_OPTIONS_VERSION, \ GIT_REMOTE_CALLBACKS_INIT, \ GIT_FETCH_PRUNE_UNSPECIFIED, \ - GIT_REMOTE_UPDATE_FETCHHEAD, \ + 1, \ + 0, \ GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, \ GIT_PROXY_OPTIONS_INIT } diff --git a/include/git2/repository.h b/include/git2/repository.h index 9ad6176f940..0afda72d402 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -499,12 +499,12 @@ typedef enum { GIT_REPOSITORY_ITEM_PACKED_REFS, GIT_REPOSITORY_ITEM_REMOTES, GIT_REPOSITORY_ITEM_CONFIG, - GIT_REPOSITORY_ITEM_WORKTREE_CONFIG, GIT_REPOSITORY_ITEM_INFO, GIT_REPOSITORY_ITEM_HOOKS, GIT_REPOSITORY_ITEM_LOGS, GIT_REPOSITORY_ITEM_MODULES, GIT_REPOSITORY_ITEM_WORKTREES, + GIT_REPOSITORY_ITEM_WORKTREE_CONFIG, GIT_REPOSITORY_ITEM__LAST } git_repository_item_t; diff --git a/src/libgit2/clone.c b/src/libgit2/clone.c index db9a898e34e..d62c77ac554 100644 --- a/src/libgit2/clone.c +++ b/src/libgit2/clone.c @@ -431,7 +431,7 @@ static int clone_into( return error; memcpy(&fetch_opts, opts, sizeof(git_fetch_options)); - fetch_opts.update_flags = ~GIT_REMOTE_UPDATE_FETCHHEAD; + fetch_opts.update_fetchhead = 0; if (!opts->depth) fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL; diff --git a/src/libgit2/remote.c b/src/libgit2/remote.c index 9eb4bac8b2f..8b07c83184a 100644 --- a/src/libgit2/remote.c +++ b/src/libgit2/remote.c @@ -1376,7 +1376,12 @@ int git_remote_fetch( return error; if (opts) { - update_flags = opts->update_flags; + if (opts->update_fetchhead) + update_flags |= GIT_REMOTE_UPDATE_FETCHHEAD; + + if (opts->report_unchanged) + update_flags |= GIT_REMOTE_UPDATE_REPORT_UNCHANGED; + tagopt = opts->download_tags; } diff --git a/src/libgit2/repository.c b/src/libgit2/repository.c index 06c653ea921..8e449a6df09 100644 --- a/src/libgit2/repository.c +++ b/src/libgit2/repository.c @@ -58,12 +58,12 @@ static const struct { { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "packed-refs", false }, { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "remotes", true }, { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "config", false }, - { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM_GITDIR, "config.worktree", false }, { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "info", true }, { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true }, { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true }, { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true }, - { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true } + { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }, + { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM_GITDIR, "config.worktree", false } }; static int check_repositoryformatversion(int *version, git_config *config);