Skip to content

Commit

Permalink
Merge pull request #1852 from dscho/built-in-stash-rebase-fixes
Browse files Browse the repository at this point in the history
Built-in stash/rebase fixes
  • Loading branch information
jamill committed Sep 27, 2018
2 parents d6a9496 + fb77ec5 commit a5565b4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
36 changes: 18 additions & 18 deletions azure-pipelines.yml
Expand Up @@ -10,7 +10,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -24,7 +24,7 @@ phases:
exit 1
}
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-build-and-tests.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -44,7 +44,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -56,7 +56,7 @@ phases:
exit 1
}
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-build-and-tests.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -76,7 +76,7 @@ phases:
name: Hosted macOS
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
export CC=clang
Expand All @@ -86,7 +86,7 @@ phases:
exit 1
}
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-build-and-tests.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -106,15 +106,15 @@ phases:
name: Hosted macOS
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
ci/install-dependencies.sh
ci/run-build-and-tests.sh || {
ci/print-test-failures.sh
exit 1
}
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-build-and-tests.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -134,7 +134,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -147,7 +147,7 @@ phases:
exit 1
}
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-build-and-tests.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -171,7 +171,7 @@ phases:
# Helper to check the error level of the latest command (exit with error when appropriate)
function c() { if (!$?) { exit(1) } }
if ("$GITFILESHAREPWD" -ne "") {
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no; c
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\; c
}
Expand Down Expand Up @@ -223,7 +223,7 @@ phases:
"@
c
if ("$GITFILESHAREPWD" -ne "") {
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
}
displayName: 'build & test'
Expand All @@ -245,7 +245,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -266,7 +266,7 @@ phases:
sudo chmod a+r t/out/TEST-*.xml
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-linux32-docker.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -286,7 +286,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -296,7 +296,7 @@ phases:
ci/run-static-analysis.sh || exit 1
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/run-static-analysis.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
Expand All @@ -308,7 +308,7 @@ phases:
name: Hosted Ubuntu 1604
steps:
- bash: |
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
sudo apt-get update &&
sudo rm /var/lib/apt/lists/lock &&
Expand All @@ -319,7 +319,7 @@ phases:
ci/test-documentation.sh || exit 1
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
displayName: 'ci/test-documentation.sh'
env:
GITFILESHAREPWD: $(gitfileshare.pwd)
5 changes: 3 additions & 2 deletions builtin/rebase--interactive.c
Expand Up @@ -181,8 +181,9 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
OPT_STRING(0, "upstream", &upstream, N_("upstream"),
N_("the upstream commit")),
OPT_STRING(0, "head-name", &head_name, N_("head-name"), N_("head name")),
OPT_STRING('S', "gpg-sign", &opts.gpg_sign, N_("gpg-sign"),
N_("GPG-sign commits")),
{ OPTION_STRING, 'S', "gpg-sign", &opts.gpg_sign, N_("key-id"),
N_("GPG-sign commits"),
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_STRING(0, "strategy", &opts.strategy, N_("strategy"),
N_("rebase strategy")),
OPT_STRING(0, "strategy-opts", &raw_strategies, N_("strategy-opts"),
Expand Down
5 changes: 3 additions & 2 deletions builtin/rebase.c
Expand Up @@ -1030,8 +1030,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "autosquash", &options.autosquash,
N_("move commits that begin with "
"squash!/fixup! under -i")),
OPT_STRING('S', "gpg-sign", &gpg_sign,
N_("gpg-sign?"), N_("GPG-sign commits")),
{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
N_("GPG-sign commits"),
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
OPT_STRING_LIST(0, "whitespace", &whitespace,
N_("whitespace"), N_("passed to 'git apply'")),
OPT_SET_INT('C', 0, &opt_c, N_("passed to 'git apply'"),
Expand Down
7 changes: 4 additions & 3 deletions builtin/stash.c
Expand Up @@ -414,18 +414,19 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,

if (diff_tree_binary(&out, &info->w_commit)) {
strbuf_release(&out);
return -1;
return error(_("Could not generate diff %s^!."),
oid_to_hex(&info->w_commit));
}

ret = apply_cached(&out);
strbuf_release(&out);
if (ret)
return -1;
return error(_("Conflicts in index. Try without --index."));

discard_cache();
read_cache();
if (write_cache_as_tree(&index_tree, 0, NULL))
return -1;
return error(_("Could not save index tree"));

reset_head();
}
Expand Down

0 comments on commit a5565b4

Please sign in to comment.