commit - 87332a0e6e71182f1fb148d7f42e78105713285b
commit + a003d5184726e721ca5313a722fc1a22d602e8b8
blob - 87ce79c90db5ebd79d068d2738dfb439ab4da56a
blob + 50fb5ec76cf7c16aa5ecf3017aa935c3f4c6cffa
--- got/got.c
+++ got/got.c
return NULL;
}
-static const struct got_error *
-get_signer_id(char **signer_id, struct got_repository *repo,
- struct got_worktree *worktree)
+static const char *
+get_signer_id(struct got_repository *repo, struct got_worktree *worktree)
{
const char *got_signer_id = NULL;
const struct got_gotconfig *worktree_conf = NULL, *repo_conf = NULL;
- *signer_id = NULL;
-
if (worktree)
worktree_conf = got_worktree_get_gotconfig(worktree);
repo_conf = got_repo_get_gotconfig(repo);
if (got_signer_id == NULL)
got_signer_id = got_gotconfig_get_signer_id(repo_conf);
- if (got_signer_id) {
- *signer_id = strdup(got_signer_id);
- if (*signer_id == NULL)
- return got_error_from_errno("strdup");
- }
- return NULL;
+ return got_signer_id;
}
static const struct got_error *
char *cwd = NULL, *repo_path = NULL, *commit_id_str = NULL;
char *gitconfig_path = NULL, *tagger = NULL;
char *allowed_signers = NULL, *revoked_signers = NULL;
- char *signer_id = NULL;
+ const char *signer_id = NULL;
const char *tag_name = NULL, *commit_id_arg = NULL, *tagmsg = NULL;
int ch, do_list = 0, verify_tags = 0, verbosity = 0;
int *pack_fds = NULL;
got_path_strip_trailing_slashes(repo_path);
break;
case 's':
- signer_id = strdup(optarg);
- if (signer_id == NULL) {
- error = got_error_from_errno("strdup");
- goto done;
- }
+ signer_id = optarg;
break;
case 'V':
verify_tags = 1;
error = get_author(&tagger, repo, worktree);
if (error)
goto done;
- if (signer_id == NULL) {
- error = get_signer_id(&signer_id, repo, worktree);
- if (error)
- goto done;
- }
+ if (signer_id == NULL)
+ signer_id = get_signer_id(repo, worktree);
if (tagmsg) {
if (signer_id) {
free(tagger);
free(allowed_signers);
free(revoked_signers);
- free(signer_id);
return error;
}