Skip to content

Commit a5565b4

Browse files
authored
Merge pull request #1852 from dscho/built-in-stash-rebase-fixes
Built-in stash/rebase fixes
2 parents d6a9496 + fb77ec5 commit a5565b4

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

azure-pipelines.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ phases:
1010
name: Hosted Ubuntu 1604
1111
steps:
1212
- bash: |
13-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
13+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
1414
1515
sudo apt-get update &&
1616
sudo rm /var/lib/apt/lists/lock &&
@@ -24,7 +24,7 @@ phases:
2424
exit 1
2525
}
2626
27-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
27+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
2828
displayName: 'ci/run-build-and-tests.sh'
2929
env:
3030
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -44,7 +44,7 @@ phases:
4444
name: Hosted Ubuntu 1604
4545
steps:
4646
- bash: |
47-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
47+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
4848
4949
sudo apt-get update &&
5050
sudo rm /var/lib/apt/lists/lock &&
@@ -56,7 +56,7 @@ phases:
5656
exit 1
5757
}
5858
59-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
59+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
6060
displayName: 'ci/run-build-and-tests.sh'
6161
env:
6262
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -76,7 +76,7 @@ phases:
7676
name: Hosted macOS
7777
steps:
7878
- bash: |
79-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
79+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
8080
8181
export CC=clang
8282
@@ -86,7 +86,7 @@ phases:
8686
exit 1
8787
}
8888
89-
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
89+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
9090
displayName: 'ci/run-build-and-tests.sh'
9191
env:
9292
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -106,15 +106,15 @@ phases:
106106
name: Hosted macOS
107107
steps:
108108
- bash: |
109-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
109+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
110110
111111
ci/install-dependencies.sh
112112
ci/run-build-and-tests.sh || {
113113
ci/print-test-failures.sh
114114
exit 1
115115
}
116116
117-
test -z "$GITFILESHAREPWD" || umount "$HOME/test-cache" || exit 1
117+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
118118
displayName: 'ci/run-build-and-tests.sh'
119119
env:
120120
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -134,7 +134,7 @@ phases:
134134
name: Hosted Ubuntu 1604
135135
steps:
136136
- bash: |
137-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
137+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
138138
139139
sudo apt-get update &&
140140
sudo rm /var/lib/apt/lists/lock &&
@@ -147,7 +147,7 @@ phases:
147147
exit 1
148148
}
149149
150-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
150+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
151151
displayName: 'ci/run-build-and-tests.sh'
152152
env:
153153
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -171,7 +171,7 @@ phases:
171171
# Helper to check the error level of the latest command (exit with error when appropriate)
172172
function c() { if (!$?) { exit(1) } }
173173
174-
if ("$GITFILESHAREPWD" -ne "") {
174+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
175175
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no; c
176176
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\; c
177177
}
@@ -223,7 +223,7 @@ phases:
223223
"@
224224
c
225225
226-
if ("$GITFILESHAREPWD" -ne "") {
226+
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
227227
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
228228
}
229229
displayName: 'build & test'
@@ -245,7 +245,7 @@ phases:
245245
name: Hosted Ubuntu 1604
246246
steps:
247247
- bash: |
248-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
248+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
249249
250250
sudo apt-get update &&
251251
sudo rm /var/lib/apt/lists/lock &&
@@ -266,7 +266,7 @@ phases:
266266
267267
sudo chmod a+r t/out/TEST-*.xml
268268
269-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
269+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
270270
displayName: 'ci/run-linux32-docker.sh'
271271
env:
272272
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -286,7 +286,7 @@ phases:
286286
name: Hosted Ubuntu 1604
287287
steps:
288288
- bash: |
289-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
289+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
290290
291291
sudo apt-get update &&
292292
sudo rm /var/lib/apt/lists/lock &&
@@ -296,7 +296,7 @@ phases:
296296
297297
ci/run-static-analysis.sh || exit 1
298298
299-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
299+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
300300
displayName: 'ci/run-static-analysis.sh'
301301
env:
302302
GITFILESHAREPWD: $(gitfileshare.pwd)
@@ -308,7 +308,7 @@ phases:
308308
name: Hosted Ubuntu 1604
309309
steps:
310310
- bash: |
311-
test -z "$GITFILESHAREPWD" || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
311+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
312312
313313
sudo apt-get update &&
314314
sudo rm /var/lib/apt/lists/lock &&
@@ -319,7 +319,7 @@ phases:
319319
320320
ci/test-documentation.sh || exit 1
321321
322-
test -z "$GITFILESHAREPWD" || sudo umount "$HOME/test-cache" || exit 1
322+
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
323323
displayName: 'ci/test-documentation.sh'
324324
env:
325325
GITFILESHAREPWD: $(gitfileshare.pwd)

builtin/rebase--interactive.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
181181
OPT_STRING(0, "upstream", &upstream, N_("upstream"),
182182
N_("the upstream commit")),
183183
OPT_STRING(0, "head-name", &head_name, N_("head-name"), N_("head name")),
184-
OPT_STRING('S', "gpg-sign", &opts.gpg_sign, N_("gpg-sign"),
185-
N_("GPG-sign commits")),
184+
{ OPTION_STRING, 'S', "gpg-sign", &opts.gpg_sign, N_("key-id"),
185+
N_("GPG-sign commits"),
186+
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
186187
OPT_STRING(0, "strategy", &opts.strategy, N_("strategy"),
187188
N_("rebase strategy")),
188189
OPT_STRING(0, "strategy-opts", &raw_strategies, N_("strategy-opts"),

builtin/rebase.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
10301030
OPT_BOOL(0, "autosquash", &options.autosquash,
10311031
N_("move commits that begin with "
10321032
"squash!/fixup! under -i")),
1033-
OPT_STRING('S', "gpg-sign", &gpg_sign,
1034-
N_("gpg-sign?"), N_("GPG-sign commits")),
1033+
{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
1034+
N_("GPG-sign commits"),
1035+
PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
10351036
OPT_STRING_LIST(0, "whitespace", &whitespace,
10361037
N_("whitespace"), N_("passed to 'git apply'")),
10371038
OPT_SET_INT('C', 0, &opt_c, N_("passed to 'git apply'"),

builtin/stash.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -414,18 +414,19 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
414414

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

420421
ret = apply_cached(&out);
421422
strbuf_release(&out);
422423
if (ret)
423-
return -1;
424+
return error(_("Conflicts in index. Try without --index."));
424425

425426
discard_cache();
426427
read_cache();
427428
if (write_cache_as_tree(&index_tree, 0, NULL))
428-
return -1;
429+
return error(_("Could not save index tree"));
429430

430431
reset_head();
431432
}

0 commit comments

Comments
 (0)