Merge branch 'ma/sequencer-do-reset-saner-loop-termination'
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Nov 2018 13:37:21 +0000 (22:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Nov 2018 13:37:21 +0000 (22:37 +0900)
Code readability fix.

* ma/sequencer-do-reset-saner-loop-termination:
sequencer: break out of loop explicitly

sequencer.c
index 9e1ab3a2a7e3f65cc444cded7f3330bb27be2db8..405d5ef86bfd1bfa5e01c63d7f1afe88e7132feb 100644 (file)
@@ -2890,7 +2890,7 @@ static int do_reset(const char *name, int len, struct replay_opts *opts)
        struct tree_desc desc;
        struct tree *tree;
        struct unpack_trees_options unpack_tree_opts;
-       int ret = 0, i;
+       int ret = 0;
 
        if (hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0)
                return -1;
@@ -2910,10 +2910,13 @@ static int do_reset(const char *name, int len, struct replay_opts *opts)
                }
                oidcpy(&oid, &opts->squash_onto);
        } else {
+               int i;
+
                /* Determine the length of the label */
                for (i = 0; i < len; i++)
                        if (isspace(name[i]))
-                               len = i;
+                               break;
+               len = i;
 
                strbuf_addf(&ref_name, "refs/rewritten/%.*s", len, name);
                if (get_oid(ref_name.buf, &oid) &&