Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync #7

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
462b4e8
symlinks: update comment on threaded_check_leading_path()
matheustavares Mar 18, 2021
fab78a0
checkout: don't follow symlinks when removing entries
matheustavares Mar 18, 2021
6534d43
INSTALL: note on using Asciidoctor to build doc
bagasme Mar 19, 2021
dcc0a86
show tests: add test for "git show <tree>"
avar Mar 20, 2021
8de7821
ls-files tests: add meaningful --with-tree tests
avar Mar 20, 2021
eefadd1
tree.c API: move read_tree() into builtin/ls-files.c
avar Mar 20, 2021
fcc7c12
ls-files: don't needlessly pass around stage variable
avar Mar 20, 2021
9614ad3
ls-files: refactor away read_tree()
avar Mar 20, 2021
7367d88
archive: stop passing "stage" through read_tree_recursive()
avar Mar 20, 2021
6c9fc42
tree.h API: expose read_tree_1() as read_tree_at()
avar Mar 20, 2021
4795748
tree.h API: simplify read_tree_recursive() signature
avar Mar 20, 2021
271cb30
diff --no-index tests: add test for --exit-code
avar Mar 21, 2021
1b0d954
remote-curl: fall back to basic auth if Negotiate fails
chschenk Mar 22, 2021
2be927f
diff --no-index tests: test mode normalization
avar Mar 21, 2021
9bcde4d
rebase: remove transitory rebase.useBuiltin setting & env
avar Mar 23, 2021
c824393
git-send-email: Respect core.hooksPath setting
robertfoss Mar 23, 2021
76593c0
mktag tests: fix broken "&&" chain
avar Mar 24, 2021
28e29ee
format-patch: give an overview of what a "patch" message is
gitster Mar 24, 2021
bf12013
pack-objects: fix comment of reused_chunk.difference
chiyutianyi Mar 23, 2021
9210c68
Merge branch 'mt/checkout-remove-nofollow'
gitster Mar 30, 2021
aab55b1
Merge branch 'bs/asciidoctor-installation-hints'
gitster Mar 30, 2021
ad16f74
Merge branch 'ab/read-tree'
gitster Mar 30, 2021
b2309ad
Merge branch 'ab/diff-no-index-tests'
gitster Mar 30, 2021
5013802
Merge branch 'cs/http-use-basic-after-failed-negotiate'
gitster Mar 30, 2021
dc2a073
Merge branch 'ab/remove-rebase-usebuiltin'
gitster Mar 30, 2021
1ba947c
Merge branch 'rf/send-email-hookspath'
gitster Mar 30, 2021
4730c5e
Merge branch 'hx/pack-objects-chunk-comment'
gitster Mar 30, 2021
7652ce9
Merge branch 'ab/detox-gettext-tests'
gitster Mar 30, 2021
5c2f7ff
Merge branch 'jc/doc-format-patch-clarify'
gitster Mar 30, 2021
a65ce7f
The fifth batch
gitster Mar 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 17 additions & 12 deletions Documentation/RelNotes/2.32.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ UI, Workflows & Features
tweak both the message and the contents, and only the message,
respectively.

* When accessing a server with a URL like https://user:pass@site/, we
did not to fall back to the basic authentication with the
credential material embedded in the URL after the "Negotiate"
authentication failed. Now we do.

* "git send-email" learned to honor the core.hooksPath configuration.


Performance, Internal Implementation, Development Support etc.

Expand All @@ -66,29 +73,22 @@ Fixes since v2.31
* The fsmonitor interface read from its input without making sure
there is something to read from. This bug is new in 2.31
timeframe.
(merge 097ea2c848 jh/fsmonitor-prework later to maint).

* The data structure used by fsmonitor interface was not properly
duplicated during an in-core merge, leading to use-after-free etc.
(merge 4abc57848d js/fsmonitor-unpack-fix later to maint).

* "git bisect" reimplemented more in C during 2.30 timeframe did not
take an annotated tag as a good/bad endpoint well. This regression
has been corrected.
(merge 7730f85594 jk/bisect-peel-tag-fix later to maint).

* Fix macros that can silently inject unintended null-statements.
(merge 116affac3f rs/avoid-null-statement-after-macro-call later to maint).

* CALLOC_ARRAY() macro replaces many uses of xcalloc().
(merge 1c57cc70ec rs/calloc-array later to maint).

