mirror of
https://github.com/git/git.git
synced 2026-01-18 14:44:28 +00:00
Merge pull request #1814 from dscho/builtin-stash-v8
Update the built-in stash to v8, and the built-in rebase -i to v7
This commit is contained in:
@@ -117,9 +117,6 @@ show [<options>] [<stash>]::
|
||||
You can use stash.showStat and/or stash.showPatch config variables
|
||||
to change the default behavior.
|
||||
|
||||
It accepts any option known to `git diff`, but acts different on
|
||||
`--quiet` option and exit with zero regardless of differences.
|
||||
|
||||
pop [--index] [-q|--quiet] [<stash>]::
|
||||
|
||||
Remove a single stashed state from the stash list and apply it
|
||||
|
||||
@@ -206,6 +206,9 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
|
||||
opts.allow_ff = 1;
|
||||
opts.allow_empty = 1;
|
||||
|
||||
if (argc == 1)
|
||||
usage_with_options(builtin_rebase_interactive_usage, options);
|
||||
|
||||
argc = parse_options(argc, argv, NULL, options,
|
||||
builtin_rebase_interactive_usage, PARSE_OPT_KEEP_ARGV0);
|
||||
|
||||
@@ -223,6 +226,9 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
|
||||
|
||||
switch (command) {
|
||||
case NONE:
|
||||
if (!onto && !upstream)
|
||||
die(_("a base commit must be provided with --upstream or --onto"));
|
||||
|
||||
ret = do_interactive_rebase(&opts, flags, switch_to, upstream, onto,
|
||||
onto_name, squash_onto, head_name, restrict_revision,
|
||||
raw_strategies, cmd, autosquash);
|
||||
|
||||
613
builtin/stash.c
613
builtin/stash.c
File diff suppressed because it is too large
Load Diff
@@ -4703,7 +4703,7 @@ int complete_action(struct replay_opts *opts, unsigned flags,
|
||||
|
||||
if (!lstat(todo_file, &st) && st.st_size == 0 &&
|
||||
write_message("noop\n", 5, todo_file, 0))
|
||||
return error_errno(_("could not write '%s'"), todo_file);
|
||||
return -1;
|
||||
|
||||
if (autosquash && rearrange_squash())
|
||||
return -1;
|
||||
@@ -4736,7 +4736,7 @@ int complete_action(struct replay_opts *opts, unsigned flags,
|
||||
|
||||
if (write_message(buf->buf, buf->len, todo_file, 0)) {
|
||||
todo_list_release(&todo_list);
|
||||
return error_errno(_("could not write '%s'"), todo_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (copy_file(rebase_path_todo_backup(), todo_file, 0666))
|
||||
@@ -4778,7 +4778,9 @@ int complete_action(struct replay_opts *opts, unsigned flags,
|
||||
if (opts->allow_ff && skip_unnecessary_picks(&oid))
|
||||
return error(_("could not skip unnecessary pick commands"));
|
||||
|
||||
checkout_onto(opts, onto_name, oid_to_hex(&oid), orig_head);
|
||||
if (checkout_onto(opts, onto_name, oid_to_hex(&oid), orig_head))
|
||||
return -1;
|
||||
;
|
||||
if (require_clean_work_tree("rebase", "", 1, 1))
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ test_expect_success 'invalid ref of the form "n", n >= N' '
|
||||
git stash drop
|
||||
'
|
||||
|
||||
test_expect_success 'branch: should not drop the stash if the branch exists' '
|
||||
test_expect_success 'branch: do not drop the stash if the branch exists' '
|
||||
git stash clear &&
|
||||
echo foo >file &&
|
||||
git add file &&
|
||||
@@ -707,7 +707,7 @@ test_expect_success 'branch: should not drop the stash if the apply fails' '
|
||||
git rev-parse stash@{0} --
|
||||
'
|
||||
|
||||
test_expect_success 'apply: shows same status as git status (relative to ./)' '
|
||||
test_expect_success 'apply: show same status as git status (relative to ./)' '
|
||||
git stash clear &&
|
||||
echo 1 >subdir/subfile1 &&
|
||||
echo 2 >subdir/subfile2 &&
|
||||
@@ -1048,7 +1048,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '
|
||||
test_i18ncmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'push: <pathspec> shows no changes when there are none' '
|
||||
test_expect_success 'push <pathspec>: show no changes when there are none' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git commit -m "tmp" &&
|
||||
@@ -1066,6 +1066,7 @@ test_expect_success 'push: <pathspec> not in the repository errors out' '
|
||||
|
||||
test_expect_success 'push: -q is quiet with changes' '
|
||||
>foo &&
|
||||
git add foo &&
|
||||
git stash push -q >output 2>&1 &&
|
||||
test_must_be_empty output
|
||||
'
|
||||
@@ -1077,12 +1078,13 @@ test_expect_success 'push: -q is quiet with no changes' '
|
||||
|
||||
test_expect_success 'push: -q is quiet even if there is no initial commit' '
|
||||
git init foo_dir &&
|
||||
cd foo_dir &&
|
||||
touch bar &&
|
||||
test_must_fail git stash push -q >output 2>&1 &&
|
||||
test_must_be_empty output &&
|
||||
cd .. &&
|
||||
rm -rf foo_dir
|
||||
test_when_finished rm -rf foo_dir &&
|
||||
(
|
||||
cd foo_dir &&
|
||||
>bar &&
|
||||
test_must_fail git stash push -q >output 2>&1 &&
|
||||
test_must_be_empty output
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'untracked files are left in place when -u is not given' '
|
||||
|
||||
81
t/t3907-stash-show-config.sh
Executable file
81
t/t3907-stash-show-config.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
|
||||
test_description='Test git stash show configuration.'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success 'setup' '
|
||||
test_commit file
|
||||
'
|
||||
|
||||
# takes three parameters:
|
||||
# 1. the stash.showStat value (or "<unset>")
|
||||
# 2. the stash.showPatch value (or "<unset>")
|
||||
# 3. the diff options of the expected output (or nothing for no output)
|
||||
test_stat_and_patch () {
|
||||
if test "<unset>" = "$1"
|
||||
then
|
||||
test_might_fail git config --unset stash.showStat
|
||||
else
|
||||
test_config stash.showStat "$1"
|
||||
fi &&
|
||||
|
||||
if test "<unset>" = "$2"
|
||||
then
|
||||
test_might_fail git config --unset stash.showPatch
|
||||
else
|
||||
test_config stash.showPatch "$2"
|
||||
fi &&
|
||||
|
||||
shift &&
|
||||
shift &&
|
||||
echo 2 >file.t &&
|
||||
git diff "$@" >expect &&
|
||||
git stash &&
|
||||
git stash show >actual &&
|
||||
|
||||
if test -z "$1"
|
||||
then
|
||||
test_must_be_empty actual
|
||||
else
|
||||
test_cmp expect actual
|
||||
fi
|
||||
}
|
||||
|
||||
test_expect_success 'showStat unset showPatch unset' '
|
||||
test_stat_and_patch "<unset>" "<unset>" --stat
|
||||
'
|
||||
|
||||
test_expect_success 'showStat unset showPatch false' '
|
||||
test_stat_and_patch "<unset>" false --stat
|
||||
'
|
||||
|
||||
test_expect_success 'showStat unset showPatch true' '
|
||||
test_stat_and_patch "<unset>" true --stat -p
|
||||
'
|
||||
|
||||
test_expect_success 'showStat false showPatch unset' '
|
||||
test_stat_and_patch false "<unset>"
|
||||
'
|
||||
|
||||
test_expect_success 'showStat false showPatch false' '
|
||||
test_stat_and_patch false false
|
||||
'
|
||||
|
||||
test_expect_success 'showStat false showPatch true' '
|
||||
test_stat_and_patch false true -p
|
||||
'
|
||||
|
||||
test_expect_success 'showStat true showPatch unset' '
|
||||
test_stat_and_patch true "<unset>" --stat
|
||||
'
|
||||
|
||||
test_expect_success 'showStat true showPatch false' '
|
||||
test_stat_and_patch true false --stat
|
||||
'
|
||||
|
||||
test_expect_success 'showStat true showPatch true' '
|
||||
test_stat_and_patch true true --stat -p
|
||||
'
|
||||
|
||||
test_done
|
||||
Reference in New Issue
Block a user