refs: remove `dwim_log()`
Remove `dwim_log()` in favor of `repo_dwim_log()` so that we can get rid of one more dependency on `the_repository`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
May 17, 2024 at 10:19 UTC
2bb444b19669efaa3c50621b54e8bcd98ea5442d
5 files changed
+4
-10
builtin/reflog.c
+1
-1
@@ -378,7 +378,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
378
char *ref;
379
struct expire_reflog_policy_cb cb = { .cmd = cmd };
380
381
- if (!dwim_log(argv[i], strlen(argv[i]), NULL, &ref)) {
381
+ if (!repo_dwim_log(the_repository, argv[i], strlen(argv[i]), NULL, &ref)) {
382
status |= error(_("%s points nowhere!"), argv[i]);
383
continue;
384
}
reflog-walk.c
+2
-2
@@ -191,8 +191,8 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
191
reflogs = read_complete_reflog(branch);
192
if (!reflogs || reflogs->nr == 0) {
193
char *b;
194
- int ret = dwim_log(branch, strlen(branch),
195
- NULL, &b);
194
+ int ret = repo_dwim_log(the_repository, branch, strlen(branch),
195
+ NULL, &b);
196
if (ret > 1)
197
free(b);
198
else if (ret == 1) {
reflog.c
+1
-1
@@ -409,7 +409,7 @@ int reflog_delete(const char *rev, enum expire_reflog_flags flags, int verbose)
409
if (!spec)
410
return error(_("not a reflog: %s"), rev);
411
412
- if (!dwim_log(rev, spec - rev, NULL, &ref)) {
412
+ if (!repo_dwim_log(the_repository, rev, spec - rev, NULL, &ref)) {
413
status |= error(_("no reflog for '%s'"), rev);
414
goto cleanup;
415
}
refs.c
-5
@@ -775,11 +775,6 @@ int repo_dwim_log(struct repository *r, const char *str, int len,
775
return logs_found;
776
}
777
778
-int dwim_log(const char *str, int len, struct object_id *oid, char **log)
779
-{
780
- return repo_dwim_log(the_repository, str, len, oid, log);
781
-}
782
-
778
int is_per_worktree_ref(const char *refname)
779
{
780
return starts_with(refname, "refs/worktree/") ||
refs.h
-1
@@ -164,7 +164,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id
164
int repo_dwim_ref(struct repository *r, const char *str, int len,
165
struct object_id *oid, char **ref, int nonfatal_dangling_mark);
166
int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
167
-int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
167
168
/*
169
* Retrieves the default branch name for newly-initialized repositories.