* Update insn in Makefile comments to run fuzz-all target.
(merge 68b5c3aa48 ah/make-fuzz-all-doc-update later to maint).

* Fix a corner case bug in "git mv" on case insensitive systems,
which was introduced in 2.29 timeframe.
(merge 93c3d297b5 tb/git-mv-icase-fix later to maint).

* We had a code to diagnose and die cleanly when a required
clean/smudge filter is missing, but an assert before that
Expand All @@ -115,15 +115,20 @@ Fixes since v2.31
which has been corrected.
(merge 75555676ad bc/clone-bare-with-conflicting-config later to maint).

* When "git checkout" removes a path that does not exist in the
commit it is checking out, it wasn't careful enough not to follow
symbolic links, which has been corrected.
(merge fab78a0c3d mt/checkout-remove-nofollow later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 486f4bd183 jc/calloc-fix later to maint).
(merge 5f70859c15 jt/clone-unborn-head later to maint).
(merge cfd409ed09 km/config-doc-typofix later to maint).
(merge 8588aa8657 jk/slimmed-down later to maint).
(merge 241b5d3ebe rs/xcalloc-takes-nelem-first later to maint).
(merge f451960708 dl/cat-file-doc-cleanup later to maint).
(merge 12604a8d0c sv/t9801-test-path-is-file-cleanup later to maint).
(merge ea7e63921c jr/doc-ignore-typofix later to maint).
(merge 23c781f173 ps/update-ref-trans-hook-doc later to maint).
(merge 42efa1231a jk/filter-branch-sha256 later to maint).
(merge 4c8e3dca6e tb/push-simple-uses-branch-merge-config later to maint).
(merge 6534d436a2 bs/asciidoctor-installation-hints later to maint).
(merge 47957485b3 ab/read-tree later to maint).
(merge 2be927f3d1 ab/diff-no-index-tests later to maint).
(merge 76593c09bb ab/detox-gettext-tests later to maint).
(merge 28e29ee38b jc/doc-format-patch-clarify later to maint).
7 changes: 0 additions & 7 deletions Documentation/config/rebase.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
rebase.useBuiltin::
Unused configuration variable. Used in Git versions 2.20 and
2.21 as an escape hatch to enable the legacy shellscript
implementation of rebase. Now the built-in rewrite of it in C
is always used. Setting this will emit a warning, to alert any
remaining users that setting this now does nothing.

rebase.backend::
Default backend to use for rebasing. Possible choices are
'apply' or 'merge'. In the future, if the merge backend gains
Expand Down
21 changes: 19 additions & 2 deletions Documentation/git-format-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,28 @@ SYNOPSIS
DESCRIPTION
-----------

Prepare each commit with its patch in
one file per commit, formatted to resemble UNIX mailbox format.
Prepare each commit with its "patch" in
one "message" per commit, formatted to resemble a UNIX mailbox.
The output of this command is convenient for e-mail submission or
for use with 'git am'.

A "message" generated by the command consists of three parts:

* A brief metadata header that begins with `From <commit>`
with a fixed `Mon Sep 17 00:00:00 2001` datestamp to help programs
like "file(1)" to recognize that the file is an output from this
command, fields that record the author identity, the author date,
and the title of the change (taken from the first paragraph of the
commit log message).

* The second and subsequent paragraphs of the commit log message.

* The "patch", which is the "diff -p --stat" output (see
linkgit:git-diff[1]) between the commit and its parent.

The log message and the patch is separated by a line with a
three-dash line.

There are two ways to specify which commits to operate on.

1. A single commit, <since>, specifies that the commits leading
Expand Down
4 changes: 3 additions & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ Issues of note:
Building and installing the pdf file additionally requires
dblatex. Version >= 0.2.7 is known to work.

All formats require at least asciidoc 8.4.1.
All formats require at least asciidoc 8.4.1. Alternatively, you can
use Asciidoctor (requires Ruby) by passing USE_ASCIIDOCTOR=YesPlease
to make. You need at least Asciidoctor version 1.5.

There are also "make quick-install-doc", "make quick-install-man"
and "make quick-install-html" which install preformatted man pages
Expand Down
30 changes: 14 additions & 16 deletions archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ struct directory {
struct object_id oid;
int baselen, len;
unsigned mode;
int stage;
char path[FLEX_ARRAY];
};

Expand Down Expand Up @@ -135,7 +134,7 @@ static int check_attr_export_subst(const struct attr_check *check)
}

