Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
3b54f67
MyFirstContribution: mention trimming quoted text in replies
bertyuan Jun 11, 2026
5abac96
environment: move ignore_case into repo_config_values
malon7782 Jun 19, 2026
e6a79c9
config: use repo_ignore_case() to access core.ignorecase
malon7782 Jun 19, 2026
18cf52c
t6600: add test for merge-base early exit with clock skew
spkrka Jun 29, 2026
ae68032
commit-reach: guard !FIND_ALL early exit with generation ordering check
spkrka Jun 29, 2026
59fb29c
Merge branch 'ps/refs-onbranch-fixes' into ps/setup-split-discovery-a…
gitster Jun 30, 2026
4f71cef
Merge branch 'ps/setup-drop-global-state' into ps/setup-split-discove…
gitster Jun 30, 2026
cd4c25d
Merge branch 'jk/repo-info-path-keys' into ps/setup-split-discovery-a…
gitster Jun 30, 2026
8fed3ac
meson: support building fuzzers with libFuzzer
pks-t Jul 3, 2026
adf4516
oss-fuzz: add fuzzer for parsing reftables
pks-t Jul 3, 2026
657654b
reftable/basics: fix OOB read on binary search of empty range
pks-t Jul 3, 2026
ed103ab
reftable/record: don't abort when decoding invalid ref value type
pks-t Jul 3, 2026
a0eb4ca
t/unit-tests: introduce test helper to write reftable blocks
pks-t Jul 3, 2026
6914a9a
reftable/block: fix OOB write with bogus inflated log size
pks-t Jul 3, 2026
43a0669
reftable/block: fix OOB read with bogus block size
pks-t Jul 3, 2026
0d77a81
reftable/block: fix OOB read with bogus restart count
pks-t Jul 3, 2026
986590f
reftable/block: fix use of uninitialized memory when binsearch fails
pks-t Jul 3, 2026
ec42676
reftable/block: fix OOB read with bogus restart offset
pks-t Jul 3, 2026
a1c085d
reftable/table: fix NULL pointer access when seeking to bogus offsets
pks-t Jul 3, 2026
ca93c27
reftable/table: fix OOB read on truncated table
pks-t Jul 3, 2026
afd278b
t/README: document test_grep helper
mmontalbo Jul 6, 2026
04e875a
t: fix grep assertions missing file arguments
mmontalbo Jul 6, 2026
c451e96
t: extract chainlint's parser into shared module
mmontalbo Jul 6, 2026
4f8f121
t: fix Lexer line count for $() inside double-quoted strings
mmontalbo Jul 6, 2026
47f79f6
t: convert grep assertions to test_grep
mmontalbo Jul 6, 2026
be7112d
t: add greplint to detect bare grep assertions
mmontalbo Jul 6, 2026
9ca3ea9
setup: rename `check_repository_format_gently()`
pks-t Jul 7, 2026
c679995
setup: mark bogus worktree in `apply_repository_format()`
pks-t Jul 7, 2026
d43b9ac
setup: unify setup of shallow file
pks-t Jul 7, 2026
cf1687a
setup: split up concerns of `setup_git_env_internal()`
pks-t Jul 7, 2026
d66975f
setup: introduce explicit repository discovery
pks-t Jul 7, 2026
abe8941
setup: embed repository format in discovery
pks-t Jul 7, 2026
b964ad1
setup: move prefix into repository
pks-t Jul 7, 2026
28f38f3
setup: drop static `cwd` variable
pks-t Jul 7, 2026
0bf8e14
setup: propagate prefix via repository discovery
pks-t Jul 7, 2026
2513a4d
setup: make repository discovery self-contained
pks-t Jul 7, 2026
eba53f5
setup: drop redundant configuration of `startup_info->have_repository`
pks-t Jul 7, 2026
293b785
setup: pass worktree to `init_db()`
pks-t Jul 7, 2026
4df38c6
setup: mark `set_git_work_tree()` as file-local
pks-t Jul 7, 2026
18b2009
Rust: fix description in Release Notes to 2.55
gitster Jul 7, 2026
5df632c
t1517: skip svn tests if svn is not installed
bk2204 Jul 8, 2026
154aee0
parse-options: add a separate case for help output on error
bk2204 Jul 8, 2026
06f9b95
rev-parse: have --parseopt callers exit 0 on --help
bk2204 Jul 8, 2026
cdaf12f
parse-options: exit 0 on -h
bk2204 Jul 8, 2026
87bd9bd
Makefile: add $(RUST_LIB) prerequisite to osxkeychain
Jul 8, 2026
924dfce
Makefile: support universal macOS builds via RUST_TARGETS
Jul 8, 2026
1a62c1f
contrib: wire up osxkeychain in contrib/Makefile on macOS
Jul 8, 2026
e74c698
SubmittingPatches: document how to retract a topic
gitster Jul 8, 2026
8585c50
bundle-uri: drain remaining response on invalid bundle-uri lines
To1ne Jul 8, 2026
50de116
bundle-uri: stop sending invalid bundle configuration
jltobler Jul 8, 2026
7167667
unpack-trees: avoid quadratic index scan in next_cache_entry()
hferreiro Jul 8, 2026
c4fcd50
t1410-reflog.sh: avoid suppressing git's exit code in pipelines
Jul 9, 2026
02d62c3
commit-graph: add trace2 instrumentation for generation DFS
spkrka Jul 9, 2026
8ea36f6
commit-graph: propagate topo_levels slab to all chain layers
spkrka Jul 9, 2026
a6b8f01
diffcore-break: guard against NULLed queue entries in merge loop
dscho Jul 10, 2026
d07d09e
diff: handle NULL return from repo_get_commit_tree()
dscho Jul 10, 2026
2fdcce1
remote: guard `remote_tracking()` against NULL remote
dscho Jul 10, 2026
d321f42
reftable/stack: guard against NULL list_file in stack_destroy
dscho Jul 10, 2026
775f1f2
mailsplit: move NULL check before first use of file handle
dscho Jul 10, 2026
74fb188
bisect: handle NULL commit in `bisect_successful()`
dscho Jul 10, 2026
e87d701
replay: die when --onto does not peel to a commit
dscho Jul 10, 2026
f5887e1
revision: avoid dereferencing NULL in `add_parents_only()`
dscho Jul 10, 2026
436ef7c
pack-bitmap: handle missing bitmap for base MIDX
dscho Jul 10, 2026
7384654
bisect: ensure non-NULL `head` before using it
dscho Jul 10, 2026
83e717e
shallow: fix NULL dereference
dscho Jul 10, 2026
7642553
shallow: give write_one_shallow() its own hex buffer
dscho Jul 10, 2026
13d8160
t/perf: add perf test for ref tombstone scenarios
spkrka Jul 10, 2026
146a946
reftable: fix quadratic behavior in the presence of tombstones
spkrka Jul 10, 2026
65f37b6
Merge branch 'ps/reftable-hardening'
gitster Jul 19, 2026
2688b28
Merge branch 'ps/setup-split-discovery-and-setup'
gitster Jul 19, 2026
a6d1c35
Merge branch 'jc/relnotes-2.55-rust-fix'
gitster Jul 19, 2026
1950f46
Merge branch 'kk/commit-reach-find-all-fix'
gitster Jul 19, 2026
de46554
Merge branch 'jc/submitting-patches-abandoning'
gitster Jul 19, 2026
620657c
Merge branch 'bc/parse-options-exit-0-on-help'
gitster Jul 19, 2026
f8ec2c6
Merge branch 'sn/osxkeychain-rust-universal'
gitster Jul 19, 2026
c9a92e2
Merge branch 'mm/test-grep-lint'
gitster Jul 19, 2026
009713e
Merge branch 'gr/t1410-reflog-exit-code'
gitster Jul 19, 2026
1c103a8
Merge branch 'wy/doc-myfirstcontribution-trim-quotes'
gitster Jul 19, 2026
cae7c86
Merge branch 'hf/unpack-trees-quadratic-scan'
gitster Jul 19, 2026
f590fcd
Merge branch 'tc/bundle-uri-empty-fix'
gitster Jul 19, 2026
a336bfa
Merge branch 'ty/migrate-ignorecase'
gitster Jul 19, 2026
82c60a8
Merge branch 'kk/commit-graph-topo-levels-fix'
gitster Jul 19, 2026
cc82eaf
Merge branch 'kk/reftable-tombstone-quadratic-fix'
gitster Jul 19, 2026
0b75ef5
Merge branch 'js/coverity-fixes-null-safety'
gitster Jul 19, 2026
48bbf81
The 5th batch
gitster Jul 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions Documentation/MyFirstContribution.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,11 @@ effect which had not occurred to you. It is always okay to ask for clarification
if you aren't sure why a change was suggested, or what the reviewer is asking
you to do.

