summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-11-20 23:55:50 -0800
committerJunio C Hamano <gitster@pobox.com>2009-11-20 23:55:50 -0800
commit39add7a36feca434ba85267cb76e4fd69bcdc13a (patch)
tree3fe3b7f5b5514152c9c2223f30020dce9b7f311d /unpack-trees.c
parent885d492f69a80ae3e91c1310a63caf0aeb567f2a (diff)
parent353c5eeb5cad63218ca796352cce9986df7b9c62 (diff)
downloadgit-39add7a36feca434ba85267cb76e4fd69bcdc13a.tar.gz
Merge branch 'jc/fix-tree-walk' (early part)
* 'jc/fix-tree-walk' (early part): unpack_callback(): use unpack_failed() consistently unpack-trees: typofix diff-lib.c: fix misleading comments on oneway_diff()
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 157d5d001f..dd5999c356 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -277,6 +277,17 @@ static int unpack_nondirectories(int n, unsigned long mask,
return 0;
}
+static int unpack_failed(struct unpack_trees_options *o, const char *message)
+{
+ discard_index(&o->result);
+ if (!o->gently) {
+ if (message)
+ return error("%s", message);
+ return -1;
+ }
+ return -1;
+}
+
static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info)
{
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
@@ -294,7 +305,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
int cmp = compare_entry(ce, info, p);
if (cmp < 0) {
if (unpack_index_entry(ce, o) < 0)
- return -1;
+ return unpack_failed(o, NULL);
continue;
}
if (!cmp) {
@@ -352,17 +363,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
return mask;
}
-static int unpack_failed(struct unpack_trees_options *o, const char *message)
-{
- discard_index(&o->result);
- if (!o->gently) {
- if (message)
- return error("%s", message);
- return -1;
- }
- return -1;
-}
-
/*
* N-way merge "len" trees. Returns 0 on success, -1 on failure to manipulate the
* resulting index, -2 on failure to reflect the changes to the work tree.
@@ -617,7 +617,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,
* found "foo/." in the working tree.
* This is tricky -- if we have modified
* files that are in "foo/" we would lose
- * it.
+ * them.
*/
ret = verify_clean_subdirectory(ce, action, o);
if (ret < 0)