Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
/git-worktree
/git-write-tree
/git-core-*/?*
/git.res
/gitweb/GITWEB-BUILD-OPTIONS
/gitweb/gitweb.cgi
/gitweb/static/gitweb.js
Expand Down Expand Up @@ -225,7 +226,6 @@
*.hcc
*.obj
*.lib
*.res
*.sln
*.sp
*.suo
Expand Down
34 changes: 34 additions & 0 deletions Documentation/RelNotes/2.38.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ Performance, Internal Implementation, Development Support etc.
* Further preparation to turn git-submodule.sh into a builtin
continues.

* Apply Coccinelle rule to turn raw memmove() into MOVE_ARRAY() cpp
macro, which would improve maintainability and readability.

* Teach "make all" to build gitweb as well.

* Tweak tests so that they still work when the "git init" template
did not create .git/info directory.

* Add Coccinelle rules to detect the pattern of initializing and then
finalizing a structure without using it in between at all, which
happens after code restructuring and the compilers fail to
recognize as an unused variable.

* The code to convert between GPG trust level strings and internal
constants we use to represent them have been cleaned up.

* Support for libnettle as SHA256 implementation has been added.

* The way "git multi-pack" uses parse-options API has been improved.


Fixes since v2.37
-----------------
Expand Down Expand Up @@ -83,6 +103,20 @@ Fixes since v2.37
a repository as its subdirectory, regressed in Git 2.27 days.
(merge d6c9a71755 gg/worktree-from-the-above later to maint).

* Recent update to vimdiff layout code has been made more robust
against different end-user vim settings.
(merge f3d7623a13 fr/vimdiff-layout-fix later to maint).

* Plug various memory leaks.
(merge ece3974ba6 ab/leakfix later to maint).

* Plug various memory leaks in test-tool commands.
(merge f40a693450 ab/test-tool-leakfix later to maint).

* Fixes a long-standing corner case bug around directory renames in
the merge-ort strategy.
(merge 751e165424 en/merge-dual-dir-renames-fix later to maint).

* Other code cleanup, docfix, build fix, etc.
(merge 5fd9d1738e jk/revisions-doc-markup-fix later to maint).
(merge 1971510c35 pb/diff-doc-raw-format later to maint).
Expand Down
69 changes: 56 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ include shared.mak
#
# Define BLK_SHA256 to use the built-in SHA-256 routines.
#
# Define NETTLE_SHA256 to use the SHA-256 routines in libnettle.
#
# Define GCRYPT_SHA256 to use the SHA-256 routines in libgcrypt.
#
# Define OPENSSL_SHA256 to use the SHA-256 routines in OpenSSL.
Expand Down Expand Up @@ -309,6 +311,11 @@ include shared.mak
# distributions that want to use their packaged versions of Perl
# modules, instead of the fallbacks shipped with Git.
#
# Define NO_GITWEB if you do not want to build or install
# 'gitweb'. Note that defining NO_PERL currently has the same effect
# on not installing gitweb, but not on whether it's built in the
# gitweb/ directory.
#
# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
# but /usr/bin/python2.7 or /usr/bin/python3 on some platforms).
#
Expand Down Expand Up @@ -544,6 +551,7 @@ gitexecdir = libexec/git-core
mergetoolsdir = $(gitexecdir)/mergetools
sharedir = $(prefix)/share
gitwebdir = $(sharedir)/gitweb
gitwebstaticdir = $(gitwebdir)/static
perllibdir = $(sharedir)/perl5
localedir = $(sharedir)/locale
template_dir = share/git-core/templates
Expand All @@ -562,7 +570,7 @@ localedir_relative = $(patsubst $(prefix)/%,%,$(localedir))
htmldir_relative = $(patsubst $(prefix)/%,%,$(htmldir))
perllibdir_relative = $(patsubst $(prefix)/%,%,$(perllibdir))

export prefix bindir sharedir sysconfdir gitwebdir perllibdir localedir
export prefix bindir sharedir sysconfdir perllibdir localedir

# Set our default programs
CC = cc
Expand Down Expand Up @@ -1286,7 +1294,7 @@ SANITIZE_ADDRESS =
# For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will
# usually result in less CPU usage at the cost of higher peak memory.
# Setting it to 0 will feed all files in a single spatch invocation.
SPATCH_FLAGS = --all-includes --patch .
SPATCH_FLAGS = --all-includes
SPATCH_BATCH_SIZE = 1

include config.mak.uname
Expand Down Expand Up @@ -1842,6 +1850,10 @@ ifdef OPENSSL_SHA256
EXTLIBS += $(LIB_4_CRYPTO)
BASIC_CFLAGS += -DSHA256_OPENSSL
else
ifdef NETTLE_SHA256
BASIC_CFLAGS += -DSHA256_NETTLE
EXTLIBS += -lnettle
else
ifdef GCRYPT_SHA256
BASIC_CFLAGS += -DSHA256_GCRYPT
EXTLIBS += -lgcrypt
Expand All @@ -1850,6 +1862,7 @@ else
BASIC_CFLAGS += -DSHA256_BLK
endif
endif
endif

