Skip to content

Commit 2bb444b

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 97abaab commit 2bb444b

File tree

5 files changed

+4
-10
lines changed

5 files changed

+4
-10
lines changed

builtin/reflog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
378378
char *ref;
379379
struct expire_reflog_policy_cb cb = { .cmd = cmd };
380380

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)) {
382382
status |= error(_("%s points nowhere!"), argv[i]);
383383
continue;
384384
}

reflog-walk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
191191
reflogs = read_complete_reflog(branch);
192192
if (!reflogs || reflogs->nr == 0) {
193193
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);
196196
if (ret > 1)
197197
free(b);
198198
else if (ret == 1) {

reflog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ int reflog_delete(const char *rev, enum expire_reflog_flags flags, int verbose)
409409
if (!spec)
410410
return error(_("not a reflog: %s"), rev);
411411

412-
if (!dwim_log(rev, spec - rev, NULL, &ref)) {
412+
if (!repo_dwim_log(the_repository, rev, spec - rev, NULL, &ref)) {
413413
status |= error(_("no reflog for '%s'"), rev);
414414
goto cleanup;
415415
}

refs.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,6 @@ int repo_dwim_log(struct repository *r, const char *str, int len,
775775
return logs_found;
776776
}
777777

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-
783778
int is_per_worktree_ref(const char *refname)
784779
{
785780
return starts_with(refname, "refs/worktree/") ||

refs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id
164164
int repo_dwim_ref(struct repository *r, const char *str, int len,
165165
struct object_id *oid, char **ref, int nonfatal_dangling_mark);
166166
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);
168167

169168
/*
170169
* Retrieves the default branch name for newly-initialized repositories.

0 commit comments

Comments
 (0)