Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-15 01:25:02 +0400
committerJunio C Hamano <gitster@pobox.com>2014-03-15 01:25:03 +0400
commit6eb593a764303c05c7ca4f0fd107c5118b9cf7fb (patch)
tree8264b088a2d90ebb77adaf6afce0f99fed8f7845 /builtin
parented277519613d6f6bb422c4e4b7523ef8981a1c25 (diff)
parentb7756d41dcc6720e6005b663bcb6f8b2f2a66763 (diff)
Merge branch 'nd/reset-setup-worktree'
"git reset" needs to refresh the index when working in a working tree (it can also be used to match the index to the HEAD in an otherwise bare repository), but it failed to set up the working tree properly, causing GIT_WORK_TREE to be ignored. * nd/reset-setup-worktree: reset: optionally setup worktree and refresh index on --mixed
Diffstat (limited to 'builtin')
-rw-r--r--builtin/reset.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 4fd1c6c51d..f4e087596b 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -333,7 +333,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
if (reset_type == NONE)
reset_type = MIXED; /* by default */
- if (reset_type != SOFT && reset_type != MIXED)
+ if (reset_type != SOFT && (reset_type != MIXED || get_git_work_tree()))
setup_work_tree();
if (reset_type == MIXED && is_bare_repository())
@@ -356,8 +356,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
int flags = quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN;
if (read_from_tree(&pathspec, sha1, intent_to_add))
return 1;
- refresh_index(&the_index, flags, NULL, NULL,
- _("Unstaged changes after reset:"));
+ if (get_git_work_tree())
+ 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)