[PATCH v2 13/16] refs: remove `dwim_log()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 builtin/reflog.c | 2 +-
 reflog-walk.c    | 4 ++--
 reflog.c         | 2 +-
 refs.c           | 5 -----
 refs.h           | 1 -
 5 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/builtin/reflog.c b/builtin/reflog.c
index b4650cea16..0d2ff95c6e 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -378,7 +378,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
 		char *ref;
 		struct expire_reflog_policy_cb cb = { .cmd = cmd };
 
-		if (!dwim_log(argv[i], strlen(argv[i]), NULL, &ref)) {
+		if (!repo_dwim_log(the_repository, argv[i], strlen(argv[i]), NULL, &ref)) {
 			status |= error(_("%s points nowhere!"), argv[i]);
 			continue;
 		}
diff --git a/reflog-walk.c b/reflog-walk.c
index f11b97e889..5f09552c5c 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -191,8 +191,8 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
 		reflogs = read_complete_reflog(branch);
 		if (!reflogs || reflogs->nr == 0) {
 			char *b;
-			int ret = dwim_log(branch, strlen(branch),
-					   NULL, &b);
+			int ret = repo_dwim_log(the_repository, branch, strlen(branch),
+						NULL, &b);
 			if (ret > 1)
 				free(b);
 			else if (ret == 1) {
diff --git a/reflog.c b/reflog.c
index 8861c2d606..3c80950186 100644
--- a/reflog.c
+++ b/reflog.c
@@ -409,7 +409,7 @@ int reflog_delete(const char *rev, enum expire_reflog_flags flags, int verbose)
 	if (!spec)
 		return error(_("not a reflog: %s"), rev);
 
-	if (!dwim_log(rev, spec - rev, NULL, &ref)) {
+	if (!repo_dwim_log(the_repository, rev, spec - rev, NULL, &ref)) {
 		status |= error(_("no reflog for '%s'"), rev);
 		goto cleanup;
 	}
diff --git a/refs.c b/refs.c
index 83cd965a26..43c5fef734 100644
--- a/refs.c
+++ b/refs.c
@@ -775,11 +775,6 @@ int repo_dwim_log(struct repository *r, const char *str, int len,
 	return logs_found;
 }
 
-int dwim_log(const char *str, int len, struct object_id *oid, char **log)
-{
-	return repo_dwim_log(the_repository, str, len, oid, log);
-}
-
 int is_per_worktree_ref(const char *refname)
 {
 	return starts_with(refname, "refs/worktree/") ||
diff --git a/refs.h b/refs.h
index e906dbb44a..82022d300c 100644
--- a/refs.h
+++ b/refs.h
@@ -164,7 +164,6 @@ int expand_ref(struct repository *r, const char *str, int len, struct object_id
 int repo_dwim_ref(struct repository *r, const char *str, int len,
 		  struct object_id *oid, char **ref, int nonfatal_dangling_mark);
 int repo_dwim_log(struct repository *r, const char *str, int len, struct object_id *oid, char **ref);
-int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
 
 /*
  * Retrieves the default branch name for newly-initialized repositories.
-- 
2.45.1.190.g19fe900cfc.dirty

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux