diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-17 11:42:34 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-17 11:42:34 -0700 |
commit | c8ccfc9cdf3381525cce718c846bc62fd86767f7 (patch) | |
tree | 6dc22b521f3af03855ee0e13f8599694aaee6e2e /builtin/reset.c | |
parent | 984ac91e72578aa271daf79b6c44d34da2a8dc5d (diff) | |
parent | b07f7296080b20f5cc2069ce2761cacdd79b3432 (diff) | |
download | git-c8ccfc9cdf3381525cce718c846bc62fd86767f7.tar.gz |
Merge branch 'fc/trivial'
* fc/trivial:
pull: use $curr_branch_short more
add: trivial style cleanup
reset: trivial style cleanup
branch: trivial style fix
reset: trivial refactoring
Diffstat (limited to 'builtin/reset.c')
-rw-r--r-- | builtin/reset.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/builtin/reset.c b/builtin/reset.c index 5e4c551531..088ccffba0 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -330,11 +330,14 @@ int cmd_reset(int argc, const char **argv, const char *prefix) die_if_unmerged_cache(reset_type); if (reset_type != SOFT) { - struct lock_file *lock = xcalloc(1, sizeof(struct lock_file)); + struct lock_file *lock = xcalloc(1, sizeof(*lock)); int newfd = hold_locked_index(lock, 1); if (reset_type == MIXED) { + int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; if (read_from_tree(&pathspec, sha1)) return 1; + refresh_index(&the_index, flags, NULL, NULL, + _("Unstaged changes after reset:")); } else { int err = reset_index(sha1, reset_type, quiet); if (reset_type == KEEP && !err) @@ -343,12 +346,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix) die(_("Could not reset index file to revision '%s'."), rev); } - if (reset_type == MIXED) { /* Report what has not been updated. */ - int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN; - refresh_index(&the_index, flags, NULL, NULL, - _("Unstaged changes after reset:")); - } - if (write_cache(newfd, active_cache, active_nr) || commit_locked_index(lock)) die(_("Could not write new index file.")); |