-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
Reproduction steps
- Set up a global config setting
core.abbrevto a string value:git config --global core.abbrev no - Run a program that uses
git_object_short_id.
#include <assert.h>
#include <git2/repository.h>
#include <git2/errors.h>
#include <git2/revparse.h>
#include <git2/oid.h>
#include <git2/global.h>
#include <stdio.h>
#include <unistd.h>
int main() {
git_repository *repo;
assert(git_libgit2_init() == 1);
assert(git_repository_open(&repo, "..") == 0);
git_object *obj;
assert(git_revparse_single(&obj, repo, "HEAD") == 0);
git_buf buf = {0};
int rc;
rc = git_object_short_id(&buf, obj);
if (rc == 0) {
fprintf(stderr, "short: %s", buf.ptr);
} else {
git_error const *err;
err = git_error_last();
fprintf(stderr, "error: class=%i: %s", err->klass, err->message);
}
return 0;
}Note that the config value can take the values:
- false, no, off — added in git 2.11.1 (ref git/git@48d5014)
- auto — added in git 2.31 (ref git/git@a9ecaa0)
Expected behavior
Should be able to handle string values.
Actual behavior
Fails with:
error: class=7: failed to map 'no'
Version of libgit2 (release number or SHA1)
Operating system(s) tested
any