static int write_archive_entry(const struct object_id *oid, const char *base,
int baselen, const char *filename, unsigned mode, int stage,
int baselen, const char *filename, unsigned mode,
void *context)
{
static struct strbuf path = STRBUF_INIT;
Expand Down Expand Up @@ -194,15 +193,14 @@ static int write_archive_entry(const struct object_id *oid, const char *base,

static void queue_directory(const unsigned char *sha1,
struct strbuf *base, const char *filename,
unsigned mode, int stage, struct archiver_context *c)
unsigned mode, struct archiver_context *c)
{
struct directory *d;
size_t len = st_add4(base->len, 1, strlen(filename), 1);
d = xmalloc(st_add(sizeof(*d), len));
d->up = c->bottom;
d->baselen = base->len;
d->mode = mode;
d->stage = stage;
c->bottom = d;
d->len = xsnprintf(d->path, len, "%.*s%s/", (int)base->len, base->buf, filename);
hashcpy(d->oid.hash, sha1);
Expand All @@ -221,14 +219,14 @@ static int write_directory(struct archiver_context *c)
write_directory(c) ||
write_archive_entry(&d->oid, d->path, d->baselen,
d->path + d->baselen, d->mode,
d->stage, c) != READ_TREE_RECURSIVE;
c) != READ_TREE_RECURSIVE;
free(d);
return ret ? -1 : 0;
}

static int queue_or_write_archive_entry(const struct object_id *oid,
struct strbuf *base, const char *filename,
unsigned mode, int stage, void *context)
unsigned mode, void *context)
{
struct archiver_context *c = context;

Expand All @@ -253,14 +251,14 @@ static int queue_or_write_archive_entry(const struct object_id *oid,
if (check_attr_export_ignore(check))
return 0;
queue_directory(oid->hash, base, filename,
mode, stage, c);
mode, c);
return READ_TREE_RECURSIVE;
}

if (write_directory(c))
return -1;
return write_archive_entry(oid, base->buf, base->len, filename, mode,
stage, context);
context);
}