ifdef SHA1_MAX_BLOCK_SIZE
LIB_OBJS += compat/sha1-chunked.o
Expand Down Expand Up @@ -2089,6 +2102,7 @@ htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative))
prefix_SQ = $(subst ','\'',$(prefix))
perllibdir_relative_SQ = $(subst ','\'',$(perllibdir_relative))
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
gitwebstaticdir_SQ = $(subst ','\'',$(gitwebstaticdir))

SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
TEST_SHELL_PATH_SQ = $(subst ','\'',$(TEST_SHELL_PATH))
Expand Down Expand Up @@ -2417,10 +2431,6 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
perllibdir:
@echo '$(perllibdir_SQ)'

.PHONY: gitweb
gitweb:
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all

git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
chmod +x $@+ && \
Expand Down Expand Up @@ -3091,6 +3101,9 @@ $(SP_OBJ): %.sp: %.c %.o
sparse: $(SP_OBJ)

EXCEPT_HDRS := $(GENERATED_H) unicode-width.h compat/% xdiff/%
ifndef NETTLE_SHA256
EXCEPT_HDRS += sha256/nettle.h
endif
ifndef GCRYPT_SHA256
EXCEPT_HDRS += sha256/gcrypt.h
endif
Expand Down Expand Up @@ -3123,6 +3136,8 @@ check: $(GENERATED_H)
exit 1; \
fi

