Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
"git checkout -- paths..." should error out when paths cannot be written
author
Junio C Hamano
<gitster@pobox.com>
Wed, 28 May 2008 21:48:57 +0000
(14:48 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 29 May 2008 00:38:20 +0000
(17:38 -0700)
When "git checkout -- paths..." cannot update work tree for whatever
reason, checkout_entry() correctly issued an error message for the path to
the end user, but the command ignored the error, causing the entire
command to succeed. This fixes it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-checkout.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a7052d3
)
diff --git
a/builtin-checkout.c
b/builtin-checkout.c
index 1ea017f5f70f2255fb937866e9913a06399ce517..00dc8cafd827aaffeb9f9e1b8cc7addb7fffaa8d 100644
(file)
--- a/
builtin-checkout.c
+++ b/
builtin-checkout.c
@@
-84,6
+84,7
@@
static int checkout_paths(struct tree *source_tree, const char **pathspec)
unsigned char rev[20];
int flag;
struct commit *head;
unsigned char rev[20];
int flag;
struct commit *head;
+ int errs = 0;
int newfd;
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
int newfd;
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
@@
-106,13
+107,14
@@
static int checkout_paths(struct tree *source_tree, const char **pathspec)
if (report_path_error(ps_matched, pathspec, 0))
return 1;
if (report_path_error(ps_matched, pathspec, 0))
return 1;
+ /* Now we are committed to check them out */
memset(&state, 0, sizeof(state));
state.force = 1;
state.refresh_cache = 1;
for (pos = 0; pos < active_nr; pos++) {
struct cache_entry *ce = active_cache[pos];
if (pathspec_match(pathspec, NULL, ce->name, 0)) {
memset(&state, 0, sizeof(state));
state.force = 1;
state.refresh_cache = 1;
for (pos = 0; pos < active_nr; pos++) {
struct cache_entry *ce = active_cache[pos];
if (pathspec_match(pathspec, NULL, ce->name, 0)) {
- checkout_entry(ce, &state, NULL);
+
errs |=
checkout_entry(ce, &state, NULL);
}
}
}
}
@@
-123,7
+125,8
@@
static int checkout_paths(struct tree *source_tree, const char **pathspec)
resolve_ref("HEAD", rev, 0, &flag);
head = lookup_commit_reference_gently(rev, 1);
resolve_ref("HEAD", rev, 0, &flag);
head = lookup_commit_reference_gently(rev, 1);
- return post_checkout_hook(head, head, 0);
+ errs |= post_checkout_hook(head, head, 0);
+ return errs;
}
static void show_local_changes(struct object *head)
}
static void show_local_changes(struct object *head)