summaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-26 22:14:45 +0200
committerJunio C Hamano <gitster@pobox.com>2016-10-26 22:14:45 +0200
commita03973893bdbc1a53c705daf70a73994ac46492f (patch)
tree3758c6cc01531475917705c32eb7bf93c4d04d9f /refs.c
parentMerge branch 'mm/credential-libsecret' (diff)
parentcocci: refactor common patterns to use xstrdup_or_null() (diff)
downloadgit-a03973893bdbc1a53c705daf70a73994ac46492f.tar.xz
git-a03973893bdbc1a53c705daf70a73994ac46492f.zip
Merge branch 'jc/cocci-xstrdup-or-null'
Code cleanup. * jc/cocci-xstrdup-or-null: cocci: refactor common patterns to use xstrdup_or_null()
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index abc721b607..9bd0bc177b 100644
--- a/refs.c
+++ b/refs.c
@@ -816,8 +816,7 @@ struct ref_update *ref_transaction_add_update(
hashcpy(update->new_sha1, new_sha1);
if (flags & REF_HAVE_OLD)
hashcpy(update->old_sha1, old_sha1);
- if (msg)
- update->msg = xstrdup(msg);
+ update->msg = xstrdup_or_null(msg);
return update;
}