From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] git: remove redundant notes_ref check
Date: Sun, 18 Dec 2022 21:41:39 +0000 [thread overview]
Message-ID: <pull.1400.git.git.1671399699603.gitgitgadget@gmail.com> (raw)
From: Seija Kijin <doremylover123@gmail.com>
Earlier in the init_notes function, notes_ref is guaranteed
to be the default ref if it is NULL by then,
making future checks for notes_ref to be redundant,
and xstrdup_or_null can just be xstrdup.
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
git: remove redundant notes_ref check
Earlier in the init_notes function, notes_ref is guaranteed to be the
default ref if it is NULL by then, making future checks for notes_ref to
be redundant, and xstrdup_or_null can just be xstrdup.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1400%2FAtariDreams%2Fxstrdup-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1400/AtariDreams/xstrdup-v1
Pull-Request: https://github.com/git/git/pull/1400
notes.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/notes.c b/notes.c
index f2805d51bb1..a2283b9ace4 100644
--- a/notes.c
+++ b/notes.c
@@ -1014,14 +1014,13 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
t->first_non_note = NULL;
t->prev_non_note = NULL;
- t->ref = xstrdup_or_null(notes_ref);
+ t->ref = xstrdup(notes_ref);
t->update_ref = (flags & NOTES_INIT_WRITABLE) ? t->ref : NULL;
t->combine_notes = combine_notes;
t->initialized = 1;
t->dirty = 0;
- if (flags & NOTES_INIT_EMPTY || !notes_ref ||
- get_oid_treeish(notes_ref, &object_oid))
+ if (flags & NOTES_INIT_EMPTY || get_oid_treeish(notes_ref, &object_oid))
return;
if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))
die("Cannot use notes ref %s", notes_ref);
base-commit: 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8
--
gitgitgadget
reply other threads:[~2022-12-18 21:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1400.git.git.1671399699603.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=83477269+AtariDreams@users.noreply.github.com \
--cc=doremylover123@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.