summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-25 07:41:14 (GMT)
commit4a3ed2bec6031545aea38db10e443a979951346f (patch)
treedbb5ba4597bdd046ac9ed9dc0e57a7de9250a636 /unpack-trees.c
parentb72e90712eb0e802b232ad4c88460d04279c7111 (diff)
parent6eff409e8a760645ae5357d1e95e7e7ff3c04456 (diff)
downloadgit-4a3ed2bec6031545aea38db10e443a979951346f.zip
git-4a3ed2bec6031545aea38db10e443a979951346f.tar.gz
git-4a3ed2bec6031545aea38db10e443a979951346f.tar.bz2
Merge branch 'nd/checkout-m'
"git checkout -m <other>" was about carrying the differences between HEAD and the working-tree files forward while checking out another branch, and ignored the differences between HEAD and the index. The command has been taught to abort when the index and the HEAD are different. * nd/checkout-m: checkout: prevent losing staged changes with --merge read-tree: add --quiet unpack-trees: rename "gently" flag to "quiet" unpack-trees: keep gently check inside add_rejected_path
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 5f43252..afa4a5c 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -219,6 +219,9 @@ static int add_rejected_path(struct unpack_trees_options *o,
enum unpack_trees_error_types e,
const char *path)
{
+ if (o->quiet)
+ return -1;
+
if (!o->show_all_errors)
return error(ERRORMSG(o, e), super_prefixed(path));
@@ -268,8 +271,7 @@ static int check_submodule_move_head(const struct cache_entry *ce,
flags |= SUBMODULE_MOVE_HEAD_FORCE;
if (submodule_move_head(ce->name, old_id, new_id, flags))
- return o->gently ? -1 :
- add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
+ return add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
return 0;
}
@@ -1039,7 +1041,7 @@ static int unpack_nondirectories(int n, unsigned long mask,
static int unpack_failed(struct unpack_trees_options *o, const char *message)
{
discard_index(&o->result);
- if (!o->gently && !o->exiting_early) {
+ if (!o->quiet && !o->exiting_early) {
if (message)
return error("%s", message);
return -1;
@@ -1646,8 +1648,7 @@ return_failed:
static int reject_merge(const struct cache_entry *ce,
struct unpack_trees_options *o)
{
- return o->gently ? -1 :
- add_rejected_path(o, ERROR_WOULD_OVERWRITE, ce->name);
+ return add_rejected_path(o, ERROR_WOULD_OVERWRITE, ce->name);
}
static int same(const struct cache_entry *a, const struct cache_entry *b)
@@ -1694,8 +1695,7 @@ static int verify_uptodate_1(const struct cache_entry *ce,
int r = check_submodule_move_head(ce,
"HEAD", oid_to_hex(&ce->oid), o);
if (r)
- return o->gently ? -1 :
- add_rejected_path(o, error_type, ce->name);
+ return add_rejected_path(o, error_type, ce->name);
return 0;
}
@@ -1713,8 +1713,7 @@ static int verify_uptodate_1(const struct cache_entry *ce,
}
if (errno == ENOENT)
return 0;
- return o->gently ? -1 :
- add_rejected_path(o, error_type, ce->name);
+ return add_rejected_path(o, error_type, ce->name);
}
int verify_uptodate(const struct cache_entry *ce,
@@ -1834,8 +1833,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
d.exclude_per_dir = o->dir->exclude_per_dir;
i = read_directory(&d, o->src_index, pathbuf, namelen+1, NULL);
if (i)
- return o->gently ? -1 :
- add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
+ return add_rejected_path(o, ERROR_NOT_UPTODATE_DIR, ce->name);
free(pathbuf);
return cnt;
}
@@ -1904,8 +1902,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
return 0;
}
- return o->gently ? -1 :
- add_rejected_path(o, error_type, name);
+ return add_rejected_path(o, error_type, name);
}
/*
@@ -2345,7 +2342,7 @@ int bind_merge(const struct cache_entry * const *src,
return error("Cannot do a bind merge of %d trees",
o->merge_size);
if (a && old)
- return o->gently ? -1 :
+ return o->quiet ? -1 :
error(ERRORMSG(o, ERROR_BIND_OVERLAP),
super_prefixed(a->name),
super_prefixed(old->name));