COCCI_TEST_RES = $(wildcard contrib/coccinelle/tests/*.res)

%.cocci.patch: %.cocci $(COCCI_SOURCES)
$(QUIET_SPATCH) \
if test $(SPATCH_BATCH_SIZE) = 0; then \
Expand All @@ -3131,7 +3146,8 @@ check: $(GENERATED_H)
limit='-n $(SPATCH_BATCH_SIZE)'; \
fi; \
if ! echo $(COCCI_SOURCES) | xargs $$limit \
$(SPATCH) --sp-file $< $(SPATCH_FLAGS) \
$(SPATCH) $(SPATCH_FLAGS) \
--sp-file $< --patch . \
>$@+ 2>[email protected]; \
then \
cat [email protected]; \
Expand All @@ -3142,13 +3158,43 @@ check: $(GENERATED_H)
then \
echo ' ' SPATCH result: $@; \
fi

COCCI_TEST_RES_GEN = $(addprefix .build/,$(COCCI_TEST_RES))
$(COCCI_TEST_RES_GEN): .build/%.res : %.c
$(COCCI_TEST_RES_GEN): .build/%.res : %.res
$(COCCI_TEST_RES_GEN): .build/contrib/coccinelle/tests/%.res : contrib/coccinelle/%.cocci
$(call mkdir_p_parent_template)
$(QUIET_SPATCH_T)$(SPATCH) $(SPATCH_FLAGS) \
--very-quiet --no-show-diff \
--sp-file $< -o $@ \
$(@:.build/%.res=%.c) && \
cmp $(@:.build/%=%) $@ || \
git -P diff --no-index $(@:.build/%=%) $@ 2>/dev/null; \

.PHONY: coccicheck-test
coccicheck-test: $(COCCI_TEST_RES_GEN)

coccicheck: coccicheck-test
coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/coccinelle/*.cocci)))

# See contrib/coccinelle/README
coccicheck-pending: coccicheck-test
coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))

.PHONY: coccicheck coccicheck-pending

# "Sub"-Makefiles, not really because they can't be run stand-alone,
# only there to contain directory-specific rules and variables
## gitweb/Makefile inclusion:
MAK_DIR_GITWEB = gitweb/
include gitweb/Makefile

.PHONY: gitweb
gitweb: $(MAK_DIR_GITWEB_ALL)
ifndef NO_GITWEB
all:: gitweb
endif

### Installation rules

ifneq ($(filter /%,$(firstword $(template_dir))),)
Expand Down Expand Up @@ -3221,7 +3267,6 @@ ifndef NO_PERL
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
(cd perl/build/lib && $(TAR) cf - .) | \
(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
$(MAKE) -C gitweb install
endif
ifndef NO_TCLTK
$(MAKE) -C gitk-git install
Expand Down Expand Up @@ -3276,10 +3321,8 @@ endif
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
done

.PHONY: install-gitweb install-doc install-man install-man-perl install-html install-info install-pdf
.PHONY: install-doc install-man install-man-perl install-html install-info install-pdf
.PHONY: quick-install-doc quick-install-man quick-install-html
install-gitweb:
$(MAKE) -C gitweb install

install-doc: install-man-perl
$(MAKE) -C Documentation install
Expand Down Expand Up @@ -3403,12 +3446,13 @@ profile-clean:
$(RM) $(addsuffix *.gcno,$(addprefix $(PROFILE_DIR)/, $(object_dirs)))

cocciclean:
$(RM) -r .build/contrib/coccinelle
$(RM) contrib/coccinelle/*.cocci.patch*

clean: profile-clean coverage-clean cocciclean
$(RM) -r .build
$(RM) po/git.pot po/git-core.pot
$(RM) *.res
$(RM) git.res
$(RM) $(OBJECTS)
$(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
$(RM) $(ALL_PROGRAMS) $(SCRIPT_LIB) $(BUILT_INS) git$X
Expand All @@ -3425,7 +3469,6 @@ clean: profile-clean coverage-clean cocciclean
$(MAKE) -C Documentation/ clean
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS
ifndef NO_PERL
$(MAKE) -C gitweb clean
$(RM) -r perl/build/
endif
$(MAKE) -C templates/ clean
Expand Down
19 changes: 19 additions & 0 deletions advice.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,22 @@ void detach_advice(const char *new_name)

fprintf(stderr, fmt, new_name);
}

void advise_on_moving_dirty_path(struct string_list *pathspec_list)
{
struct string_list_item *item;

if (!pathspec_list->nr)
return;

fprintf(stderr, _("The following paths have been moved outside the\n"
"sparse-checkout definition but are not sparse due to local\n"
"modifications.\n"));
for_each_string_list_item(item, pathspec_list)
fprintf(stderr, "%s\n", item->string);

advise_if_enabled(ADVICE_UPDATE_SPARSE_PATH,
_("To correct the sparsity of these paths, do the following:\n"
"* Use \"git add --sparse <paths>\" to update the index\n"
"* Use \"git sparse-checkout reapply\" to apply the sparsity rules"));
}
1 change: 1 addition & 0 deletions advice.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ void NORETURN die_conclude_merge(void);
void NORETURN die_ff_impossible(void);
void advise_on_updating_sparse_paths(struct string_list *pathspec_list);
void detach_advice(const char *new_name);
void advise_on_moving_dirty_path(struct string_list *pathspec_list);

#endif /* ADVICE_H */
33 changes: 23 additions & 10 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ static int stream_blob(const struct object_id *oid)
static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
int unknown_type)
{
int ret;
struct object_id oid;
enum object_type type;
char *buf;
Expand Down Expand Up @@ -106,7 +107,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
if (sb.len) {
printf("%s\n", sb.buf);
strbuf_release(&sb);
return 0;
ret = 0;
goto cleanup;
}
break;

Expand All @@ -115,16 +117,19 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
if (oid_object_info_extended(the_repository, &oid, &oi, flags) < 0)
die("git cat-file: could not get object info");
printf("%"PRIuMAX"\n", (uintmax_t)size);
return 0;
ret = 0;
goto cleanup;

case 'e':
return !has_object_file(&oid);

case 'w':

if (filter_object(path, obj_context.mode,
&oid, &buf, &size))
return -1;
&oid, &buf, &size)) {
ret = -1;
goto cleanup;
}
break;

case 'c':
Expand All @@ -143,11 +148,14 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
const char *ls_args[3] = { NULL };
ls_args[0] = "ls-tree";
ls_args[1] = obj_name;
return cmd_ls_tree(2, ls_args, NULL);
ret = cmd_ls_tree(2, ls_args, NULL);
goto cleanup;
}

if (type == OBJ_BLOB)
return stream_blob(&oid);
if (type == OBJ_BLOB) {
ret = stream_blob(&oid);
goto cleanup;
}
buf = read_object_file(&oid, &type, &size);
if (!buf)
die("Cannot read object %s", obj_name);
Expand All @@ -172,8 +180,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
} else
oidcpy(&blob_oid, &oid);

if (oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB)
return stream_blob(&blob_oid);
if (oid_object_info(the_repository, &blob_oid, NULL) == OBJ_BLOB) {
ret = stream_blob(&blob_oid);
goto cleanup;
}
/*
* we attempted to dereference a tag to a blob
* and failed; there may be new dereference
Expand All @@ -193,9 +203,11 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
die("git cat-file %s: bad file", obj_name);

write_or_die(1, buf, size);
ret = 0;
cleanup:
free(buf);
free(obj_context.path);
return 0;
return ret;
}

struct expand_data {
Expand Down Expand Up @@ -655,6 +667,7 @@ static void batch_objects_command(struct batch_options *opt,
free_cmds(queued_cmd, &nr);
}

free_cmds(queued_cmd, &nr);
free(queued_cmd);
strbuf_release(&input);
}
Expand Down
Loading