Skip to content

Commit d8534ad

Browse files
committed
Merge branch 'maint'
* maint: Fix "git-commit -C $tag" Documentation/git-stash.txt: Adjust SYNOPSIS command syntax (2)
2 parents 991c3dc + 8a2f873 commit d8534ad

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

Documentation/git-stash.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SYNOPSIS
99
--------
1010
[verse]
1111
'git-stash' (list | show [<stash>] | apply [<stash>] | clear)
12-
'git-stash' [save] [message...]
12+
'git-stash' [save [<message>]]
1313

1414
DESCRIPTION
1515
-----------
@@ -36,11 +36,12 @@ is also possible).
3636
OPTIONS
3737
-------
3838

39-
save::
39+
save [<message>]::
4040

4141
Save your local modifications to a new 'stash', and run `git-reset
4242
--hard` to revert them. This is the default action when no
43-
subcommand is given.
43+
subcommand is given. The <message> part is optional and gives
44+
the description along with the stashed state.
4445

4546
list::
4647

builtin-commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
601601

602602
if (get_sha1(use_message, sha1))
603603
die("could not lookup commit %s", use_message);
604-
commit = lookup_commit(sha1);
604+
commit = lookup_commit_reference(sha1);
605605
if (!commit || parse_commit(commit))
606606
die("could not parse commit %s", use_message);
607607

t/t7501-commit.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,22 @@ test_expect_success 'amend using the message from another commit' '
327327
328328
'
329329

330+
test_expect_success 'amend using the message from a commit named with tag' '
331+
332+
git reset --hard &&
333+
test_tick &&
334+
git commit --allow-empty -m "old commit" &&
335+
old=$(git rev-parse --verify HEAD) &&
336+
git tag -a -m "tag on old" tagged-old HEAD &&
337+
test_tick &&
338+
git commit --allow-empty -m "new commit" &&
339+
new=$(git rev-parse --verify HEAD) &&
340+
test_tick &&
341+
git commit --allow-empty --amend -C tagged-old &&
342+
git show --pretty="format:%ad %s" "$old" >expected &&
343+
git show --pretty="format:%ad %s" HEAD >actual &&
344+
diff -u expected actual
345+
346+
'
347+
330348
test_done

0 commit comments

Comments
 (0)