Skip to content

Commit 9ef2257

Browse files
committed
Merge branch 'master' into next
* master: Git 1.7.8-rc4 builtin-reset: Documentation update builtin-branch: Fix crash on invalid use of --force revert --abort: do not leave behind useless sequencer-old directory Fix revert --abort on Windows revert: do not pass non-literal string as format to git_path() Conflicts: builtin/branch.c
2 parents dc26bd8 + fc14b89 commit 9ef2257

File tree

6 files changed

+20
-11
lines changed

6 files changed

+20
-11
lines changed

Documentation/RelNotes/1.7.8.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ included in this release.
162162

163163
---
164164
exec >/var/tmp/1
165-
O=v1.7.8-rc3-16-g9e9ab40
165+
O=v1.7.8-rc4
166166
echo O=$(git describe --always master)
167167
git log --first-parent --oneline --reverse ^$O master
168168
echo

Documentation/git-reset.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ SYNOPSIS
99
--------
1010
[verse]
1111
'git reset' [-q] [<commit>] [--] <paths>...
12-
'git reset' [--patch|-p] [<commit>] [--] [<paths>...]
13-
'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
12+
'git reset' (--patch | -p) [<commit>] [--] [<paths>...]
13+
'git reset' (--soft | --mixed | --hard | --merge | --keep) [-q] [<commit>]
1414

1515
DESCRIPTION
1616
-----------
@@ -34,7 +34,7 @@ Alternatively, using linkgit:git-checkout[1] and specifying a commit, you
3434
can copy the contents of a path out of a commit to the index and to the
3535
working tree in one go.
3636

37-
'git reset' --patch|-p [<commit>] [--] [<paths>...]::
37+
'git reset' (--patch | -p) [<commit>] [--] [<paths>...]::
3838
Interactively select hunks in the difference between the index
3939
and <commit> (defaults to HEAD). The chosen hunks are applied
4040
in reverse to the index.
@@ -43,7 +43,7 @@ This means that `git reset -p` is the opposite of `git add -p`, i.e.
4343
you can use it to selectively reset hunks. See the ``Interactive Mode''
4444
section of linkgit:git-add[1] to learn how to operate the `\--patch` mode.
4545

46-
'git reset' [--<mode>] [<commit>]::
46+
'git reset' --<mode> [<commit>]::
4747
This form resets the current branch head to <commit> and
4848
possibly updates the index (resetting it to the tree of <commit>) and
4949
the working tree depending on <mode>, which

GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=v1.7.8-rc3
4+
DEF_VER=v1.7.8-rc4
55

66
LF='
77
'

builtin/branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
747747
argc = parse_options(argc, argv, prefix, options, builtin_branch_usage,
748748
0);
749749

750-
if (!delete && !rename && !force_create && !edit_description && argc == 0)
750+
if (!delete && !rename && !edit_description && argc == 0)
751751
list = 1;
752752

753753
if (!!delete + !!rename + !!force_create + !!list > 1)
@@ -780,7 +780,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
780780
rename_branch(argv[0], argv[1], rename > 1);
781781
else
782782
usage_with_options(builtin_branch_usage, options);
783-
} else if (argc <= 2) {
783+
} else if (argc > 0 && argc <= 2) {
784784
if (kinds != REF_LOCAL_BRANCH)
785785
die(_("-a and -r options to 'git branch' do not make sense with a branch name"));
786786
create_branch(head, argv[0], (argc == 2) ? argv[1] : head,

builtin/revert.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)
318318

319319
strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
320320

321-
filename = git_path(pseudoref);
321+
filename = git_path("%s", pseudoref);
322322
fd = open(filename, O_WRONLY | O_CREAT, 0666);
323323
if (fd < 0)
324324
die_errno(_("Could not open '%s' for writing"), filename);
@@ -924,21 +924,22 @@ static int sequencer_rollback(struct replay_opts *opts)
924924
if (strbuf_getline(&buf, f, '\n')) {
925925
error(_("cannot read %s: %s"), filename, ferror(f) ?
926926
strerror(errno) : _("unexpected end of file"));
927+
fclose(f);
927928
goto fail;
928929
}
930+
fclose(f);
929931
if (get_sha1_hex(buf.buf, sha1) || buf.buf[40] != '\0') {
930932
error(_("stored pre-cherry-pick HEAD file '%s' is corrupt"),
931933
filename);
932934
goto fail;
933935
}
934936
if (reset_for_rollback(sha1))
935937
goto fail;
938+
remove_sequencer_state(1);
936939
strbuf_release(&buf);
937-
fclose(f);
938940
return 0;
939941
fail:
940942
strbuf_release(&buf);
941-
fclose(f);
942943
return -1;
943944
}
944945

t/t7106-reset-sequence.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,12 @@ test_expect_success 'reset --hard cleans up sequencer state, providing one-level
4141
test_path_is_missing .git/sequencer-old
4242
'
4343

44+
test_expect_success 'cherry-pick --abort does not leave sequencer-old dir' '
45+
pristine_detach initial &&
46+
test_must_fail git cherry-pick base..anotherpick &&
47+
git cherry-pick --abort &&
48+
test_path_is_missing .git/sequencer &&
49+
test_path_is_missing .git/sequencer-old
50+
'
51+
4452
test_done

0 commit comments

Comments
 (0)