diff options
| author | Junio C Hamano <gitster@pobox.com> | 2013-04-02 15:09:35 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2013-04-02 15:09:35 -0700 |
| commit | 5fb7b899fb7e34e962556e6623bbfa8e5c035e62 (patch) | |
| tree | 505aff42cd03152f549e42d448ff410c1fac7fd7 /submodule.c | |
| parent | cc3e4eba723570bf77902c017611ee02bb86c8b3 (diff) | |
| parent | d8febde370aa464a5208cf094f306343e4ecb6dc (diff) | |
Merge branch 'jk/no-more-self-assignment'
This started as a topic to reduce "type var = var" self assignment
tricks that were used to squelch "variable used uninitialized perhaps?"
warning from some compilers, but resulted in rewriting logic with
a version that is simpler and easier to understand for humans.
* jk/no-more-self-assignment:
match-trees: simplify score_trees() using tree_entry()
submodule: clarify logic in show_submodule_summary
Diffstat (limited to 'submodule.c')
| -rw-r--r-- | submodule.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/submodule.c b/submodule.c index 9ba1496543..975bc87e48 100644 --- a/submodule.c +++ b/submodule.c @@ -261,7 +261,7 @@ void show_submodule_summary(FILE *f, const char *path, const char *del, const char *add, const char *reset) { struct rev_info rev; - struct commit *left = left, *right = right; + struct commit *left = NULL, *right = NULL; const char *message = NULL; struct strbuf sb = STRBUF_INIT; int fast_forward = 0, fast_backward = 0; @@ -275,10 +275,8 @@ void show_submodule_summary(FILE *f, const char *path, else if (!(left = lookup_commit_reference(one)) || !(right = lookup_commit_reference(two))) message = "(commits not present)"; - - if (!message && - prepare_submodule_summary(&rev, path, left, right, - &fast_forward, &fast_backward)) + else if (prepare_submodule_summary(&rev, path, left, right, + &fast_forward, &fast_backward)) message = "(revision walker failed)"; if (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) @@ -302,11 +300,12 @@ void show_submodule_summary(FILE *f, const char *path, strbuf_addf(&sb, "%s:%s\n", fast_backward ? " (rewind)" : "", reset); fwrite(sb.buf, sb.len, 1, f); - if (!message) { + if (!message) /* only NULL if we succeeded in setting up the walk */ print_submodule_summary(&rev, f, del, add, reset); + if (left) clear_commit_marks(left, ~0); + if (right) clear_commit_marks(right, ~0); - } strbuf_release(&sb); } |
