Skip to content

Commit 617ead3

Browse files
dschoKevin Willford
authored andcommitted
PR 151469: Merge users/johasc/gvfs-2.10.1.2 to gvfs/master
This synchronizes GVFS' master with Git for Windows v2.10.1(2). - sequencer: future-proof remove_sequencer_state() - sequencer: allow the sequencer to take custody of malloc()ed data - sequencer: release memory that was allocated when reading options - sequencer: future-proof read_populate_todo() - sequencer: completely revamp the "todo" script parsing - sequencer: avoid completely different messages for different actions - sequencer: get rid of the subcommand field - sequencer: refactor the code to obtain a short commit name - sequencer: remember the onelines when parsing the todo file - sequencer: prepare for rebase -i's commit functionality ... Related work items: #726
2 parents f429f2c + a3da9b9 commit 617ead3

31 files changed

+407
-86
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ David Kågedal <[email protected]>
4848
David Reiss <[email protected]> <dreiss@dreiss-vmware.(none)>
4949
David S. Miller <[email protected]>
5050
51+
5152
Deskin Miller <[email protected]>
5253
Dirk Süsserott <[email protected]>
5354

Documentation/RelNotes/2.10.2.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Git v2.10.2 Release Notes
2+
=========================
3+
4+
Fixes since v2.10.1
5+
-------------------
6+
7+
* The code that parses the format parameter of for-each-ref command
8+
has seen a micro-optimization.
9+
10+
* The "graph" API used in "git log --graph" miscounted the number of
11+
output columns consumed so far when drawing a padding line, which
12+
has been fixed; this did not affect any existing code as nobody
13+
tried to write anything after the padding on such a line, though.
14+
15+
* Almost everybody uses DEFAULT_ABBREV to refer to the default
16+
setting for the abbreviation, but "git blame" peeked into
17+
underlying variable bypassing the macro for no good reason.
18+
19+
* Doc update to clarify what "log -3 --reverse" does.
20+
21+
* An author name, that spelled a backslash-quoted double quote in the
22+
human readable part "My \"double quoted\" name", was not unquoted
23+
correctly while applying a patch from a piece of e-mail.
24+
25+
* The original command line syntax for "git merge", which was "git
26+
merge <msg> HEAD <parent>...", has been deprecated for quite some
27+
time, and "git gui" was the last in-tree user of the syntax. This
28+
is finally fixed, so that we can move forward with the deprecation.
29+
30+
* Codepaths that read from an on-disk loose object were too loose in
31+
validating what they are reading is a proper object file and
32+
sometimes read past the data they read from the disk, which has
33+
been corrected. H/t to Gustavo Grieco for reporting.
34+
35+
* "git worktree", even though it used the default_abbrev setting that
36+
ought to be affected by core.abbrev configuration variable, ignored
37+
the variable setting. The command has been taught to read the
38+
default set of configuration variables to correct this.
39+
40+
* A low-level function verify_packfile() was meant to show errors
41+
that were detected without dying itself, but under some conditions
42+
it didn't and died instead, which has been fixed.
43+
44+
45+
Also contains minor documentation updates and code clean-ups.

Documentation/git-reset.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SYNOPSIS
1010
[verse]
1111
'git reset' [-q] [<tree-ish>] [--] <paths>...
1212
'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]
13+
EXPERIMENTAL: 'git reset' [-q] [--stdin [-z]] [<tree-ish>]
1314
'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
1415

1516
DESCRIPTION
@@ -97,6 +98,15 @@ OPTIONS
9798
--quiet::
9899
Be quiet, only report errors.
99100

101+
--stdin::
102+
EXPERIMENTAL: Instead of taking list of paths from the
103+
command line, read list of paths from the standard input.
104+
Paths are separated by LF (i.e. one path per line) by
105+
default.
106+
107+
-z::
108+
EXPERIMENTAL: Only meaningful with `--stdin`; paths are
109+
separated with NUL character instead of LF.
100110

101111
EXAMPLES
102112
--------

Documentation/rev-list-options.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,9 @@ avoid showing the commits from two parallel development track mixed
657657
together.
658658

659659
--reverse::
660-
Output the commits in reverse order.
661-
Cannot be combined with `--walk-reflogs`.
660+
Output the commits chosen to be shown (see Commit Limiting
661+
section above) in reverse order. Cannot be combined with
662+
`--walk-reflogs`.
662663

663664
Object Traversal
664665
~~~~~~~~~~~~~~~~

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=v2.10.1-gvfs
4+
DEF_VER=v2.10.1.2-gvfs
55

66
LF='
77
'

RelNotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Documentation/RelNotes/2.10.1.txt
1+
Documentation/RelNotes/2.10.2.txt

VSTSBuild/buildinstaller.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
rm -f /tmp.7z
33
USERPROFILE=/c/GitBuildOutput
44
export USERPROFILE
5-
/usr/src/build-extra/installer/release.sh 2.10.1-gvfs
5+
/usr/src/build-extra/installer/release.sh 2.10.1.2-gvfs
66