When replying to review comments, quote only the parts of the message that are
relevant to your response. It is usually helpful to trim away unrelated context,
such as large portions of the patch that are not being discussed, while keeping
enough quoted text for readers to understand what you are responding to.

Make sure your email client has a plaintext email mode and it is turned on; the
Git list rejects HTML email. Please also follow the mailing list etiquette
outlined in the
Expand Down
4 changes: 2 additions & 2 deletions Documentation/RelNotes/2.55.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Performance, Internal Implementation, Development Support etc.
* Promisor remote handling has been refactored and fixed in
preparation for auto-configuration of advertised remotes.

* Rust support is enabled by default (but still allows opting out) in
some future version of Git.
* Rust support is enabled by default (but still allows opting out);
in Git version 3.0, Rust will become mandatory.

* Preparation of the xdiff/ codebase to work with Rust.

Expand Down
83 changes: 83 additions & 0 deletions Documentation/RelNotes/2.56.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ UI, Workflows & Features
output has been optimized to reserve a column for marks (caret,
question mark, or asterisk) only when such marks are actually shown.

* Option parsing with 'git rev-parse --parseopt' and in most 'git'
subcommands has been updated to exit with 0 (instead of 129) when the
help option ('-h' or '--help') is requested directly by the user,
aligning with standard Unix convention.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -108,6 +113,56 @@ Performance, Internal Implementation, Development Support etc.
the generated header file 'hook-list.h' is built before compiling
files in 'builtin_sources' that depend on it.

