aboutsummaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-05-07 14:58:55 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-07 08:51:49 -0700
commite9965ba477de5df7546773920c581569bb54f315 (patch)
treebec4a69a4bbeb6ba070457f0fd0c8f3fb25bb344 /refs.c
parentrefs: support symrefs in 'reference-transaction' hook (diff)
downloadgit-e9965ba477de5df7546773920c581569bb54f315.tar.gz
git-e9965ba477de5df7546773920c581569bb54f315.zip
refs: move `original_update_refname` to 'refs.c'
The files backend and the reftable backend implement `original_update_refname` to obtain the original refname of the update. Move it out to 'refs.c' and only expose it internally to the refs library. This will be used in an upcoming commit to also introduce another common functionality for the two backends. We also rename the function to `ref_update_original_update_refname` to keep it consistent with the upcoming other 'ref_update_*' functions that'll be introduced. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index 9d722d798a..990703ed16 100644
--- a/refs.c
+++ b/refs.c
@@ -2814,3 +2814,11 @@ int copy_existing_ref(const char *oldref, const char *newref, const char *logmsg
{
return refs_copy_existing_ref(get_main_ref_store(the_repository), oldref, newref, logmsg);
}
+
+const char *ref_update_original_update_refname(struct ref_update *update)
+{
+ while (update->parent_update)
+ update = update->parent_update;
+
+ return update->refname;
+}