struct extra_file_info {
Expand Down Expand Up @@ -313,10 +311,10 @@ int write_archive_entries(struct archiver_args *args,
git_attr_set_direction(GIT_ATTR_INDEX);
}

err = read_tree_recursive(args->repo, args->tree, "",
0, 0, &args->pathspec,
queue_or_write_archive_entry,
&context);
err = read_tree(args->repo, args->tree,
&args->pathspec,
queue_or_write_archive_entry,
&context);
if (err == READ_TREE_RECURSIVE)
err = 0;
while (context.bottom) {
Expand Down Expand Up @@ -375,7 +373,7 @@ struct path_exists_context {

static int reject_entry(const struct object_id *oid, struct strbuf *base,
const char *filename, unsigned mode,
int stage, void *context)
void *context)
{
int ret = -1;
struct path_exists_context *ctx = context;
Expand All @@ -402,9 +400,9 @@ static int path_exists(struct archiver_args *args, const char *path)
ctx.args = args;
parse_pathspec(&ctx.pathspec, 0, 0, "", paths);
ctx.pathspec.recursive = 1;
ret = read_tree_recursive(args->repo, args->tree, "",
0, 0, &ctx.pathspec,
reject_entry, &ctx);
ret = read_tree(args->repo, args->tree,
&ctx.pathspec,
reject_entry, &ctx);
clear_pathspec(&ctx.pathspec);
return ret != 0;
}
Expand Down
8 changes: 4 additions & 4 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int post_checkout_hook(struct commit *old_commit, struct commit *new_comm
}

static int update_some(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *context)
const char *pathname, unsigned mode, void *context)
{
int len;
struct cache_entry *ce;
Expand Down Expand Up @@ -155,8 +155,8 @@ static int update_some(const struct object_id *oid, struct strbuf *base,

static int read_tree_some(struct tree *tree, const struct pathspec *pathspec)
{
read_tree_recursive(the_repository, tree, "", 0, 0,
pathspec, update_some, NULL);
read_tree(the_repository, tree,
pathspec, update_some, NULL);

/* update the index with the given tree's info
* for all args, expanding wildcards, and exit
Expand Down Expand Up @@ -322,7 +322,7 @@ static void mark_ce_for_checkout_overlay(struct cache_entry *ce,
* If it comes from the tree-ish, we already know it
* matches the pathspec and could just stamp
* CE_MATCHED to it from update_some(). But we still
* need ps_matched and read_tree_recursive (and
* need ps_matched and read_tree (and
* eventually tree_entry_interesting) cannot fill
* ps_matched yet. Once it can, we can avoid calling
* match_pathspec() for _all_ entries when
Expand Down
8 changes: 4 additions & 4 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)

static int show_tree_object(const struct object_id *oid,
struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *context)
const char *pathname, unsigned mode, void *context)
{
FILE *file = context;
fprintf(file, "%s%s\n", pathname, S_ISDIR(mode) ? "/" : "");
Expand Down Expand Up @@ -681,9 +681,9 @@ int cmd_show(int argc, const char **argv, const char *prefix)
diff_get_color_opt(&rev.diffopt, DIFF_COMMIT),
name,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
read_tree_recursive(the_repository, (struct tree *)o, "",
0, 0, &match_all, show_tree_object,
rev.diffopt.file);
read_tree(the_repository, (struct tree *)o,
&match_all, show_tree_object,
rev.diffopt.file);
rev.shown_one = 1;
break;
case OBJ_COMMIT:
Expand Down
75 changes: 74 additions & 1 deletion builtin/ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "dir.h"
#include "builtin.h"
#include "tree.h"
#include "cache-tree.h"
#include "parse-options.h"
#include "resolve-undo.h"
#include "string-list.h"
Expand Down Expand Up @@ -420,6 +421,53 @@ static int get_common_prefix_len(const char *common_prefix)
return common_prefix_len;
}

static int read_one_entry_opt(struct index_state *istate,
const struct object_id *oid,
struct strbuf *base,
const char *pathname,
unsigned mode, int opt)
{
int len;
struct cache_entry *ce;

if (S_ISDIR(mode))
return READ_TREE_RECURSIVE;

len = strlen(pathname);
ce = make_empty_cache_entry(istate, base->len + len);

ce->ce_mode = create_ce_mode(mode);
ce->ce_flags = create_ce_flags(1);
ce->ce_namelen = base->len + len;
memcpy(ce->name, base->buf, base->len);
memcpy(ce->name + base->len, pathname, len+1);
oidcpy(&ce->oid, oid);
return add_index_entry(istate, ce, opt);
}

static int read_one_entry(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{
struct index_state *istate = context;
return read_one_entry_opt(istate, oid, base, pathname,
mode,
ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DFCHECK);
}

/*
* This is used when the caller knows there is no existing entries at
* the stage that will conflict with the entry being added.
*/
static int read_one_entry_quick(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
{
struct index_state *istate = context;
return read_one_entry_opt(istate, oid, base, pathname,
mode, ADD_CACHE_JUST_APPEND);
}

/*
* Read the tree specified with --with-tree option
* (typically, HEAD) into stage #1 and then
Expand All @@ -436,6 +484,8 @@ void overlay_tree_on_index(struct index_state *istate,
struct pathspec pathspec;
struct cache_entry *last_stage0 = NULL;
int i;
read_tree_fn_t fn = NULL;
int err;

if (get_oid(tree_name, &oid))
die("tree-ish %s not found.", tree_name);
Expand All @@ -458,9 +508,32 @@ void overlay_tree_on_index(struct index_state *istate,
PATHSPEC_PREFER_CWD, prefix, matchbuf);
} else
memset(&pathspec, 0, sizeof(pathspec));
if (read_tree(the_repository, tree, 1, &pathspec, istate))

/*
* See if we have cache entry at the stage. If so,
* do it the original slow way, otherwise, append and then
* sort at the end.
*/
for (i = 0; !fn && i < istate->cache_nr; i++) {
const struct cache_entry *ce = istate->cache[i];
if (ce_stage(ce) == 1)
fn = read_one_entry;
}

if (!fn)
fn = read_one_entry_quick;
err = read_tree(the_repository, tree, &pathspec, fn, istate);
if (err)
die("unable to read tree entries %s", tree_name);

/*
* Sort the cache entry -- we need to nuke the cache tree, though.
*/
if (fn == read_one_entry_quick) {
cache_tree_free(&istate->cache_tree);
QSORT(istate->cache, istate->cache_nr, cmp_cache_name_compare);
}

for (i = 0; i < istate->cache_nr; i++) {
struct cache_entry *ce = istate->cache[i];
switch (ce_stage(ce)) {
Expand Down