* The repository discovery and repository configuration phases, which
were previously intertwined in 'setup.c', have been split. Repository
discovery has been updated to populate a 'struct repo_discovery'
without modifying the repository state, which is then taken by
repository configuration to initialize the repository, paving the way
for clean unification of repository configuration.

* The 'SubmittingPatches' document has been updated to explicitly
describe the expectation for contributors to retract or abandon their
patch series when they are no longer pursuing it.

* The contributor guide has been updated to advise new contributors to
trim irrelevant quoted text when replying to review comments, matching
the existing advice given to reviewers.

* The build system has been updated to support building universal macOS
binaries when 'Rust' is enabled, by compiling separate static archives
for each target triple listed in 'RUST_TARGETS' and combining them
using the macOS 'lipo' tool. The 'git-credential-osxkeychain' helper
has been updated to link against '$(RUST_LIB)' when 'Rust' is enabled.

* The test suite has been updated to use the 'test_grep' helper instead
of bare 'grep' for test assertions, allowing file contents to be
printed on failure for easier debugging. A new 'greplint' linter has
been introduced to detect and prevent new bare 'grep' assertions from
being added to the test suite.

* The pipelines in 't1410-reflog.sh' have been replaced with the
'test_stdout_line_count' helper to avoid suppressing the exit code of
'git' commands, ensuring failures are not hidden from the test suite.

* The cache-scanning loop in 'next_cache_entry()' has been optimized
to avoid rescanning already-unpacked index entries, preventing a
quadratic performance slow-down when diffing the working tree
against a commit with a pathspec matching early index entries.

* The global configuration variable 'ignore_case' (representing the
'core.ignorecase' configuration) has been migrated into 'struct
repo_config_values' to tie it to a specific repository instance.

* The performance of ref updates and reads using the 'reftable' backend
in the presence of many deletion tombstone records has been optimized
by removing the tombstone suppression flag from the merged iterator
and instead skipping tombstones at higher-level call sites where
iteration bounds are known.

* Various code paths have been hardened against potential NULL-pointer
dereferences and invalid file descriptor accesses flagged by
Coverity.


