summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-06-17 02:26:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-06-17 02:26:20 (GMT)
commit4c634a4a8ffae654c3cc4e403aa31e7d660d7e6d (patch)
tree419db10081179146994daeb34e3419d1ebe15943
parent4fa787b56bb52cadcb5c3cf30cbefa160ec208f5 (diff)
parent1d72b604ef638155f7af91c968ccf1c95234ecee (diff)
downloadgit-4c634a4a8ffae654c3cc4e403aa31e7d660d7e6d.zip
git-4c634a4a8ffae654c3cc4e403aa31e7d660d7e6d.tar.gz
git-4c634a4a8ffae654c3cc4e403aa31e7d660d7e6d.tar.bz2
Merge branch 'jk/revision-squelch-gcc-warning' into jch
Warning fix. * jk/revision-squelch-gcc-warning: add_pending_object_with_path(): work around "gcc -O3" complaint
-rw-r--r--revision.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 8140561..cddd054 100644
--- a/revision.c
+++ b/revision.c
@@ -316,9 +316,10 @@ static void add_pending_object_with_path(struct rev_info *revs,
revs->no_walk = 0;
if (revs->reflog_info && obj->type == OBJ_COMMIT) {
struct strbuf buf = STRBUF_INIT;
- int len = interpret_branch_name(name, 0, &buf, &options);
+ size_t namelen = strlen(name);
+ int len = interpret_branch_name(name, namelen, &buf, &options);
- if (0 < len && name[len] && buf.len)
+ if (0 < len && len < namelen && buf.len)
strbuf_addstr(&buf, name + len);
add_reflog_for_walk(revs->reflog_info,
(struct commit *)obj,