77
HOME=/c/GitBuildOutput
88
export HOME
9-
/usr/src/build-extra/portable/release.sh 2.10.1-gvfs
9+
/usr/src/build-extra/portable/release.sh 2.10.1.2-gvfs

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
21112111
unsigned largest_score = 0;
21122112
struct blame_entry *e;
21132113
int compute_auto_abbrev = (abbrev < 0);
2114-
int auto_abbrev = default_abbrev;
2114+
int auto_abbrev = DEFAULT_ABBREV;
21152115

21162116
for (e = sb->ent; e; e = e->next) {
21172117
struct origin *suspect = e->suspect;

builtin/mv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const char **internal_copy_pathspec(const char *prefix,
2626
int i;
2727
const char **result;
2828
ALLOC_ARRAY(result, count + 1);
29-
memcpy(result, pathspec, count * sizeof(const char *));
29+
COPY_ARRAY(result, pathspec, count);
3030
result[count] = NULL;
3131
for (i = 0; i < count; i++) {
3232
int length = strlen(result[i]);

builtin/reset.c

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
#include "parse-options.h"
2222
#include "unpack-trees.h"
2323
#include "cache-tree.h"
24+
#include "strbuf.h"
25+
#include "quote.h"
2426

2527
static const char * const git_reset_usage[] = {
2628
N_("git reset [--mixed | --soft | --hard | --merge | --keep] [-q] [<commit>]"),
27-
N_("git reset [-q] <tree-ish> [--] <paths>..."),
29+
N_("git reset [-q] [<tree-ish>] [--] <paths>..."),
30+
N_("EXPERIMENTAL: git reset [-q] [--stdin [-z]] [<tree-ish>]"),
2831
N_("git reset --patch [<tree-ish>] [--] [<paths>...]"),
2932
NULL
3033
};
@@ -267,7 +270,9 @@ static int reset_refs(const char *rev, const unsigned char *sha1)
267270
int cmd_reset(int argc, const char **argv, const char *prefix)
268271
{
269272
int reset_type = NONE, update_ref_status = 0, quiet = 0;
270-
int patch_mode = 0, unborn;
273+
int patch_mode = 0, nul_term_line = 0, read_from_stdin = 0, unborn;
274+
char **stdin_paths = NULL;
275+
int stdin_nr = 0, stdin_alloc = 0;
271276
const char *rev;
272277
struct object_id oid;
273278
struct pathspec pathspec;
@@ -286,6 +291,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
286291
OPT_BOOL('p', "patch", &patch_mode, N_("select hunks interactively")),
287292
OPT_BOOL('N', "intent-to-add", &intent_to_add,
288293
N_("record only the fact that removed paths will be added later")),
294+
OPT_BOOL('z', NULL, &nul_term_line,
295+
N_("EXPERIMENTAL: paths are separated with NUL character")),
296+
OPT_BOOL(0, "stdin", &read_from_stdin,
297+
N_("EXPERIMENTAL: read paths from <stdin>")),
289298
OPT_END()
290299
};
291300

@@ -295,6 +304,43 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
295304
PARSE_OPT_KEEP_DASHDASH);
296305
parse_args(&pathspec, argv, prefix, patch_mode, &rev);
297306

307+
if (read_from_stdin) {
308+
strbuf_getline_fn getline_fn = nul_term_line ?
309+
strbuf_getline_nul : strbuf_getline_lf;
310+
int flags = PATHSPEC_PREFER_FULL |
311+
PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP;
312+
struct strbuf buf = STRBUF_INIT;
313+
struct strbuf unquoted = STRBUF_INIT;
314+
315+
if (patch_mode)
316+
die(_("--stdin is incompatible with --patch"));
317+
318+
if (pathspec.nr)
319+
die(_("--stdin is incompatible with path arguments"));
320+
321+
while (getline_fn(&buf, stdin) != EOF) {
322+
if (!nul_term_line && buf.buf[0] == '"') {
323+
strbuf_reset(&unquoted);
324+
if (unquote_c_style(&unquoted, buf.buf, NULL))
325+
die(_("line is badly quoted"));
326+
strbuf_swap(&buf, &unquoted);
327+
}
328+
ALLOC_GROW(stdin_paths, stdin_nr + 1, stdin_alloc);
329+
stdin_paths[stdin_nr++] = xstrdup(buf.buf);
330+
strbuf_reset(&buf);
331+
}
332+
strbuf_release(&unquoted);
333+
strbuf_release(&buf);
334+
335+
ALLOC_GROW(stdin_paths, stdin_nr + 1, stdin_alloc);
336+
stdin_paths[stdin_nr++] = NULL;
337+
flags |= PATHSPEC_LITERAL_PATH;
338+
parse_pathspec(&pathspec, 0, flags, prefix,
339+
(const char **)stdin_paths);
340+
341+
} else if (nul_term_line)
342+
die(_("-z requires --stdin"));
343+
298344
unborn = !strcmp(rev, "HEAD") && get_sha1("HEAD", oid.hash);
299345
if (unborn) {
300346
/* reset on unborn branch: treat as reset to empty tree */
@@ -385,5 +431,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
385431
if (!pathspec.nr)
386432
remove_branch_state();
387433

434+
if (stdin_paths) {
435+
while (stdin_nr)
436+
free(stdin_paths[--stdin_nr]);
437+
free(stdin_paths);
438+
}
439+
388440
return update_ref_status;
389441
}

builtin/worktree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,8 @@ int cmd_worktree(int ac, const char **av, const char *prefix)
528528
OPT_END()
529529
};
530530

531+
git_config(git_default_config, NULL);
532+
531533
if (ac < 2)
532534
usage_with_options(worktree_usage, options);
533535
if (!prefix)

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ static int remove_redundant(struct commit **array, int cnt)
931931
}
932932