Fixes since v2.55
-----------------
Expand Down Expand Up @@ -215,3 +270,31 @@ Fixes since v2.55
escape sequences that use colon-separated subfields (e.g., for
256-color or true-color codes).
(merge 3792b2aea4 mm/sideband-ansi-sgr-colon-fix later to maint).

* The 'reftable' code has been hardened against corrupted tables by
fixing out-of-bounds writes, out-of-bounds reads, and abort calls
during parsing.
(merge ca93c27328 ps/reftable-hardening later to maint).

* A description in the release notes for Git 2.55.0 has been
retroactively updated to clarify that Rust support is enabled by
default, but still optional, and will become mandatory in Git 3.0.
(merge 18b2009d14 jc/relnotes-2.55-rust-fix later to maint).

* The early-exit optimization in 'paint_down_to_common()' has been
gated on the queue being generation-ordered, fixing a bug where
'git merge-base' (without '--all') could return incorrect results
on repositories with v1 commit graphs and clock skew.
(merge ae68032a8d kk/commit-reach-find-all-fix later to maint).

* The client-side parser of the server-advertised bundle-URI list has
been updated to drain the remaining response in order to avoid
protocol desynchronization when the server sends a misconfigured list.
Also, the server-side has been taught to omit empty configuration
values instead of sending invalid key-value lines.
(merge 50de1169e4 tc/bundle-uri-empty-fix later to maint).

* The 'topo_levels' slab was propagated only to the topmost layer of a
split commit-graph chain, causing topological levels for commits in
base layers to be recomputed during incremental writes. This has been
corrected.
14 changes: 14 additions & 0 deletions Documentation/SubmittingPatches
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ of review.
top, it gets merged to the 'master' branch and waits to become part
of the next major release.

But sometimes things do not work as planned:

. If a mailing list discussion convinces you that your changes aren't
ideal, please explicitly retract the topic to save the maintainer
time and effort.

. If you must drop a topic due to shifting priorities, lack of time,
or other commitments, notify the list as a courtesy so others can
take over. Anyone can resurrect the topic later when they have the
capacity to do so.

. Topics with unaddressed review comments that remain inactive for
four weeks may be discarded by the maintainer.

In the following sections, many techniques and conventions are listed
to help your patches get reviewed effectively in such a life cycle.

Expand Down
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ include shared.mak
#
# Building Rust code requires Cargo.
#
# Define RUST_TARGETS if you want to cross-compile. If left unspecified, it uses
# the default Rust target on the system.
#
# On macOS, this supports specifying multiple targets, separated by a space.
# This will produce a Universal static library using `lipo`.
#
# Example: RUST_TARGETS="aarch64-apple-darwin x86_64-apple-darwin"
#
# == SHA-1 and SHA-256 defines ==
#
# === SHA-1 backend ===
Expand Down Expand Up @@ -939,16 +947,19 @@ TEST_SHELL_PATH = $(SHELL_PATH)

LIB_FILE = libgit.a

ifndef NO_RUST
ifdef DEBUG
RUST_TARGET_DIR = target/debug
RUST_BUILD_CONFIG = debug
else
RUST_TARGET_DIR = target/release
RUST_BUILD_CONFIG = release
endif

ifeq ($(uname_S),Windows)
RUST_LIB = $(RUST_TARGET_DIR)/gitcore.lib
RUST_LIB_NAME = gitcore.lib
else
RUST_LIB = $(RUST_TARGET_DIR)/libgitcore.a
RUST_LIB_NAME = libgitcore.a
endif
RUST_LIB = target/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME)
endif

GITLIBS = common-main.o $(LIB_FILE)
Expand Down Expand Up @@ -2601,6 +2612,7 @@ FUZZ_OBJS += oss-fuzz/fuzz-date.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-headers.o
FUZZ_OBJS += oss-fuzz/fuzz-pack-idx.o
FUZZ_OBJS += oss-fuzz/fuzz-parse-attr-line.o
FUZZ_OBJS += oss-fuzz/fuzz-reftable.o
FUZZ_OBJS += oss-fuzz/fuzz-url-decode-mem.o
.PHONY: fuzz-objs
fuzz-objs: $(FUZZ_OBJS)
Expand Down Expand Up @@ -3019,11 +3031,35 @@ scalar$X: scalar.o GIT-LDFLAGS $(GITLIBS)
$(LIB_FILE): $(LIB_OBJS)
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^

