Skip to content

Commit

Permalink
Merge branch 'jk/misc-null-check-fixes' into next
Browse files Browse the repository at this point in the history
Code clean-up.

* jk/misc-null-check-fixes:
  fetch_bundle_uri(): drop pointless NULL check
  notes: clean up confusing NULL checks in init_notes()
  • Loading branch information
gitster committed Apr 26, 2023
2 parents 96c395b + 0b1a95e commit 9500384
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bundle-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,10 @@ int fetch_bundle_uri(struct repository *r, const char *uri,
init_bundle_list(&list);

/*
* Do not fetch a NULL or empty bundle URI. An empty bundle URI
* Do not fetch an empty bundle URI. An empty bundle URI
* could signal that a configured bundle URI has been disabled.
*/
if (!uri || !*uri) {
if (!*uri) {
result = 0;
goto cleanup;
}
Expand Down
4 changes: 2 additions & 2 deletions notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,13 +1020,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 ||
if (flags & NOTES_INIT_EMPTY ||
repo_get_oid_treeish(the_repository, notes_ref, &object_oid))
return;
if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))
Expand Down

0 comments on commit 9500384

Please sign in to comment.