MCPcopy Index your code
hub / github.com/git/git / handle_new_lock_ctx

Function handle_new_lock_ctx

http-push.c:763–787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed)
764{
765 struct remote_lock *lock = (struct remote_lock *)ctx->userData;
766 struct git_hash_ctx hash_ctx;
767 unsigned char lock_token_hash[GIT_MAX_RAWSZ];
768
769 if (tag_closed && ctx->cdata) {
770 if (!strcmp(ctx->name, DAV_ACTIVELOCK_OWNER)) {
771 lock->owner = xstrdup(ctx->cdata);
772 } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TIMEOUT)) {
773 const char *arg;
774 if (skip_prefix(ctx->cdata, "Second-", &arg))
775 lock->timeout = strtol(arg, NULL, 10);
776 } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) {
777 lock->token = xstrdup(ctx->cdata);
778
779 the_hash_algo->init_fn(&hash_ctx);
780 git_hash_update(&hash_ctx, lock->token, strlen(lock->token));
781 git_hash_final(lock_token_hash, &hash_ctx);
782
783 lock->tmpfile_suffix[0] = '_';
784 memcpy(lock->tmpfile_suffix + 1, hash_to_hex(lock_token_hash), the_hash_algo->hexsz);
785 }
786 }
787}
788
789static void one_remote_ref(const char *refname);
790

Callers

nothing calls this directly

Calls 4

xstrdupFunction · 0.85
git_hash_updateFunction · 0.85
git_hash_finalFunction · 0.85
hash_to_hexFunction · 0.85

Tested by

no test coverage detected