933933
/* Now collect the result */
934-
memcpy(work, array, sizeof(*array) * cnt);
934+
COPY_ARRAY(work, array, cnt);
935935
for (i = filled = 0; i < cnt; i++)
936936
if (!redundant[i])
937937
array[filled++] = work[i];

config.mak.uname

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
558558
OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
559559
NO_REGEX = YesPlease
560560
NO_PYTHON = YesPlease
561-
BLK_SHA1 = YesPlease
562561
ETAGS_TARGET = ETAGS
563562
NO_INET_PTON = YesPlease
564563
NO_INET_NTOP = YesPlease

contrib/coccinelle/array.cocci

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@@
2+
type T;
3+
T *dst;
4+
T *src;
5+
expression n;
6+
@@
7+
- memcpy(dst, src, n * sizeof(*dst));
8+
+ COPY_ARRAY(dst, src, n);
9+
10+
@@
11+
type T;
12+
T *dst;
13+
T *src;
14+
expression n;
15+
@@
16+
- memcpy(dst, src, n * sizeof(*src));
17+
+ COPY_ARRAY(dst, src, n);
18+
19+
@@
20+
type T;
21+
T *dst;
22+
T *src;
23+
expression n;
24+
@@
25+
- memcpy(dst, src, n * sizeof(T));
26+
+ COPY_ARRAY(dst, src, n);

git-compat-util.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,14 @@ extern FILE *fopen_for_writing(const char *path);
821821
#define ALLOC_ARRAY(x, alloc) (x) = xmalloc(st_mult(sizeof(*(x)), (alloc)))
822822
#define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), st_mult(sizeof(*(x)), (alloc)))
823823

824+
#define COPY_ARRAY(dst, src, n) copy_array((dst), (src), (n), sizeof(*(dst)) + \
825+
BUILD_ASSERT_OR_ZERO(sizeof(*(dst)) == sizeof(*(src))))
826+
static inline void copy_array(void *dst, const void *src, size_t n, size_t size)
827+
{
828+
if (n)
829+
memcpy(dst, src, st_mult(size, n));
830+
}
831+
824832
/*
825833
* These functions help you allocate structs with flex arrays, and copy
826834
* the data directly into the array. For example, if you had:

git-gui/lib/merge.tcl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,7 @@ method _start {} {
112112
close $fh
113113
set _last_merged_branch $branch
114114

115-
set cmd [list git]
116-
lappend cmd merge
117-
lappend cmd --strategy=recursive
118-
lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
119-
lappend cmd HEAD
120-
lappend cmd $name
115+
set cmd [list git merge --strategy=recursive FETCH_HEAD]
121116

122117
ui_status [mc "Merging %s and %s..." $current_branch $stitle]
123118
set cons [console::new [mc "Merge"] "merge $stitle"]

graph.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ int graph_next_line(struct git_graph *graph, struct strbuf *sb)
11451145
static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
11461146
{
11471147
int i;
1148+
int chars_written = 0;
11481149

11491150
if (graph->state != GRAPH_COMMIT) {
11501151
graph_next_line(graph, sb);
@@ -1160,14 +1161,21 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb)
11601161
*/
11611162
for (i = 0; i < graph->num_columns; i++) {
11621163
struct column *col = &graph->columns[i];
1164+
11631165
strbuf_write_column(sb, col, '|');
1164-
if (col->commit == graph->commit && graph->num_parents > 2)
1165-
strbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2);
1166-
else
1166+
chars_written++;
1167+
1168+
if (col->commit == graph->commit && graph->num_parents > 2) {
1169+
int len = (graph->num_parents - 2) * 2;
1170+
strbuf_addchars(sb, ' ', len);
1171+
chars_written += len;
1172+
} else {
11671173
strbuf_addch(sb, ' ');
1174+
chars_written++;
1175+
}
11681176
}
11691177

1170-
graph_pad_horizontally(graph, sb, graph->num_columns);
1178+
graph_pad_horizontally(graph, sb, chars_written);
11711179

11721180
/*
11731181
* Update graph->prev_state since we have output a padding line

0 commit comments

Comments
 (0)