summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/RelNotes/1.7.5.4.txt18
-rw-r--r--Documentation/git-cvsserver.txt2
-rw-r--r--Documentation/git-diff-index.txt4
-rw-r--r--Documentation/git-diff-tree.txt4
-rw-r--r--Documentation/git-read-tree.txt5
-rw-r--r--Documentation/git-sh-i18n--envsubst.txt10
-rw-r--r--Documentation/git-status.txt40
-rw-r--r--builtin/log.c2
-rw-r--r--builtin/read-tree.c3
-rw-r--r--builtin/remote.c4
-rw-r--r--cache.h2
-rw-r--r--config.c63
-rw-r--r--config.mak.in1
-rw-r--r--git-rebase--interactive.sh4
-rwxr-xr-xgit-rebase.sh6
-rw-r--r--git.c6
-rw-r--r--pretty.c2
-rw-r--r--t/lib-read-tree.sh43
-rwxr-xr-xt/t1000-read-tree-m-3way.sh81
-rwxr-xr-xt/t1001-read-tree-m-2way.sh45
-rwxr-xr-xt/t1002-read-tree-m-u-2way.sh81
-rwxr-xr-xt/t1004-read-tree-m-u-wf.sh23
-rwxr-xr-xt/t1005-read-tree-reset.sh13
-rwxr-xr-xt/t1008-read-tree-overlay.sh3
-rwxr-xr-xt/t1011-read-tree-sparse-checkout.sh27
-rwxr-xr-xt/t1012-read-tree-df.sh9
-rwxr-xr-xt/t1020-subdirectory.sh5
-rwxr-xr-xt/t1300-repo-config.sh7
-rwxr-xr-xt/t3404-rebase-interactive.sh2
-rwxr-xr-xt/t5505-remote.sh22
-rw-r--r--unpack-trees.c4
-rw-r--r--unpack-trees.h3
-rw-r--r--wrapper.c6
33 files changed, 335 insertions, 215 deletions
diff --git a/Documentation/RelNotes/1.7.5.4.txt b/Documentation/RelNotes/1.7.5.4.txt
new file mode 100644
index 0000000..f3412ce
--- /dev/null
+++ b/Documentation/RelNotes/1.7.5.4.txt
@@ -0,0 +1,18 @@
+Git v1.7.5.4 Release Notes
+==========================
+
+Fixes since v1.7.5.3
+--------------------
+
+ * The single-key mode of "git add -p" was easily fooled into thinking
+ that it was told to add everthing ('a') when up-arrow was pressed by
+ mistake.
+
+ * "git diff -C -C" used to disable the rename detection entirely when
+ there are too many copy candidate paths in the tree; now it falls
+ back to "-C" when doing so would keep the copy candidate paths
+ under the rename detection limit.
+
+ * "git rerere" did not diagnose a corrupt MERGE_RR file in some cases.
+
+And other minor fixes and documentation updates.
diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt
index 88d814a..827bc98 100644
--- a/Documentation/git-cvsserver.txt
+++ b/Documentation/git-cvsserver.txt
@@ -252,7 +252,7 @@ Configuring database backend
'git-cvsserver' uses the Perl DBI module. Please also read
its documentation if changing these variables, especially
-about `DBI->connect()`.
+about `DBI\->connect()`.
gitcvs.dbname::
Database name. The exact meaning depends on the
diff --git a/Documentation/git-diff-index.txt b/Documentation/git-diff-index.txt
index 6d18486..2ea22ab 100644
--- a/Documentation/git-diff-index.txt
+++ b/Documentation/git-diff-index.txt
@@ -96,8 +96,8 @@ show that. So let's say that you have edited `kernel/sched.c`, but
have not actually done a 'git update-index' on it yet - there is no
"object" associated with the new state, and you get:
- torvalds@ppc970:~/v2.6/linux> git diff-index HEAD
- *100644->100664 blob 7476bb......->000000...... kernel/sched.c
+ torvalds@ppc970:~/v2.6/linux> git diff-index --abbrev HEAD
+ :100644 100664 7476bb... 000000... kernel/sched.c
i.e., it shows that the tree has changed, and that `kernel/sched.c` has is
not up-to-date and may contain new stuff. The all-zero sha1 means that to
diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
index 4e5f127..1439486 100644
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -138,8 +138,8 @@ so it can be used to name subdirectories.
An example of normal usage is:
- torvalds@ppc970:~/git> git diff-tree 5319e4......
- *100664->100664 blob ac348b.......->a01513....... git-fsck-objects.c
+ torvalds@ppc970:~/git> git diff-tree --abbrev 5319e4
+ :100664 100664 ac348b... a01513... git-fsck-objects.c
which tells you that the last commit changed just one file (it's from
this one:
diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index 26fdadc..46a96f2 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -53,6 +53,11 @@ OPTIONS
trees that are not directly related to the current
working tree status into a temporary index file.
+-n::
+--dry-run::
+ Check if the command would error out, without updating the index
+ nor the files in the working tree for real.
+
-v::
Show the progress of checking files out.
diff --git a/Documentation/git-sh-i18n--envsubst.txt b/Documentation/git-sh-i18n--envsubst.txt
index f5bbf77..61e4c08 100644
--- a/Documentation/git-sh-i18n--envsubst.txt
+++ b/Documentation/git-sh-i18n--envsubst.txt
@@ -5,6 +5,16 @@ NAME
----
git-sh-i18n--envsubst - Git's own envsubst(1) for i18n fallbacks
+SYNOPSIS
+--------
+[verse]
+eval_gettext () {
+ printf "%s" "$1" | (
+ export PATH $('git sh-i18n--envsubst' --variables "$1");
+ 'git sh-i18n--envsubst' "$1"
+ )
+}
+
DESCRIPTION
-----------
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 00b699f..38cb741 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -32,9 +32,10 @@ OPTIONS
Show the branch and tracking info even in short-format.
--porcelain::
- Give the output in a stable, easy-to-parse format for scripts.
- Currently this is identical to --short output, but is guaranteed
- not to change in the future, making it safe for scripts.
+ Give the output in an easy-to-parse format for scripts.
+ This is similar to the short output, but will remain stable
+ across git versions and regardless of user configuration. See
+ below for details.
-u[<mode>]::
--untracked-files[=<mode>]::
@@ -78,23 +79,27 @@ OUTPUT
The output from this command is designed to be used as a commit
template comment, and all the output lines are prefixed with '#'.
The default, long format, is designed to be human readable,
-verbose and descriptive. They are subject to change in any time.
+verbose and descriptive. Its contents and format are subject to change
+at any time.
The paths mentioned in the output, unlike many other git commands, are
made relative to the current directory if you are working in a
subdirectory (this is on purpose, to help cutting and pasting). See
the status.relativePaths config option below.
-In short-format, the status of each path is shown as
+Short Format
+~~~~~~~~~~~~
+
+In the short-format, the status of each path is shown as
XY PATH1 -> PATH2
-where `PATH1` is the path in the `HEAD`, and ` -> PATH2` part is
+where `PATH1` is the path in the `HEAD`, and the ` \-> PATH2` part is
shown only when `PATH1` corresponds to a different path in the
index/worktree (i.e. the file is renamed). The 'XY' is a two-letter
status code.
-The fields (including the `->`) are separated from each other by a
+The fields (including the `\->`) are separated from each other by a
single space. If a filename contains whitespace or other nonprintable
characters, that field will be quoted in the manner of a C string
literal: surrounded by ASCII double quote (34) characters, and with
@@ -143,10 +148,25 @@ If -b is used the short-format status is preceded by a line
## branchname tracking info
-There is an alternate -z format recommended for machine parsing. In
+Porcelain Format
+~~~~~~~~~~~~~~~~
+
+The porcelain format is similar to the short format, but is guaranteed
+not to change in a backwards-incompatible way between git versions or
+based on user configuration. This makes it ideal for parsing by scripts.
+The description of the short format above also describes the porcelain
+format, with a few exceptions:
+
+1. The user's color.status configuration is not respected; color will
+ always be off.
+
+2. The user's status.relativePaths configuration is not respected; paths
+ shown will always be relative to the repository root.
+
+There is also an alternate -z format recommended for machine parsing. In
that format, the status field is the same, but some other things
-change. First, the '->' is omitted from rename entries and the field
-order is reversed (e.g 'from -> to' becomes 'to from'). Second, a NUL
+change. First, the '\->' is omitted from rename entries and the field
+order is reversed (e.g 'from \-> to' becomes 'to from'). Second, a NUL
(ASCII 0) follows each filename, replacing space as a field separator
and the terminating newline (but a space still separates the status
field from the first filename). Third, filenames containing special
diff --git a/builtin/log.c b/builtin/log.c
index 27849dc..224b167 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -107,6 +107,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
PARSE_OPT_KEEP_DASHDASH);
argc = setup_revisions(argc, argv, rev, opt);
+ if (quiet)
+ rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
/* Any arguments at this point are not recognized */
if (argc > 1)
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 93c9281..df6c4c8 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -130,6 +130,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
PARSE_OPT_NONEG, exclude_per_directory_cb },
OPT_SET_INT('i', NULL, &opts.index_only,
"don't check the working tree after merging", 1),
+ OPT__DRY_RUN(&opts.dry_run, "don't update the index or the work tree"),
OPT_SET_INT(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
"skip applying sparse checkout filter", 1),
OPT_SET_INT(0, "debug-unpack", &opts.debug_unpack,
@@ -219,7 +220,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
if (unpack_trees(nr_trees, t, &opts))
return 128;
- if (opts.debug_unpack)
+ if (opts.debug_unpack || opts.dry_run)
return 0; /* do not write the index out */
/*
diff --git a/builtin/remote.c b/builtin/remote.c
index 8424152..9ff1cac 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -193,8 +193,8 @@ static int add(int argc, const char **argv)
if (mirror && master)
die("specifying a master branch makes no sense with --mirror");
- if (mirror && track.nr)
- die("specifying branches to track makes no sense with --mirror");
+ if (mirror && !(mirror & MIRROR_FETCH) && track.nr)
+ die("specifying branches to track makes sense only with fetch mirrors");
name = argv[0];
url = argv[1];
diff --git a/cache.h b/cache.h
index 009b365..e11cf6a 100644
--- a/cache.h
+++ b/cache.h
@@ -1040,8 +1040,6 @@ typedef int (*config_fn_t)(const char *, const char *, void *);
extern int git_default_config(const char *, const char *, void *);
extern int git_config_from_file(config_fn_t fn, const char *, void *);
extern void git_config_push_parameter(const char *text);
-extern int git_config_parse_parameter(const char *text);
-extern int git_config_parse_environment(void);
extern int git_config_from_parameters(config_fn_t fn, void *data);
extern int git_config(config_fn_t fn, void *);
extern int git_config_early(config_fn_t fn, void *, const char *repo_config);
diff --git a/config.c b/config.c
index 9d36848..e0b3b80 100644
--- a/config.c
+++ b/config.c
@@ -20,14 +20,6 @@ static int zlib_compression_seen;
const char *config_exclusive_filename = NULL;
-struct config_item {
- struct config_item *next;
- char *name;
- char *value;
-};
-static struct config_item *config_parameters;
-static struct config_item **config_parameters_tail = &config_parameters;
-
static void lowercase(char *p)
{
for (; *p; p++)
@@ -47,9 +39,9 @@ void git_config_push_parameter(const char *text)
strbuf_release(&env);
}
-int git_config_parse_parameter(const char *text)
+static int git_config_parse_parameter(const char *text,
+ config_fn_t fn, void *data)
{
- struct config_item *ct;
struct strbuf tmp = STRBUF_INIT;
struct strbuf **pair;
strbuf_addstr(&tmp, text);
@@ -59,22 +51,19 @@ int git_config_parse_parameter(const char *text)
strbuf_trim(pair[0]);
if (!pair[0]->len) {
strbuf_list_free(pair);
- return -1;
+ return error("bogus config parameter: %s", text);
}
- ct = xcalloc(1, sizeof(struct config_item));
- ct->name = strbuf_detach(pair[0], NULL);
- if (pair[1]) {
- strbuf_trim(pair[1]);
- ct->value = strbuf_detach(pair[1], NULL);
+ lowercase(pair[0]->buf);
+ if (fn(pair[0]->buf, pair[1] ? pair[1]->buf : NULL, data) < 0) {
+ strbuf_list_free(pair);
+ return -1;
}
strbuf_list_free(pair);
- lowercase(ct->name);
- *config_parameters_tail = ct;
- config_parameters_tail = &ct->next;
return 0;
}
-int git_config_parse_environment(void) {
+int git_config_from_parameters(config_fn_t fn, void *data)
+{
const char *env = getenv(CONFIG_DATA_ENVIRONMENT);
char *envw;
const char **argv = NULL;
@@ -92,8 +81,7 @@ int git_config_parse_environment(void) {
}
for (i = 0; i < nr; i++) {
- if (git_config_parse_parameter(argv[i]) < 0) {
- error("bogus config parameter: %s", argv[i]);
+ if (git_config_parse_parameter(argv[i], fn, data) < 0) {
free(argv);
free(envw);
return -1;
@@ -102,7 +90,7 @@ int git_config_parse_environment(void) {
free(argv);
free(envw);
- return 0;
+ return nr > 0;
}
static int get_next_char(void)
@@ -837,22 +825,6 @@ int git_config_system(void)
return !git_env_bool("GIT_CONFIG_NOSYSTEM", 0);
}
-int git_config_from_parameters(config_fn_t fn, void *data)
-{
- static int loaded_environment;
- const struct config_item *ct;
-
- if (!loaded_environment) {
- if (git_config_parse_environment() < 0)
- return -1;
- loaded_environment = 1;
- }
- for (ct = config_parameters; ct; ct = ct->next)
- if (fn(ct->name, ct->value, data) < 0)
- return -1;
- return 0;
-}
-
int git_config_early(config_fn_t fn, void *data, const char *repo_config)
{
int ret = 0, found = 0;
@@ -882,9 +854,16 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
found += 1;
}
- ret += git_config_from_parameters(fn, data);
- if (config_parameters)
- found += 1;
+ switch (git_config_from_parameters(fn, data)) {
+ case -1: /* error */
+ ret--;
+ break;
+ case 0: /* found nothing */
+ break;
+ default: /* found at least one item */
+ found++;
+ break;
+ }
return ret == 0 ? found : ret;
}
diff --git a/config.mak.in b/config.mak.in
index f30130b..ab37101 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -18,6 +18,7 @@ bindir = @bindir@
gitexecdir = @libexecdir@/git-core
datarootdir = @datarootdir@
template_dir = @datadir@/git-core/templates
+sysconfdir = @sysconfdir@
mandir=@mandir@
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 41ba96a..65690af 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -510,7 +510,9 @@ do_next () {
refs/*)
message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
git update-ref -m "$message" $head_name $newhead $orig_head &&
- git symbolic-ref HEAD $head_name
+ git symbolic-ref \
+ -m "$GIT_REFLOG_ACTION: returning to $head_name" \
+ HEAD $head_name
;;
esac && {
test ! -f "$state_dir"/verbose ||
diff --git a/git-rebase.sh b/git-rebase.sh
index 7a54bfc..d7855ea 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -153,7 +153,9 @@ move_to_original_branch () {
message="rebase finished: $head_name onto $onto"
git update-ref -m "$message" \
$head_name $(git rev-parse HEAD) $orig_head &&
- git symbolic-ref HEAD $head_name ||
+ git symbolic-ref \
+ -m "rebase finished: returning to $head_name" \
+ HEAD $head_name ||
die "Could not move back to $head_name"
;;
esac
@@ -332,7 +334,7 @@ abort)
read_basic_state
case "$head_name" in
refs/*)
- git symbolic-ref HEAD $head_name ||
+ git symbolic-ref -m "rebase: aborting" HEAD $head_name ||
die "Could not move back to $head_name"
;;
esac
diff --git a/git.c b/git.c
index a5ef3c6..89721d4 100644
--- a/git.c
+++ b/git.c
@@ -66,7 +66,7 @@ static void commit_pager_choice(void) {
static int handle_options(const char ***argv, int *argc, int *envchanged)
{
- int handled = 0;
+ const char **orig_argv = *argv;
while (*argc > 0) {
const char *cmd = (*argv)[0];
@@ -122,7 +122,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
*envchanged = 1;
(*argv)++;
(*argc)--;
- handled++;
} else if (!prefixcmp(cmd, "--git-dir=")) {
setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
if (envchanged)
@@ -162,9 +161,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
(*argv)++;
(*argc)--;
- handled++;
}
- return handled;
+ return (*argv) - orig_argv;
}
static int handle_alias(int *argcp, const char ***argv)
diff --git a/pretty.c b/pretty.c
index dff5c8d..52174fd 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1084,7 +1084,7 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
return;
fmt = user_format;
}
- strbuf_expand(&dummy, user_format, userformat_want_item, w);
+ strbuf_expand(&dummy, fmt, userformat_want_item, w);
strbuf_release(&dummy);
}
diff --git a/t/lib-read-tree.sh b/t/lib-read-tree.sh
new file mode 100644
index 0000000..abc2c6f
--- /dev/null
+++ b/t/lib-read-tree.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Helper functions to check if read-tree would succeed/fail as expected with
+# and without the dry-run option. They also test that the dry-run does not
+# write the index and that together with -u it doesn't touch the work tree.
+#
+read_tree_must_succeed () {
+ git ls-files -s >pre-dry-run &&
+ git read-tree -n "$@" &&
+ git ls-files -s >post-dry-run &&
+ test_cmp pre-dry-run post-dry-run &&
+ git read-tree "$@"
+}
+
+read_tree_must_fail () {
+ git ls-files -s >pre-dry-run &&
+ test_must_fail git read-tree -n "$@" &&
+ git ls-files -s >post-dry-run &&
+ test_cmp pre-dry-run post-dry-run &&
+ test_must_fail git read-tree "$@"
+}
+
+read_tree_u_must_succeed () {
+ git ls-files -s >pre-dry-run &&
+ git diff-files -p >pre-dry-run-wt &&
+ git read-tree -n "$@" &&
+ git ls-files -s >post-dry-run &&
+ git diff-files -p >post-dry-run-wt &&
+ test_cmp pre-dry-run post-dry-run &&
+ test_cmp pre-dry-run-wt post-dry-run-wt &&
+ git read-tree "$@"
+}
+
+read_tree_u_must_fail () {
+ git ls-files -s >pre-dry-run &&
+ git diff-files -p >pre-dry-run-wt &&
+ test_must_fail git read-tree -n "$@" &&
+ git ls-files -s >post-dry-run &&
+ git diff-files -p >post-dry-run-wt &&
+ test_cmp pre-dry-run post-dry-run &&
+ test_cmp pre-dry-run-wt post-dry-run-wt &&
+ test_must_fail git read-tree "$@"
+}
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
index ca8a409..babcdd2 100755
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -72,6 +72,7 @@ In addition:
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh
################################################################
@@ -137,7 +138,7 @@ test_expect_success \
'3-way merge with git read-tree -m, empty cache' \
"rm -fr [NDMALTS][NDMALTSF] Z &&
rm .git/index &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
# This starts out with the first head, which is the normal
@@ -146,9 +147,9 @@ test_expect_success \
'3-way merge with git read-tree -m, match H' \
"rm -fr [NDMALTS][NDMALTSF] Z &&
rm .git/index &&
- git read-tree $tree_A &&
+ read_tree_must_succeed $tree_A &&
git checkout-index -f -u -a &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
: <<\END_OF_CASE_TABLE
@@ -211,7 +212,7 @@ test_expect_success '1 - must not have an entry not in A.' "
rm -f .git/index XX &&
echo XX >XX &&
git update-index --add XX &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -219,7 +220,7 @@ test_expect_success \
"rm -f .git/index NA &&
cp .orig-B/NA NA &&
git update-index --add NA &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B"
test_expect_success \
'2 - matching B alone is OK in !O && !A && B case.' \
@@ -227,14 +228,14 @@ test_expect_success \
cp .orig-B/NA NA &&
git update-index --add NA &&
echo extra >>NA &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B"
test_expect_success \
'3 - must match A in !O && A && !B case.' \
"rm -f .git/index AN &&
cp .orig-A/AN AN &&
git update-index --add AN &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -243,7 +244,7 @@ test_expect_success \
cp .orig-A/AN AN &&
git update-index --add AN &&
echo extra >>AN &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B"
test_expect_success \
'3 (fail) - must match A in !O && A && !B case.' "
@@ -251,7 +252,7 @@ test_expect_success \
cp .orig-A/AN AN &&
echo extra >>AN &&
git update-index --add AN &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -259,7 +260,7 @@ test_expect_success \
"rm -f .git/index AA &&
cp .orig-A/AA AA &&
git update-index --add AA &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -268,7 +269,7 @@ test_expect_success \
cp .orig-A/AA AA &&
git update-index --add AA &&
echo extra >>AA &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -277,7 +278,7 @@ test_expect_success \
cp .orig-A/AA AA &&
echo extra >>AA &&
git update-index --add AA &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -285,7 +286,7 @@ test_expect_success \
"rm -f .git/index LL &&
cp .orig-A/LL LL &&
git update-index --add LL &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -294,7 +295,7 @@ test_expect_success \
cp .orig-A/LL LL &&
git update-index --add LL &&
echo extra >>LL &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -303,7 +304,7 @@ test_expect_success \
cp .orig-A/LL LL &&
echo extra >>LL &&
git update-index --add LL &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -311,7 +312,7 @@ test_expect_success \
rm -f .git/index DD &&
echo DD >DD &&
git update-index --add DD &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -319,7 +320,7 @@ test_expect_success \
rm -f .git/index DM &&
cp .orig-B/DM DM &&
git update-index --add DM &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -327,7 +328,7 @@ test_expect_success \
rm -f .git/index DN &&
cp .orig-B/DN DN &&
git update-index --add DN &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -335,7 +336,7 @@ test_expect_success \
"rm -f .git/index MD &&
cp .orig-A/MD MD &&
git update-index --add MD &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -344,7 +345,7 @@ test_expect_success \
cp .orig-A/MD MD &&
git update-index --add MD &&
echo extra >>MD &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -353,7 +354,7 @@ test_expect_success \
cp .orig-A/MD MD &&
echo extra >>MD &&
git update-index --add MD &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -361,7 +362,7 @@ test_expect_success \
"rm -f .git/index ND &&
cp .orig-A/ND ND &&
git update-index --add ND &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -370,7 +371,7 @@ test_expect_success \
cp .orig-A/ND ND &&
git update-index --add ND &&
echo extra >>ND &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -379,7 +380,7 @@ test_expect_success \
cp .orig-A/ND ND &&
echo extra >>ND &&
git update-index --add ND &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -387,7 +388,7 @@ test_expect_success \
"rm -f .git/index MM &&
cp .orig-A/MM MM &&
git update-index --add MM &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -396,7 +397,7 @@ test_expect_success \
cp .orig-A/MM MM &&
git update-index --add MM &&
echo extra >>MM &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -405,7 +406,7 @@ test_expect_success \
cp .orig-A/MM MM &&
echo extra >>MM &&
git update-index --add MM &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -413,7 +414,7 @@ test_expect_success \
"rm -f .git/index SS &&
cp .orig-A/SS SS &&
git update-index --add SS &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -422,7 +423,7 @@ test_expect_success \
cp .orig-A/SS SS &&
git update-index --add SS &&
echo extra >>SS &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -431,7 +432,7 @@ test_expect_success \
cp .orig-A/SS SS &&
echo extra >>SS &&
git update-index --add SS &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -439,7 +440,7 @@ test_expect_success \
"rm -f .git/index MN &&
cp .orig-A/MN MN &&
git update-index --add MN &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -448,7 +449,7 @@ test_expect_success \
cp .orig-A/MN MN &&
git update-index --add MN &&
echo extra >>MN &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -456,7 +457,7 @@ test_expect_success \
"rm -f .git/index NM &&
cp .orig-A/NM NM &&
git update-index --add NM &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -465,7 +466,7 @@ test_expect_success \
cp .orig-B/NM NM &&
git update-index --add NM &&
echo extra >>NM &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -474,7 +475,7 @@ test_expect_success \
cp .orig-A/NM NM &&
git update-index --add NM &&
echo extra >>NM &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -483,7 +484,7 @@ test_expect_success \
cp .orig-A/NM NM &&
echo extra >>NM &&
git update-index --add NM &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
test_expect_success \
@@ -491,7 +492,7 @@ test_expect_success \
"rm -f .git/index NN &&
cp .orig-A/NN NN &&
git update-index --add NN &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -500,7 +501,7 @@ test_expect_success \
cp .orig-A/NN NN &&
git update-index --add NN &&
echo extra >>NN &&
- git read-tree -m $tree_O $tree_A $tree_B &&
+ read_tree_must_succeed -m $tree_O $tree_A $tree_B &&
check_result"
test_expect_success \
@@ -509,7 +510,7 @@ test_expect_success \
cp .orig-A/NN NN &&
echo extra >>NN &&
git update-index --add NN &&
- test_must_fail git read-tree -m $tree_O $tree_A $tree_B
+ read_tree_must_fail -m $tree_O $tree_A $tree_B
"
# #16
@@ -522,7 +523,7 @@ test_expect_success \
echo E16 >F16 &&
git update-index F16 &&
tree1=`git write-tree` &&
- git read-tree -m $tree0 $tree1 $tree1 $tree0 &&
+ read_tree_must_succeed -m $tree0 $tree1 $tree1 $tree0 &&
git ls-files --stage'
test_done
diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh
index 680d992..acaab07 100755
--- a/t/t1001-read-tree-m-2way.sh
+++ b/t/t1001-read-tree-m-2way.sh
@@ -21,6 +21,7 @@ In the test, these paths are used:
yomin - not in H nor M
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
read_tree_twoway () {
git read-tree -m "$1" "$2" && git ls-files --stage
@@ -94,7 +95,7 @@ echo '+100644 X 0 yomin' >expected
test_expect_success \
'4 - carry forward local addition.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
git update-index --add yomin &&
read_tree_twoway $treeH $treeM &&
@@ -106,7 +107,7 @@ test_expect_success \
test_expect_success \
'5 - carry forward local addition.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo yomin >yomin &&
git update-index --add yomin &&
@@ -120,7 +121,7 @@ test_expect_success \
test_expect_success \
'6 - local addition already has the same.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
git update-index --add frotz &&
read_tree_twoway $treeH $treeM &&
@@ -131,7 +132,7 @@ test_expect_success \
test_expect_success \
'7 - local addition already has the same.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo frotz >frotz &&
git update-index --add frotz &&
@@ -144,7 +145,7 @@ test_expect_success \
test_expect_success \
'8 - conflicting addition.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo frotz frotz >frotz &&
git update-index --add frotz &&
@@ -153,7 +154,7 @@ test_expect_success \
test_expect_success \
'9 - conflicting addition.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo frotz frotz >frotz &&
git update-index --add frotz &&
@@ -163,7 +164,7 @@ test_expect_success \
test_expect_success \
'10 - path removed.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo rezrov >rezrov &&
git update-index --add rezrov &&
@@ -174,7 +175,7 @@ test_expect_success \
test_expect_success \
'11 - dirty path removed.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo rezrov >rezrov &&
git update-index --add rezrov &&
@@ -184,7 +185,7 @@ test_expect_success \
test_expect_success \
'12 - unmatching local changes being removed.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
@@ -193,7 +194,7 @@ test_expect_success \
test_expect_success \
'13 - unmatching local changes being removed.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
@@ -208,7 +209,7 @@ EOF
test_expect_success \
'14 - unchanged in two heads.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo nitfol nitfol >nitfol &&
git update-index --add nitfol &&
@@ -221,7 +222,7 @@ test_expect_success \
test_expect_success \
'15 - unchanged in two heads.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo nitfol nitfol >nitfol &&
git update-index --add nitfol &&
@@ -235,7 +236,7 @@ test_expect_success \
test_expect_success \
'16 - conflicting local change.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
@@ -244,7 +245,7 @@ test_expect_success \
test_expect_success \
'17 - conflicting local change.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
@@ -254,7 +255,7 @@ test_expect_success \
test_expect_success \
'18 - local change already having a good result.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
cat bozbar-new >bozbar &&
git update-index --add bozbar &&
@@ -266,7 +267,7 @@ test_expect_success \
test_expect_success \
'19 - local change already having a good result, further modified.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
cat bozbar-new >bozbar &&
git update-index --add bozbar &&
@@ -279,7 +280,7 @@ test_expect_success \
test_expect_success \
'20 - no local change, use new tree.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
cat bozbar-old >bozbar &&
git update-index --add bozbar &&
@@ -291,7 +292,7 @@ test_expect_success \
test_expect_success \
'21 - no local change, dirty cache.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
cat bozbar-old >bozbar &&
git update-index --add bozbar &&
@@ -302,7 +303,7 @@ test_expect_success \
test_expect_success \
'22 - local change cache updated.' \
'rm -f .git/index &&
- git read-tree $treeH &&
+ read_tree_must_succeed $treeH &&
git checkout-index -u -f -q -a &&
sed -e "s/such as/SUCH AS/" bozbar-old >bozbar &&
git update-index --add bozbar &&
@@ -359,7 +360,7 @@ test_expect_success \
test_expect_success \
'a/b (untracked) vs a, plus c/d case test.' \
- 'test_must_fail git read-tree -u -m "$treeH" "$treeM" &&
+ 'read_tree_u_must_fail -u -m "$treeH" "$treeM" &&
git ls-files --stage &&
test -f a/b'
@@ -386,7 +387,7 @@ test_expect_success \
test_expect_success \
'a/b vs a, plus c/d case test.' \
- 'git read-tree -u -m "$treeH" "$treeM" &&
+ 'read_tree_u_must_succeed -u -m "$treeH" "$treeM" &&
git ls-files --stage | tee >treeMcheck.out &&
test_cmp treeM.out treeMcheck.out'
@@ -401,7 +402,7 @@ test_expect_success '-m references the correct modified tree' '
echo a >file-a &&
git add file-a &&
git ls-tree $(git write-tree) file-a >expect &&
- git read-tree -m HEAD initial-mod &&
+ read_tree_must_succeed -m HEAD initial-mod &&
git ls-tree $(git write-tree) file-a >actual &&
test_cmp expect actual
'
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
index a4a17e0..a847709 100755
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -9,6 +9,7 @@ This is identical to t1001, but uses -u to update the work tree as well.
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
compare_change () {
sed >current \
@@ -56,8 +57,8 @@ test_expect_success \
test_expect_success \
'1, 2, 3 - no carry forward' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed --reset -u $treeH &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >1-3.out &&
cmp M.out 1-3.out &&
sum bozbar frotz nitfol >actual3.sum &&
@@ -69,11 +70,11 @@ test_expect_success \
test_expect_success \
'4 - carry forward local addition.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo "+100644 X 0 yomin" >expected &&
echo yomin >yomin &&
git update-index --add yomin &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >4.out || return 1
git diff -U0 --no-index M.out 4.out >4diff.out
compare_change 4diff.out expected &&
@@ -87,12 +88,12 @@ test_expect_success \
test_expect_success \
'5 - carry forward local addition.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
- git read-tree -m -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
+ read_tree_u_must_succeed -m -u $treeH &&
echo yomin >yomin &&
git update-index --add yomin &&
echo yomin yomin >yomin &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >5.out || return 1
git diff -U0 --no-index M.out 5.out >5diff.out
compare_change 5diff.out expected &&
@@ -107,10 +108,10 @@ test_expect_success \
test_expect_success \
'6 - local addition already has the same.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo frotz >frotz &&
git update-index --add frotz &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >6.out &&
test_cmp M.out 6.out &&
check_cache_at frotz clean &&
@@ -123,11 +124,11 @@ test_expect_success \
test_expect_success \
'7 - local addition already has the same.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo frotz >frotz &&
git update-index --add frotz &&
echo frotz frotz >frotz &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >7.out &&
test_cmp M.out 7.out &&
check_cache_at frotz dirty &&
@@ -141,27 +142,27 @@ test_expect_success \
test_expect_success \
'8 - conflicting addition.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo frotz frotz >frotz &&
git update-index --add frotz &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'9 - conflicting addition.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo frotz frotz >frotz &&
git update-index --add frotz &&
echo frotz >frotz &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'10 - path removed.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo rezrov >rezrov &&
git update-index --add rezrov &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >10.out &&
cmp M.out 10.out &&
sum bozbar frotz nitfol >actual10.sum &&
@@ -170,28 +171,28 @@ test_expect_success \
test_expect_success \
'11 - dirty path removed.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo rezrov >rezrov &&
git update-index --add rezrov &&
echo rezrov rezrov >rezrov &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'12 - unmatching local changes being removed.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'13 - unmatching local changes being removed.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo rezrov rezrov >rezrov &&
git update-index --add rezrov &&
echo rezrov >rezrov &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
cat >expected <<EOF
-100644 X 0 nitfol
@@ -201,10 +202,10 @@ EOF
test_expect_success \
'14 - unchanged in two heads.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo nitfol nitfol >nitfol &&
git update-index --add nitfol &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >14.out &&
test_must_fail git diff -U0 --no-index M.out 14.out >14diff.out &&
compare_change 14diff.out expected &&
@@ -221,11 +222,11 @@ test_expect_success \
test_expect_success \
'15 - unchanged in two heads.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo nitfol nitfol >nitfol &&
git update-index --add nitfol &&
echo nitfol nitfol nitfol >nitfol &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >15.out &&
test_must_fail git diff -U0 --no-index M.out 15.out >15diff.out &&
compare_change 15diff.out expected &&
@@ -242,27 +243,27 @@ test_expect_success \
test_expect_success \
'16 - conflicting local change.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'17 - conflicting local change.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo bozbar bozbar >bozbar &&
git update-index --add bozbar &&
echo bozbar bozbar bozbar >bozbar &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
test_expect_success \
'18 - local change already having a good result.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo gnusto >bozbar &&
git update-index --add bozbar &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >18.out &&
test_cmp M.out 18.out &&
check_cache_at bozbar clean &&
@@ -272,11 +273,11 @@ test_expect_success \
test_expect_success \
'19 - local change already having a good result, further modified.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo gnusto >bozbar &&
git update-index --add bozbar &&
echo gnusto gnusto >bozbar &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >19.out &&
test_cmp M.out 19.out &&
check_cache_at bozbar dirty &&
@@ -292,10 +293,10 @@ test_expect_success \
test_expect_success \
'20 - no local change, use new tree.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo bozbar >bozbar &&
git update-index --add bozbar &&
- git read-tree -m -u $treeH $treeM &&
+ read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >20.out &&
test_cmp M.out 20.out &&
check_cache_at bozbar clean &&
@@ -305,11 +306,11 @@ test_expect_success \
test_expect_success \
'21 - no local change, dirty cache.' \
'rm -f .git/index nitfol bozbar rezrov frotz &&
- git read-tree --reset -u $treeH &&
+ read_tree_u_must_succeed --reset -u $treeH &&
echo bozbar >bozbar &&
git update-index --add bozbar &&
echo gnusto gnusto >bozbar &&
- if git read-tree -m -u $treeH $treeM; then false; else :; fi'
+ if read_tree_u_must_succeed -m -u $treeH $treeM; then false; else :; fi'
# Also make sure we did not break DF vs DF/DF case.
test_expect_success \
@@ -336,7 +337,7 @@ test_expect_success \
rm -fr DF &&
echo DF >DF &&
git update-index --add DF &&
- git read-tree -m -u $treeDF $treeDFDF &&
+ read_tree_u_must_succeed -m -u $treeDF $treeDFDF &&
git ls-files --stage >DFDFcheck.out &&
test_cmp DFDF.out DFDFcheck.out &&
check_cache_at DF/DF clean'
diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index eb8e3d4..b3ae7d5 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -3,6 +3,7 @@
test_description='read-tree -m -u checks working tree files'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
# two-tree test
@@ -29,7 +30,7 @@ test_expect_success 'two-way not clobbering' '
echo >file2 master creates untracked file2 &&
echo >subdir/file2 master creates untracked subdir/file2 &&
- if err=`git read-tree -m -u master side 2>&1`
+ if err=`read_tree_u_must_succeed -m -u master side 2>&1`
then
echo should have complained
false
@@ -42,7 +43,7 @@ echo file2 >.gitignore
test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
- if err=`git read-tree -m --exclude-per-directory=.gitignore master side 2>&1`
+ if err=`read_tree_u_must_succeed -m --exclude-per-directory=.gitignore master side 2>&1`
then
echo should have complained
false
@@ -53,7 +54,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (1)' '
test_expect_success 'two-way with incorrect --exclude-per-directory (2)' '
- if err=`git read-tree -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1`
+ if err=`read_tree_u_must_succeed -m -u --exclude-per-directory=foo --exclude-per-directory=.gitignore master side 2>&1`
then
echo should have complained
false
@@ -64,7 +65,7 @@ test_expect_success 'two-way with incorrect --exclude-per-directory (2)' '
test_expect_success 'two-way clobbering a ignored file' '
- git read-tree -m -u --exclude-per-directory=.gitignore master side
+ read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore master side
'
rm -f .gitignore
@@ -84,7 +85,7 @@ test_expect_success 'three-way not complaining on an untracked path in both' '
echo >file2 file two is untracked on the master side &&
echo >subdir/file2 file two is untracked on the master side &&
- git read-tree -m -u branch-point master side
+ read_tree_u_must_succeed -m -u branch-point master side
'
test_expect_success 'three-way not clobbering a working tree file' '
@@ -94,7 +95,7 @@ test_expect_success 'three-way not clobbering a working tree file' '
git checkout master &&
echo >file3 file three created in master, untracked &&
echo >subdir/file3 file three created in master, untracked &&
- if err=`git read-tree -m -u branch-point master side 2>&1`
+ if err=`read_tree_u_must_succeed -m -u branch-point master side 2>&1`
then
echo should have complained
false
@@ -113,7 +114,7 @@ test_expect_success 'three-way not complaining on an untracked file' '
echo >file3 file three created in master, untracked &&
echo >subdir/file3 file three created in master, untracked &&
- git read-tree -m -u --exclude-per-directory=.gitignore branch-point master side
+ read_tree_u_must_succeed -m -u --exclude-per-directory=.gitignore branch-point master side
'
test_expect_success '3-way not overwriting local changes (setup)' '
@@ -137,7 +138,7 @@ test_expect_success '3-way not overwriting local changes (our side)' '
git reset --hard &&
echo >>file1 "local changes" &&
- git read-tree -m -u branch-point side-a side-b &&
+ read_tree_u_must_succeed -m -u branch-point side-a side-b &&
grep "new line to be kept" file1 &&
grep "local changes" file1
@@ -151,7 +152,7 @@ test_expect_success '3-way not overwriting local changes (their side)' '
git reset --hard &&
echo >>file2 "local changes" &&
- test_must_fail git read-tree -m -u branch-point side-a side-b &&
+ read_tree_u_must_fail -m -u branch-point side-a side-b &&
! grep "new line to be kept" file2 &&
grep "local changes" file2
@@ -173,7 +174,7 @@ test_expect_success SYMLINKS 'funny symlink in work tree' '
git add a/b &&
git commit -m "we add a/b" &&
- git read-tree -m -u sym-a sym-a sym-b
+ read_tree_u_must_succeed -m -u sym-a sym-a sym-b
'
@@ -209,7 +210,7 @@ test_expect_success 'D/F setup' '
test_expect_success 'D/F' '
git checkout side-b &&
- git read-tree -m -u branch-point side-b side-a &&
+ read_tree_u_must_succeed -m -u branch-point side-b side-a &&
git ls-files -u >actual &&
(
a=$(git rev-parse branch-point:subdir/file2)
diff --git a/t/t1005-read-tree-reset.sh b/t/t1005-read-tree-reset.sh
index 8499116..f53de79 100755
--- a/t/t1005-read-tree-reset.sh
+++ b/t/t1005-read-tree-reset.sh
@@ -3,6 +3,7 @@
test_description='read-tree -u --reset'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
# two-tree test
@@ -22,13 +23,13 @@ test_expect_success 'setup' '
'
test_expect_success 'reset should work' '
- git read-tree -u --reset HEAD^ &&
+ read_tree_u_must_succeed -u --reset HEAD^ &&
git ls-files >actual &&
test_cmp expect actual
'
test_expect_success 'reset should remove remnants from a failed merge' '
- git read-tree --reset -u HEAD &&
+ read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >expect &&
sha1=$(git rev-parse :new) &&
(
@@ -37,13 +38,13 @@ test_expect_success 'reset should remove remnants from a failed merge' '
) | git update-index --index-info &&
>old &&
git ls-files -s &&
- git read-tree --reset -u HEAD &&
+ read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >actual &&
! test -f old
'
test_expect_success 'Porcelain reset should remove remnants too' '
- git read-tree --reset -u HEAD &&
+ read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >expect &&
sha1=$(git rev-parse :new) &&
(
@@ -58,7 +59,7 @@ test_expect_success 'Porcelain reset should remove remnants too' '
'
test_expect_success 'Porcelain checkout -f should remove remnants too' '
- git read-tree --reset -u HEAD &&
+ read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >expect &&
sha1=$(git rev-parse :new) &&
(
@@ -73,7 +74,7 @@ test_expect_success 'Porcelain checkout -f should remove remnants too' '
'
test_expect_success 'Porcelain checkout -f HEAD should remove remnants too' '
- git read-tree --reset -u HEAD &&
+ read_tree_u_must_succeed --reset -u HEAD &&
git ls-files -s >expect &&
sha1=$(git rev-parse :new) &&
(
diff --git a/t/t1008-read-tree-overlay.sh b/t/t1008-read-tree-overlay.sh
index f9e0028..4c50ed9 100755
--- a/t/t1008-read-tree-overlay.sh
+++ b/t/t1008-read-tree-overlay.sh
@@ -3,6 +3,7 @@
test_description='test multi-tree read-tree without merging'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success setup '
echo one >a &&
@@ -21,7 +22,7 @@ test_expect_success setup '
'
test_expect_success 'multi-read' '
- git read-tree initial master side &&
+ read_tree_must_succeed initial master side &&
(echo a; echo b/c) >expect &&
git ls-files >actual &&
test_cmp expect actual
diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 20a50eb..018c354 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -12,6 +12,7 @@ test_description='sparse checkout tests
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success 'setup' '
cat >expected <<-\EOF &&
@@ -43,7 +44,7 @@ test_expect_success 'setup' '
'
test_expect_success 'read-tree without .git/info/sparse-checkout' '
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files --stage >result &&
test_cmp expected result &&
git ls-files -t >result &&
@@ -52,7 +53,7 @@ test_expect_success 'read-tree without .git/info/sparse-checkout' '
test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
echo >.git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt result &&
test -f init.t &&
@@ -62,7 +63,7 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '
git config core.sparsecheckout true &&
echo >.git/info/sparse-checkout &&
- git read-tree --no-sparse-checkout -m -u HEAD &&
+ read_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt result &&
test -f init.t &&
@@ -72,7 +73,7 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-
test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
git config core.sparsecheckout true &&
echo >.git/info/sparse-checkout &&
- test_must_fail git read-tree -m -u HEAD &&
+ read_tree_u_must_fail -m -u HEAD &&
git ls-files --stage >result &&
test_cmp expected result &&
git ls-files -t >result &&
@@ -90,7 +91,7 @@ test_expect_success 'match directories with trailing slash' '
EOF
echo sub/ > .git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files -t > result &&
test_cmp expected.swt-noinit result &&
test ! -f init.t &&
@@ -99,7 +100,7 @@ test_expect_success 'match directories with trailing slash' '
test_expect_success 'match directories without trailing slash' '
echo sub >.git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt-noinit result &&
test ! -f init.t &&
@@ -149,7 +150,7 @@ EOF
test_expect_success 'match directory pattern' '
echo "s?b" >.git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt-noinit result &&
test ! -f init.t &&
@@ -165,7 +166,7 @@ test_expect_success 'checkout area changes' '
EOF
echo init.t >.git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ read_tree_u_must_succeed -m -u HEAD &&
git ls-files -t >result &&
test_cmp expected.swt-nosub result &&
test -f init.t &&
@@ -175,7 +176,7 @@ test_expect_success 'checkout area changes' '
test_expect_success 'read-tree updates worktree, absent case' '
echo sub/added >.git/info/sparse-checkout &&
git checkout -f top &&
- git read-tree -m -u HEAD^ &&
+ read_tree_u_must_succeed -m -u HEAD^ &&
test ! -f init.t
'
@@ -183,7 +184,7 @@ test_expect_success 'read-tree updates worktree, dirty case' '
echo sub/added >.git/info/sparse-checkout &&
git checkout -f top &&
echo dirty >init.t &&
- git read-tree -m -u HEAD^ &&
+ read_tree_u_must_succeed -m -u HEAD^ &&
grep -q dirty init.t &&
rm init.t
'
@@ -192,14 +193,14 @@ test_expect_success 'read-tree removes worktree, dirty case' '
echo init.t >.git/info/sparse-checkout &&
git checkout -f top &&
echo dirty >added &&
- git read-tree -m -u HEAD^ &&
+ read_tree_u_must_succeed -m -u HEAD^ &&
grep -q dirty added
'
test_expect_success 'read-tree adds to worktree, absent case' '
echo init.t >.git/info/sparse-checkout &&
git checkout -f removed &&
- git read-tree -u -m HEAD^ &&
+ read_tree_u_must_succeed -u -m HEAD^ &&
test ! -f sub/added
'
@@ -208,7 +209,7 @@ test_expect_success 'read-tree adds to worktree, dirty case' '
git checkout -f removed &&
mkdir sub &&
echo dirty >sub/added &&
- git read-tree -u -m HEAD^ &&
+ read_tree_u_must_succeed -u -m HEAD^ &&
grep -q dirty sub/added
'
diff --git a/t/t1012-read-tree-df.sh b/t/t1012-read-tree-df.sh
index 9811d46..a6a04b6 100755
--- a/t/t1012-read-tree-df.sh
+++ b/t/t1012-read-tree-df.sh
@@ -3,6 +3,7 @@
test_description='read-tree D/F conflict corner cases'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
maketree () {
(
@@ -53,7 +54,7 @@ test_expect_success setup '
test_expect_success '3-way (1)' '
settree A-000 &&
- git read-tree -m -u O-000 A-000 B-000 &&
+ read_tree_u_must_succeed -m -u O-000 A-000 B-000 &&
checkindex <<-EOF
3 a/b
0 a/b-2/c/d
@@ -65,7 +66,7 @@ test_expect_success '3-way (1)' '
test_expect_success '3-way (2)' '
settree A-001 &&
- git read-tree -m -u O-000 A-001 B-000 &&
+ read_tree_u_must_succeed -m -u O-000 A-001 B-000 &&
checkindex <<-EOF
3 a/b
0 a/b-2/c/d
@@ -78,7 +79,7 @@ test_expect_success '3-way (2)' '
test_expect_success '3-way (3)' '
settree A-010 &&
- git read-tree -m -u O-010 A-010 B-010 &&
+ read_tree_u_must_succeed -m -u O-010 A-010 B-010 &&
checkindex <<-EOF
2 t
1 t-0
@@ -92,7 +93,7 @@ test_expect_success '3-way (3)' '
test_expect_success '2-way (1)' '
settree O-020 &&
- git read-tree -m -u O-020 A-020 &&
+ read_tree_u_must_succeed -m -u O-020 A-020 &&
checkindex <<-EOF
0 ds/dma/ioat/Makefile
0 ds/dma/ioat/registers.h
diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index ddc3921..f6a44c9 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -7,6 +7,7 @@ test_description='Try various core-level commands in subdirectory.
'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-read-tree.sh
test_expect_success setup '
long="a b c d e f g h i j k l m n o p q r s t u v w x y z" &&
@@ -98,13 +99,13 @@ test_expect_success 'checkout-index' '
test_expect_success 'read-tree' '
rm -f one dir/two &&
tree=`git write-tree` &&
- git read-tree --reset -u "$tree" &&
+ read_tree_u_must_succeed --reset -u "$tree" &&
cmp one original.one &&
cmp dir/two original.two &&
(
cd dir &&
rm -f two &&
- git read-tree --reset -u "$tree" &&
+ read_tree_u_must_succeed --reset -u "$tree" &&
cmp two ../original.two &&
cmp ../one ../original.one
)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 53fb822..3db5626 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -897,4 +897,11 @@ test_expect_success 'key sanity-checking' '
git config foo."ba =z".bar false
'
+test_expect_success 'git -c works with aliases of builtins' '
+ git config alias.checkconfig "-c foo.check=bar config foo.check" &&
+ echo bar >expect &&
+ git checkconfig >actual &&
+ test_cmp expect actual
+'
+
test_done
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 7d8147b..47c8371 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -317,7 +317,7 @@ test_expect_success '--continue tries to commit' '
'
test_expect_success 'verbose flag is heeded, even after --continue' '
- git reset --hard HEAD@{1} &&
+ git reset --hard master@{1} &&
test_tick &&
test_must_fail git rebase -v -i --onto new-branch1 HEAD^ &&
echo resolved > file1 &&
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 4e69c90..0d0222e 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -347,6 +347,21 @@ test_expect_success 'fetch mirrors do not act as mirrors during push' '
)
'
+test_expect_success 'add fetch mirror with specific branches' '
+ git init --bare mirror-fetch/track &&
+ (cd mirror-fetch/track &&
+ git remote add --mirror=fetch -t heads/new parent ../parent
+ )
+'
+
+test_expect_success 'fetch mirror respects specific branches' '
+ (cd mirror-fetch/track &&
+ git fetch parent &&
+ git rev-parse --verify refs/heads/new &&
+ test_must_fail git rev-parse --verify refs/heads/renamed
+ )
+'
+
test_expect_success 'add --mirror=push' '
mkdir mirror-push &&
git init --bare mirror-push/public &&
@@ -382,6 +397,13 @@ test_expect_success 'push mirrors do not act as mirrors during fetch' '
)
'
+test_expect_success 'push mirrors do not allow you to specify refs' '
+ git init mirror-push/track &&
+ (cd mirror-push/track &&
+ test_must_fail git remote add --mirror=push -t new public ../public
+ )
+'
+
test_expect_success 'add alt && prune' '
(mkdir alttst &&
cd alttst &&
diff --git a/unpack-trees.c b/unpack-trees.c
index 0bc4b2d..07f8364 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -203,7 +203,7 @@ static int check_updates(struct unpack_trees_options *o)
if (ce->ce_flags & CE_WT_REMOVE) {
display_progress(progress, ++cnt);
- if (o->update)
+ if (o->update && !o->dry_run)
unlink_entry(ce);
continue;
}
@@ -217,7 +217,7 @@ static int check_updates(struct unpack_trees_options *o)
if (ce->ce_flags & CE_UPDATE) {
display_progress(progress, ++cnt);
ce->ce_flags &= ~CE_UPDATE;
- if (o->update) {
+ if (o->update && !o->dry_run) {
errs |= checkout_entry(ce, &state, NULL);
}
}
diff --git a/unpack-trees.h b/unpack-trees.h
index cd11a08..64f02cb 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -46,7 +46,8 @@ struct unpack_trees_options {
debug_unpack,
skip_sparse_checkout,
gently,
- show_all_errors;
+ show_all_errors,
+ dry_run;
const char *prefix;
int cache_bottom;
struct dir_struct *dir;
diff --git a/wrapper.c b/wrapper.c
index 2829000..85f09df 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -148,8 +148,10 @@ ssize_t read_in_full(int fd, void *buf, size_t count)
while (count > 0) {
ssize_t loaded = xread(fd, p, count);
- if (loaded <= 0)
- return total ? total : loaded;
+ if (loaded < 0)
+ return -1;
+ if (loaded == 0)
+ return total;
count -= loaded;
p += loaded;
total += loaded;