summaryrefslogtreecommitdiff
path: root/examples/fetch.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-05-10 22:50:16 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-05-11 13:30:08 +0100
commit0e7ab1c4968629b8d42c193eebda48ef146d8e77 (patch)
treeff246ac9ddc5bef47d25a9d5b5da2e9402f02d64 /examples/fetch.c
parent2bbcdee6b666f34e83d1cf9ca9badc66258202d6 (diff)
downloadlibgit2-ethomson/update_tips_spec.tar.gz
remote: add git_refspec to update_tipsethomson/update_tips_spec
Diffstat (limited to 'examples/fetch.c')
-rw-r--r--examples/fetch.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/fetch.c b/examples/fetch.c
index bbd882cfb..a7248edb6 100644
--- a/examples/fetch.c
+++ b/examples/fetch.c
@@ -13,20 +13,24 @@ static int progress_cb(const char *str, int len, void *data)
* updated. The message we output depends on whether it's a new one or
* an update.
*/
-static int update_cb(const char *refname, const git_oid *a, const git_oid *b, void *data)
+static int update_cb(const char *refname, const git_oid *a, const git_oid *b, git_refspec *spec, void *data)
{
char a_str[GIT_OID_SHA1_HEXSIZE+1], b_str[GIT_OID_SHA1_HEXSIZE+1];
+ git_buf remote_name;
(void)data;
+ if (git_refspec_rtransform(&remote_name, spec, refname) < 0)
+ return -1;
+
git_oid_fmt(b_str, b);
b_str[GIT_OID_SHA1_HEXSIZE] = '\0';
if (git_oid_is_zero(a)) {
- printf("[new] %.20s %s\n", b_str, refname);
+ printf("[new] %.20s %s -> %s\n", b_str, remote_name.ptr, refname);
} else {
git_oid_fmt(a_str, a);
a_str[GIT_OID_SHA1_HEXSIZE] = '\0';
- printf("[updated] %.10s..%.10s %s\n", a_str, b_str, refname);
+ printf("[updated] %.10s..%.10s %s -> %s\n", a_str, b_str, remote_name.ptr, refname);
}
return 0;