ifndef NO_RUST
ifeq ($(RUST_TARGETS),)
$(RUST_LIB): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
$(QUIET_CARGO)cargo build $(CARGO_ARGS)
else
ifneq ($(words $(RUST_TARGETS)),1)
ifneq ($(uname_S),Darwin)
$(error Building universal Rust libraries requires macOS (lipo is not available on $(uname_S)))
endif
endif

RUST_MEMBER_LIBS = $(foreach target,$(RUST_TARGETS),target/$(target)/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME))
$(RUST_MEMBER_LIBS): target/%/$(RUST_BUILD_CONFIG)/$(RUST_LIB_NAME): Cargo.toml $(RUST_SOURCES) $(LIB_FILE)
$(QUIET_CARGO)cargo build $(CARGO_ARGS) --target $*

$(RUST_LIB): $(RUST_MEMBER_LIBS)
$(call mkdir_p_parent_template)
$(QUIET_GEN)\
if test $(words $(RUST_TARGETS)) -gt 1; \
then \
lipo -create $^ -output $@; \
else \
cp $< $@; \
fi
endif

.PHONY: rust
rust: $(RUST_LIB)
endif

export DEFAULT_EDITOR DEFAULT_PAGER

Expand Down Expand Up @@ -4074,7 +4110,8 @@ $(LIBGIT_HIDDEN_EXPORT): $(LIBGIT_PARTIAL_EXPORT)
contrib/libgit-sys/libgitpub.a: $(LIBGIT_HIDDEN_EXPORT)
$(AR) $(ARFLAGS) $@ $^

contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) GIT-LDFLAGS
# When Rust is enabled, git-credential-osxkeychain depends on Rust symbols in $(RUST_LIB)
contrib/credential/osxkeychain/git-credential-osxkeychain: contrib/credential/osxkeychain/git-credential-osxkeychain.o $(LIB_FILE) $(RUST_LIB) GIT-LDFLAGS
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) \
$(filter %.o,$^) $(LIBS) -framework Security -framework CoreFoundation

Expand Down
2 changes: 1 addition & 1 deletion apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -4008,7 +4008,7 @@ static int path_is_beyond_symlink_1(struct apply_state *state, struct strbuf *na
struct cache_entry *ce;

ce = index_file_exists(state->repo->index, name->buf,
name->len, ignore_case);
name->len, repo_ignore_case(the_repository));
if (ce && S_ISLNK(ce->ce_mode))
return 1;
} else {
Expand Down
9 changes: 8 additions & 1 deletion builtin/bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ static int bisect_successful(struct bisect_terms *terms)

refs_read_ref(get_main_ref_store(the_repository), bad_ref, &oid);
commit = lookup_commit_reference_by_name(bad_ref);
if (!commit) {
error(_("could not find commit for '%s'"), bad_ref);
free(bad_ref);
return BISECT_FAILED;
}
repo_format_commit_message(the_repository, commit, "%s", &commit_name,
&pp);

Expand Down Expand Up @@ -806,9 +811,11 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
*/
head = refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
"HEAD", 0, &head_oid, &flags);
if (!head)
if (!head) {
if (repo_get_oid(the_repository, "HEAD", &head_oid))
return error(_("bad HEAD - I need a HEAD"));
head = "HEAD";
}

/*
* Check if we are bisecting
Expand Down
2 changes: 2 additions & 0 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,8 @@ int cmd_blame(int argc,
case PARSE_OPT_UNKNOWN:
break;
case PARSE_OPT_HELP:
exit(0);
case PARSE_OPT_HELP_ERROR:
case PARSE_OPT_ERROR:
case PARSE_OPT_SUBCOMMAND:
exit(129);
Expand Down
8 changes: 4 additions & 4 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,6 @@ int cmd_clone(int argc,
die_errno(_("could not create work tree dir '%s'"),
work_tree);
junk_work_tree = work_tree;
set_git_work_tree(the_repository, work_tree);
}

if (real_git_dir) {
Expand Down Expand Up @@ -1186,9 +1185,10 @@ int cmd_clone(int argc,
* repository, and reference backends may persist that information into
* their on-disk data structures.
*/
init_db(the_repository, git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN,
ref_storage_format, NULL,
do_not_override_repo_unix_permissions, INIT_DB_QUIET | INIT_DB_SKIP_REFDB);
init_db(the_repository, git_dir, real_git_dir, work_tree, option_template,
GIT_HASH_UNKNOWN, ref_storage_format, NULL,
do_not_override_repo_unix_permissions,
INIT_DB_QUIET | INIT_DB_SKIP_REFDB);

if (real_git_dir) {
free((char *)git_dir);
Expand Down
10 changes: 7 additions & 3 deletions builtin/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,13 @@ int cmd_diff(int argc,
obj = deref_tag(the_repository, obj, NULL, 0);
if (!obj)
die(_("invalid object '%s' given."), name);
if (obj->type == OBJ_COMMIT)
obj = &repo_get_commit_tree(the_repository,
((struct commit *)obj))->object;
if (obj->type == OBJ_COMMIT) {
struct tree *tree = repo_get_commit_tree(
the_repository, (struct commit *)obj);
if (!tree)
die(_("unable to read tree object for commit '%s'"), name);
obj = &tree->object;
}

if (obj->type == OBJ_TREE) {
if (sdiff.skip && bitmap_get(sdiff.skip, i))
Expand Down
2 changes: 1 addition & 1 deletion builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ static void ref_transaction_rejection_handler(const char *refname,
{
struct ref_rejection_data *data = cb_data;

if (err == REF_TRANSACTION_ERROR_CASE_CONFLICT && ignore_case &&
if (err == REF_TRANSACTION_ERROR_CASE_CONFLICT && repo_ignore_case(the_repository) &&
!data->case_sensitive_msg_shown) {
error(_("You're on a case-insensitive filesystem, and the remote you are\n"
"trying to fetch from has references that only differ in casing. It\n"
Expand Down
34 changes: 10 additions & 24 deletions builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,39 +231,25 @@ int cmd_init_db(int argc,
if (!bare) {
const char *git_dir_parent = strrchr(git_dir, '/');

if (work_tree) {
set_git_work_tree(the_repository, work_tree);
} else {
char *work_tree_cfg = NULL;

if (!work_tree) {
if (git_dir_parent) {
char *rel = xstrndup(git_dir, git_dir_parent - git_dir);
work_tree_cfg = real_pathdup(rel, 1);
work_tree = real_pathdup(rel, 1);
free(rel);
} else {
work_tree = xgetcwd();
}

if (!work_tree_cfg)
work_tree_cfg = xgetcwd();

set_git_work_tree(the_repository, work_tree_cfg);

free(work_tree_cfg);
}

if (access(repo_get_work_tree(the_repository), X_OK))
die_errno (_("Cannot access work tree '%s'"),
repo_get_work_tree(the_repository));
}
else {
if (real_git_dir)
die(_("--separate-git-dir incompatible with bare repository"));
if (work_tree)
set_git_work_tree(the_repository, work_tree);
if (access(work_tree, X_OK))
die_errno (_("Cannot access work tree '%s'"), work_tree);
} else if (real_git_dir) {
die(_("--separate-git-dir incompatible with bare repository"));
}

flags |= INIT_DB_EXIST_OK;
ret = init_db(the_repository, git_dir, real_git_dir, template_dir, hash_algo,
ref_storage_format, initial_branch,
ret = init_db(the_repository, git_dir, real_git_dir, work_tree,
template_dir, hash_algo, ref_storage_format, initial_branch,
init_shared_repository, flags);

free(template_dir_to_free);
Expand Down
6 changes: 3 additions & 3 deletions builtin/mailsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "r");
int file_done = 0;

if (isatty(fileno(f)))
warning(_("reading patches from stdin/tty..."));

if (!f) {
error_errno("cannot open mbox %s", file);
goto out;
}

if (isatty(fileno(f)))
warning(_("reading patches from stdin/tty..."));

do {
peek = fgetc(f);
if (peek == EOF) {
Expand Down
Loading