Merge remote-tracking branch 'github/master' into git-po-master

* github/master: (42 commits)
  Git 2.30-rc1
  git-gui: use gray background for inactive text widgets
  Another batch before 2.30-rc1
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  config.mak.uname: remove old NonStop compatibility settings
  diff: correct interaction between --exit-code and -I<pattern>
  t/perf: fix test_export() failure with BSD `sed`
  style: do not "break" in switch() after "return"
  compat-util: pretend that stub setitimer() always succeeds
  strmap: make callers of strmap_remove() to call it in void context
  doc: mention Python 3.x supports
  index-format.txt: document v2 format of file system monitor extension
  docs: multi-pack-index: remove note about future 'verify' work
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better
  t7900: use --fixed-value in git-maintenance tests
  ...
This commit is contained in:
Jiang Xin 2020-12-21 07:10:19 +08:00
commit 3104153d5e
43 changed files with 2334 additions and 1966 deletions

View file

@ -272,7 +272,9 @@ install-html: html
../GIT-VERSION-FILE: FORCE
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
ifneq ($(MAKECMDGOALS),clean)
-include ../GIT-VERSION-FILE
endif
#
# Determine "include::" file references in asciidoc files.
@ -286,7 +288,9 @@ doc.dep : $(docdep_prereqs) $(wildcard *.txt) $(wildcard config/*.txt) build-doc
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
mv $@+ $@
ifneq ($(MAKECMDGOALS),clean)
-include doc.dep
endif
cmds_txt = cmds-ancillaryinterrogators.txt \
cmds-ancillarymanipulators.txt \

View file

@ -391,3 +391,9 @@ Fixes since v2.29
(merge 08e9df2395 jk/multi-line-indent-style-fix later to maint).
(merge e66590348a da/vs-build-iconv-fix later to maint).
(merge 7fe07275be js/cmake-extra-built-ins-fix later to maint).
(merge 633eebe142 jb/midx-doc-update later to maint).
(merge 5885367e8f jh/index-v2-doc-on-fsmn later to maint).
(merge 14639a4779 jc/compat-util-setitimer-fix later to maint).
(merge 56f56ac50b ab/unreachable-break later to maint).
(merge 731d578b4f rb/nonstop-config-mak-uname-update later to maint).
(merge f4698738f9 es/perf-export-fix later to maint).

View file

@ -20,8 +20,9 @@ DESCRIPTION
This command creates an empty Git repository - basically a `.git`
directory with subdirectories for `objects`, `refs/heads`,
`refs/tags`, and template files. An initial `HEAD` file that
references the HEAD of the master branch is also created.
`refs/tags`, and template files. An initial branch without any
commits will be created (see the `--initial-branch` option below
for its name).
If the `$GIT_DIR` environment variable is set then it specifies a path
to use instead of `./.git` for the base of the repository.
@ -73,8 +74,10 @@ If this is reinitialization, the repository will be moved to the specified path.
-b <branch-name>::
--initial-branch=<branch-name>::
Use the specified name for the initial branch in the newly created repository.
If not specified, fall back to the default name: `master`.
Use the specified name for the initial branch in the newly created
repository. If not specified, fall back to the default name (currently
`master`, but this is subject to change in the future; the name can be
customized via the `init.defaultBranch` configuration variable).
--shared[=(false|true|umask|group|all|world|everybody|0xxx)]::

View file

@ -306,12 +306,18 @@ The remaining data of each directory block is grouped by type:
The extension starts with
- 32-bit version number: the current supported version is 1.
- 32-bit version number: the current supported versions are 1 and 2.
- 64-bit time: the extension data reflects all changes through the given
- (Version 1)
64-bit time: the extension data reflects all changes through the given
time which is stored as the nanoseconds elapsed since midnight,
January 1, 1970.
- (Version 2)
A null terminated string: an opaque token defined by the file system
monitor application. The extension data reflects all changes relative
to that token.
- 32-bit bitmap size: the size of the CE_FSMONITOR_VALID bitmap.
- An ewah bitmap, the n-th bit indicates whether the n-th index entry

View file

@ -60,10 +60,6 @@ Design Details
Future Work
-----------
- Add a 'verify' subcommand to the 'git midx' builtin to verify the
contents of the multi-pack-index file match the offsets listed in
the corresponding pack-indexes.
- The multi-pack-index allows many packfiles, especially in a context
where repacking is expensive (such as a very large repo), or
unexpected maintenance time is unacceptable (such as a high-demand

View file

@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=v2.30.0-rc0
DEF_VER=v2.30.0-rc1
LF='
'

View file

@ -165,8 +165,7 @@ Issues of note:
use English. Under autoconf the configure script will do this
automatically if it can't find libintl on the system.
- Python version 2.4 or later (but not 3.x, which is not
supported by Perforce) is needed to use the git-p4 interface
- Python version 2.7 or later is needed to use the git-p4 interface
to Perforce.
- Some platform specific issues are dealt with Makefile rules,

View file

@ -303,7 +303,7 @@ all::
# modules, instead of the fallbacks shipped with Git.
#
# Define PYTHON_PATH to the path of your Python binary (often /usr/bin/python
# but /usr/bin/python2.7 on some platforms).
# but /usr/bin/python2.7 or /usr/bin/python3 on some platforms).
#
# Define NO_PYTHON if you do not want Python scripts or libraries at all.
#
@ -3062,9 +3062,9 @@ GIT_TARNAME = git-$(GIT_VERSION)
GIT_ARCHIVE_EXTRA_FILES = \
--prefix=$(GIT_TARNAME)/ \
--add-file=configure \
--add-file=$(GIT_TARNAME)/version \
--add-file=.dist-tmp-dir/version \
--prefix=$(GIT_TARNAME)/git-gui/ \
--add-file=$(GIT_TARNAME)/git-gui/version
--add-file=.dist-tmp-dir/git-gui/version
ifdef DC_SHA1_SUBMODULE
GIT_ARCHIVE_EXTRA_FILES += \
--prefix=$(GIT_TARNAME)/sha1collisiondetection/ \
@ -3076,13 +3076,14 @@ GIT_ARCHIVE_EXTRA_FILES += \
--add-file=sha1collisiondetection/lib/ubc_check.h
endif
dist: git-archive$(X) configure
@mkdir -p $(GIT_TARNAME)
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
@$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
@$(RM) -r .dist-tmp-dir
@mkdir .dist-tmp-dir
@echo $(GIT_VERSION) > .dist-tmp-dir/version
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
./git-archive --format=tar \
$(GIT_ARCHIVE_EXTRA_FILES) \
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
@$(RM) -r $(GIT_TARNAME)
@$(RM) -r .dist-tmp-dir
gzip -f -9 $(GIT_TARNAME).tar
rpm::
@ -3159,8 +3160,8 @@ clean: profile-clean coverage-clean cocciclean
$(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json
$(RM) -r po/build/
$(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope*
$(RM) -r $(GIT_TARNAME) .doc-tmp-dir
$(RM) $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
$(RM) -r .dist-tmp-dir .doc-tmp-dir
$(RM) $(GIT_TARNAME).tar.gz
$(RM) $(htmldocs).tar.gz $(manpages).tar.gz
$(MAKE) -C Documentation/ clean
$(RM) Documentation/GIT-EXCLUDED-PROGRAMS

View file

@ -3948,10 +3948,8 @@ static int check_patch(struct apply_state *state, struct patch *patch)
break; /* happy */
case EXISTS_IN_INDEX:
return error(_("%s: already exists in index"), new_name);
break;
case EXISTS_IN_INDEX_AS_ITA:
return error(_("%s: does not match index"), new_name);
break;
case EXISTS_IN_WORKTREE:
return error(_("%s: already exists in working directory"),
new_name);

View file

@ -538,7 +538,9 @@ static void copy_or_rename_branch(const char *oldname, const char *newname, int
strbuf_addf(&logmsg, "Branch: renamed %s to %s",
oldref.buf, newref.buf);
if (!copy && rename_ref(oldref.buf, newref.buf, logmsg.buf))
if (!copy &&
(!head || strcmp(oldname, head) || !is_null_oid(&head_oid)) &&
rename_ref(oldref.buf, newref.buf, logmsg.buf))
die(_("Branch rename failed"));
if (copy && copy_existing_ref(oldref.buf, newref.buf, logmsg.buf))
die(_("Branch copy failed"));

View file

@ -1293,8 +1293,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
break;
}
if (!is_local && !complete_refs_before_fetch)
transport_fetch_refs(transport, mapped_refs);
if (!is_local && !complete_refs_before_fetch) {
err = transport_fetch_refs(transport, mapped_refs);
if (err)
goto cleanup;
}
remote_head = find_ref_by_name(refs, "HEAD");
remote_head_points_at =
@ -1323,7 +1326,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
remote_head = NULL;
option_no_checkout = 1;
if (!option_bare) {
const char *branch = git_default_branch_name();
const char *branch = git_default_branch_name(0);
char *ref = xstrfmt("refs/heads/%s", branch);
install_branch_config(0, branch, remote_name, ref);
@ -1339,8 +1342,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (is_local)
clone_local(path, git_dir);
else if (refs && complete_refs_before_fetch)
transport_fetch_refs(transport, mapped_refs);
else if (refs && complete_refs_before_fetch) {
err = transport_fetch_refs(transport, mapped_refs);
if (err)
goto cleanup;
}
update_remote_refs(refs, mapped_refs, remote_head_points_at,
branch_top.buf, reflog_msg.buf, transport,
@ -1367,6 +1373,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
junk_mode = JUNK_LEAVE_REPO;
err = checkout(submodule_progress);
cleanup:
free(remote_name);
strbuf_release(&reflog_msg);
strbuf_release(&branch_top);

View file

@ -923,7 +923,6 @@ static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
if (!tag)
die("Tag %s points nowhere?", e->name);
return (struct commit *)tag;
break;
}
default:
return NULL;

View file

@ -202,7 +202,8 @@ void initialize_repository_version(int hash_algo, int reinit)
static int create_default_files(const char *template_path,
const char *original_git_dir,
const char *initial_branch,
const struct repository_format *fmt)
const struct repository_format *fmt,
int quiet)
{
struct stat st1;
struct strbuf buf = STRBUF_INIT;
@ -267,7 +268,7 @@ static int create_default_files(const char *template_path,
char *ref;
if (!initial_branch)
initial_branch = git_default_branch_name();
initial_branch = git_default_branch_name(quiet);
ref = xstrfmt("refs/heads/%s", initial_branch);
if (check_refname_format(ref, 0) < 0)
@ -438,7 +439,8 @@ int init_db(const char *git_dir, const char *real_git_dir,
validate_hash_algorithm(&repo_fmt, hash);
reinit = create_default_files(template_dir, original_git_dir,
initial_branch, &repo_fmt);
initial_branch, &repo_fmt,
flags & INIT_DB_QUIET);
if (reinit && initial_branch)
warning(_("re-init: ignored --initial-branch=%s"),
initial_branch);

94
cache.h
View file

@ -1123,100 +1123,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id
int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
#define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len)
extern const struct object_id null_oid;
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
/*
* Teach the compiler that there are only two possibilities of hash size
* here, so that it can optimize for this case as much as possible.
*/
if (the_hash_algo->rawsz == GIT_MAX_RAWSZ)
return memcmp(sha1, sha2, GIT_MAX_RAWSZ);
return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
}
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
{
return hashcmp(oid1->hash, oid2->hash);
}
static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)
{
/*
* We write this here instead of deferring to hashcmp so that the
* compiler can properly inline it and avoid calling memcmp.
*/
if (the_hash_algo->rawsz == GIT_MAX_RAWSZ)
return !memcmp(sha1, sha2, GIT_MAX_RAWSZ);
return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
}
static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)
{
return hasheq(oid1->hash, oid2->hash);
}
static inline int is_null_oid(const struct object_id *oid)
{
return oideq(oid, &null_oid);
}
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
{
memcpy(sha_dst, sha_src, the_hash_algo->rawsz);
}
static inline void oidcpy(struct object_id *dst, const struct object_id *src)
{
memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);
}
static inline struct object_id *oiddup(const struct object_id *src)
{
struct object_id *dst = xmalloc(sizeof(struct object_id));
oidcpy(dst, src);
return dst;
}
static inline void hashclr(unsigned char *hash)
{
memset(hash, 0, the_hash_algo->rawsz);
}
static inline void oidclr(struct object_id *oid)
{
memset(oid->hash, 0, GIT_MAX_RAWSZ);
}
static inline void oidread(struct object_id *oid, const unsigned char *hash)
{
memcpy(oid->hash, hash, the_hash_algo->rawsz);
}
static inline int is_empty_blob_sha1(const unsigned char *sha1)
{
return hasheq(sha1, the_hash_algo->empty_blob->hash);
}
static inline int is_empty_blob_oid(const struct object_id *oid)
{
return oideq(oid, the_hash_algo->empty_blob);
}
static inline int is_empty_tree_sha1(const unsigned char *sha1)
{
return hasheq(sha1, the_hash_algo->empty_tree->hash);
}
static inline int is_empty_tree_oid(const struct object_id *oid)
{
return oideq(oid, the_hash_algo->empty_tree);
}
const char *empty_tree_oid_hex(void);
const char *empty_blob_oid_hex(void);
/* set default permissions by passing mode arguments to open(2) */
int git_mkstemps_mode(char *pattern, int suffix_len, int mode);
int git_mkstemp_mode(char *pattern, int mode);

View file

@ -932,21 +932,15 @@ struct tree *get_commit_tree_in_graph(struct repository *r, const struct commit
struct packed_commit_list {
struct commit **list;
int nr;
int alloc;
};
struct packed_oid_list {
struct object_id *list;
int nr;
int alloc;
size_t nr;
size_t alloc;
};
struct write_commit_graph_context {
struct repository *r;
struct object_directory *odb;
char *graph_name;
struct packed_oid_list oids;
struct oid_array oids;
struct packed_commit_list commits;
int num_extra_edges;
unsigned long approx_nr_objects;
@ -1240,13 +1234,6 @@ static int write_graph_chunk_bloom_data(struct hashfile *f,
return 0;
}
static int oid_compare(const void *_a, const void *_b)
{
const struct object_id *a = (const struct object_id *)_a;
const struct object_id *b = (const struct object_id *)_b;
return oidcmp(a, b);
}
static int add_packed_commits(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
@ -1267,10 +1254,7 @@ static int add_packed_commits(const struct object_id *oid,
if (type != OBJ_COMMIT)
return 0;
ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc);
oidcpy(&(ctx->oids.list[ctx->oids.nr]), oid);
ctx->oids.nr++;
oid_array_append(&ctx->oids, oid);
set_commit_pos(ctx->r, oid);
return 0;
@ -1281,9 +1265,7 @@ static void add_missing_parents(struct write_commit_graph_context *ctx, struct c
struct commit_list *parent;
for (parent = commit->parents; parent; parent = parent->next) {
if (!(parent->item->object.flags & REACHABLE)) {
ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc);
oidcpy(&ctx->oids.list[ctx->oids.nr], &(parent->item->object.oid));
ctx->oids.nr++;
oid_array_append(&ctx->oids, &parent->item->object.oid);
parent->item->object.flags |= REACHABLE;
}
}
@ -1302,7 +1284,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
ctx->oids.nr);
for (i = 0; i < ctx->oids.nr; i++) {
display_progress(ctx->progress, i + 1);
commit = lookup_commit(ctx->r, &ctx->oids.list[i]);
commit = lookup_commit(ctx->r, &ctx->oids.oid[i]);
if (commit)
commit->object.flags |= REACHABLE;
}
@ -1319,7 +1301,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
0);
for (i = 0; i < ctx->oids.nr; i++) {
display_progress(ctx->progress, i + 1);
commit = lookup_commit(ctx->r, &ctx->oids.list[i]);
commit = lookup_commit(ctx->r, &ctx->oids.oid[i]);
if (!commit)
continue;
@ -1339,7 +1321,7 @@ static void close_reachable(struct write_commit_graph_context *ctx)
ctx->oids.nr);
for (i = 0; i < ctx->oids.nr; i++) {
display_progress(ctx->progress, i + 1);
commit = lookup_commit(ctx->r, &ctx->oids.list[i]);
commit = lookup_commit(ctx->r, &ctx->oids.oid[i]);
if (commit)
commit->object.flags &= ~REACHABLE;
@ -1567,9 +1549,7 @@ static int fill_oids_from_commits(struct write_commit_graph_context *ctx,
oidset_iter_init(commits, &iter);
while ((oid = oidset_iter_next(&iter))) {
ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc);
oidcpy(&ctx->oids.list[ctx->oids.nr], oid);
ctx->oids.nr++;
oid_array_append(&ctx->oids, oid);
}
return 0;
@ -1588,35 +1568,6 @@ static void fill_oids_from_all_packs(struct write_commit_graph_context *ctx)
stop_progress(&ctx->progress);
}
static uint32_t count_distinct_commits(struct write_commit_graph_context *ctx)
{
uint32_t i, count_distinct = 1;
if (ctx->report_progress)
ctx->progress = start_delayed_progress(
_("Counting distinct commits in commit graph"),
ctx->oids.nr);
display_progress(ctx->progress, 0); /* TODO: Measure QSORT() progress */
QSORT(ctx->oids.list, ctx->oids.nr, oid_compare);
for (i = 1; i < ctx->oids.nr; i++) {
display_progress(ctx->progress, i + 1);
if (!oideq(&ctx->oids.list[i - 1], &ctx->oids.list[i])) {
if (ctx->split) {
struct commit *c = lookup_commit(ctx->r, &ctx->oids.list[i]);
if (!c || commit_graph_position(c) != COMMIT_NOT_FROM_GRAPH)
continue;
}
count_distinct++;
}
}
stop_progress(&ctx->progress);
return count_distinct;
}
static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
{
uint32_t i;
@ -1628,15 +1579,14 @@ static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
ctx->progress = start_delayed_progress(
_("Finding extra edges in commit graph"),
ctx->oids.nr);
for (i = 0; i < ctx->oids.nr; i++) {
oid_array_sort(&ctx->oids);
for (i = 0; i < ctx->oids.nr; i = oid_array_next_unique(&ctx->oids, i)) {
unsigned int num_parents;
display_progress(ctx->progress, i + 1);
if (i > 0 && oideq(&ctx->oids.list[i - 1], &ctx->oids.list[i]))
continue;
ALLOC_GROW(ctx->commits.list, ctx->commits.nr + 1, ctx->commits.alloc);
ctx->commits.list[ctx->commits.nr] = lookup_commit(ctx->r, &ctx->oids.list[i]);
ctx->commits.list[ctx->commits.nr] = lookup_commit(ctx->r, &ctx->oids.oid[i]);
if (ctx->split && flags != COMMIT_GRAPH_SPLIT_REPLACE &&
commit_graph_position(ctx->commits.list[ctx->commits.nr]) != COMMIT_NOT_FROM_GRAPH)
@ -2155,7 +2105,7 @@ int write_commit_graph(struct object_directory *odb,
const struct commit_graph_opts *opts)
{
struct write_commit_graph_context *ctx;
uint32_t i, count_distinct = 0;
uint32_t i;
int res = 0;
int replace = 0;
struct bloom_filter_settings bloom_settings = DEFAULT_BLOOM_FILTER_SETTINGS;
@ -2227,26 +2177,16 @@ int write_commit_graph(struct object_directory *odb,
}
ctx->approx_nr_objects = approximate_object_count();
ctx->oids.alloc = ctx->approx_nr_objects / 32;
if (ctx->split && opts && ctx->oids.alloc > opts->max_commits)
ctx->oids.alloc = opts->max_commits;
if (ctx->append) {
if (ctx->append)
prepare_commit_graph_one(ctx->r, ctx->odb);
if (ctx->r->objects->commit_graph)
ctx->oids.alloc += ctx->r->objects->commit_graph->num_commits;
}
if (ctx->oids.alloc < 1024)
ctx->oids.alloc = 1024;
ALLOC_ARRAY(ctx->oids.list, ctx->oids.alloc);
if (ctx->append && ctx->r->objects->commit_graph) {
struct commit_graph *g = ctx->r->objects->commit_graph;
for (i = 0; i < g->num_commits; i++) {
const unsigned char *hash = g->chunk_oid_lookup + g->hash_len * i;
hashcpy(ctx->oids.list[ctx->oids.nr++].hash, hash);
struct object_id oid;
hashcpy(oid.hash, g->chunk_oid_lookup + g->hash_len * i);
oid_array_append(&ctx->oids, &oid);
}
}
@ -2268,17 +2208,6 @@ int write_commit_graph(struct object_directory *odb,
close_reachable(ctx);
count_distinct = count_distinct_commits(ctx);
if (count_distinct >= GRAPH_EDGE_LAST_MASK) {
error(_("the commit graph format cannot write %d commits"), count_distinct);
res = -1;
goto cleanup;
}
ctx->commits.alloc = count_distinct;
ALLOC_ARRAY(ctx->commits.list, ctx->commits.alloc);
copy_oids_to_commits(ctx);
if (ctx->commits.nr >= GRAPH_EDGE_LAST_MASK) {
@ -2313,7 +2242,7 @@ int write_commit_graph(struct object_directory *odb,
cleanup:
free(ctx->graph_name);
free(ctx->commits.list);
free(ctx->oids.list);
oid_array_clear(&ctx->oids);
if (ctx->commit_graph_filenames_after) {
for (i = 0; i < ctx->num_commit_graphs_after; i++) {

View file

@ -574,10 +574,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
NO_MMAP = YesPlease
NO_POLL = YesPlease
NO_INTPTR_T = UnfortunatelyYes
# Bug report 10-120822-4477 submitted to HP NonStop development.
MKDIR_WO_TRAILING_SLASH = YesPlease
# RFE 10-120912-4693 submitted to HP NonStop development.
NO_SETITIMER = UnfortunatelyYes
SANE_TOOL_PATH = /usr/coreutils/bin:/usr/local/bin
SHELL_PATH = /usr/coreutils/bin/bash
endif

3
diff.c
View file

@ -4634,7 +4634,8 @@ void diff_setup_done(struct diff_options *options)
* inside contents.
*/
if ((options->xdl_opts & XDF_WHITESPACE_FLAGS))
if ((options->xdl_opts & XDF_WHITESPACE_FLAGS) ||
options->ignore_regex_nr)
options->flags.diff_from_contents = 1;
else
options->flags.diff_from_contents = 0;

View file

@ -273,7 +273,7 @@ struct itimerval {
#ifdef NO_SETITIMER
static inline int setitimer(int which, const struct itimerval *value, struct itimerval *newvalue) {
; /* nothing */
return 0; /* pretend success */
}
#endif

View file

@ -9,7 +9,9 @@ all::
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
ifneq ($(MAKECMDGOALS),clean)
-include GIT-VERSION-FILE
endif
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')

View file

@ -26,8 +26,21 @@ pack .m -side top -fill x -padx 20 -pady 20 -expand 1
entry .e -textvariable answer -width 50
pack .e -side top -fill x -padx 10 -pady 10
proc on_show_input_changed {args} {
global show_input
if {$show_input} {
.e configure -show ""
} else {
.e configure -show "*"
}
}
trace add variable show_input write "on_show_input_changed"
set show_input 0
if {!$yesno} {
.e configure -show "*"
checkbutton .cb_show -text "Show input" -variable show_input
pack .cb_show -side top -anchor nw
}
frame .b

View file

@ -720,9 +720,6 @@ proc rmsel_tag {text} {
-background [$text cget -background] \
-foreground [$text cget -foreground] \
-borderwidth 0
$text tag conf in_sel\
-background $color::select_bg \
-foreground $color::select_fg
bind $text <Motion> break
return $text
}
@ -1482,6 +1479,7 @@ proc rescan {after {honor_trustmtime 1}} {
} elseif {[run_prepare_commit_msg_hook]} {
} elseif {[load_message MERGE_MSG]} {
} elseif {[load_message SQUASH_MSG]} {
} elseif {[load_message [get_config commit.template]]} {
}
$ui_comm edit reset
$ui_comm edit modified false
@ -1616,6 +1614,12 @@ proc run_prepare_commit_msg_hook {} {
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} elseif {[file isfile [get_config commit.template]]} {
set pcm_source "template"
set fd_sm [open [get_config commit.template] r]
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} else {
set pcm_source ""
}
@ -2305,11 +2309,10 @@ proc do_quit {{rc {1}}} {
if {$GITGUI_BCK_exists && ![$ui_comm edit modified]} {
file rename -force [gitdir GITGUI_BCK] $save
set GITGUI_BCK_exists 0
} else {
} elseif {[$ui_comm edit modified]} {
set msg [string trim [$ui_comm get 0.0 end]]
regsub -all -line {[ \r\t]+$} $msg {} msg
if {(![string match amend* $commit_type]
|| [$ui_comm edit modified])
if {![string match amend* $commit_type]
&& $msg ne {}} {
catch {
set fd [open $save w]
@ -3322,11 +3325,20 @@ if {!$use_ttk} {
.vpane.files paneconfigure .vpane.files.index -sticky news
}
proc set_selection_colors {w has_focus} {
foreach tag [list in_diff in_sel] {
$w tag conf $tag \
-background [expr {$has_focus ? $color::select_bg : $color::inactive_select_bg}] \
-foreground [expr {$has_focus ? $color::select_fg : $color::inactive_select_fg}]
}
}
foreach i [list $ui_index $ui_workdir] {
rmsel_tag $i
$i tag conf in_diff \
-background $color::select_bg \
-foreground $color::select_fg
set_selection_colors $i 0
bind $i <FocusIn> { set_selection_colors %W 1 }
bind $i <FocusOut> { set_selection_colors %W 0 }
}
unset i

View file

@ -456,6 +456,7 @@ A rescan will be automatically started now.
}
$ui_comm delete 0.0 end
load_message [get_config commit.template]
$ui_comm edit reset
$ui_comm edit modified false
if {$::GITGUI_BCK_exists} {

View file

@ -6,19 +6,25 @@ namespace eval color {
# Variable colors
# Preffered way to set widget colors is using add_option.
# In some cases, like with tags in_diff/in_sel, we use these colors.
variable select_bg lightgray
variable select_fg black
variable select_bg lightgray
variable select_fg black
variable inactive_select_bg lightgray
variable inactive_select_fg black
proc sync_with_theme {} {
set base_bg [ttk::style lookup . -background]
set base_fg [ttk::style lookup . -foreground]
set text_bg [ttk::style lookup Treeview -background]
set text_fg [ttk::style lookup Treeview -foreground]
set select_bg [ttk::style lookup Default -selectbackground]
set select_fg [ttk::style lookup Default -selectforeground]
set base_bg [ttk::style lookup . -background]
set base_fg [ttk::style lookup . -foreground]
set text_bg [ttk::style lookup Treeview -background]
set text_fg [ttk::style lookup Treeview -foreground]
set select_bg [ttk::style lookup Default -selectbackground]
set select_fg [ttk::style lookup Default -selectforeground]
set inactive_select_bg [convert_rgb_to_gray $select_bg]
set inactive_select_fg $select_fg
set color::select_bg $select_bg
set color::select_fg $select_fg
set color::inactive_select_bg $inactive_select_bg
set color::inactive_select_fg $inactive_select_fg
proc add_option {key val} {
option add $key $val widgetDefault
@ -34,11 +40,22 @@ namespace eval color {
}
add_option *Text.Background $text_bg
add_option *Text.Foreground $text_fg
add_option *Text.HighlightBackground $base_bg
add_option *Text.HighlightColor $select_bg
add_option *Text.selectBackground $select_bg
add_option *Text.selectForeground $select_fg
add_option *Text.inactiveSelectBackground $inactive_select_bg
add_option *Text.inactiveSelectForeground $inactive_select_fg
}
}
proc convert_rgb_to_gray {rgb} {
# Simply take the average of red, green and blue. This wouldn't be good
# enough for, say, converting a photo to grayscale, but for this simple
# purpose of approximating the brightness of a color it's good enough.
lassign [winfo rgb . $rgb] r g b
set gray [expr {($r / 256 + $g / 256 + $b / 256) / 3}]
return [format "#%2.2X%2.2X%2.2X" $gray $gray $gray]
}
proc ttk_get_current_theme {} {
# Handle either current Tk or older versions of 8.5
if {[catch {set theme [ttk::style theme use]}]} {
@ -174,7 +191,7 @@ proc InitEntryFrame {} {
proc gold_frame {w args} {
global use_ttk
if {$use_ttk} {
if {$use_ttk && ![is_MacOSX]} {
eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
} else {
eval [linsert $args 0 frame $w -background gold]
@ -183,7 +200,7 @@ proc gold_frame {w args} {
proc tlabel {w args} {
global use_ttk
if {$use_ttk} {
if {$use_ttk && ![is_MacOSX]} {
set cmd [list ttk::label $w -style Color.TLabel]
foreach {k v} $args {
switch -glob -- $k {

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,9 @@ HIGHLIGHT_BIN = highlight
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
ifneq ($(MAKECMDGOALS),clean)
-include ../GIT-VERSION-FILE
endif
### Build rules

95
hash.h
View file

@ -2,6 +2,7 @@
#define HASH_H
#include "git-compat-util.h"
#include "repository.h"
#if defined(SHA1_PPC)
#include "ppc/sha1.h"
@ -184,4 +185,98 @@ struct object_id {
#define the_hash_algo the_repository->hash_algo
extern const struct object_id null_oid;
static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
{
/*
* Teach the compiler that there are only two possibilities of hash size
* here, so that it can optimize for this case as much as possible.
*/
if (the_hash_algo->rawsz == GIT_MAX_RAWSZ)
return memcmp(sha1, sha2, GIT_MAX_RAWSZ);
return memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
}
static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
{
return hashcmp(oid1->hash, oid2->hash);
}
static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2)
{
/*
* We write this here instead of deferring to hashcmp so that the
* compiler can properly inline it and avoid calling memcmp.
*/
if (the_hash_algo->rawsz == GIT_MAX_RAWSZ)
return !memcmp(sha1, sha2, GIT_MAX_RAWSZ);
return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ);
}
static inline int oideq(const struct object_id *oid1, const struct object_id *oid2)
{
return hasheq(oid1->hash, oid2->hash);
}
static inline int is_null_oid(const struct object_id *oid)
{
return oideq(oid, &null_oid);
}
static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
{
memcpy(sha_dst, sha_src, the_hash_algo->rawsz);
}
static inline void oidcpy(struct object_id *dst, const struct object_id *src)
{
memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ);
}
static inline struct object_id *oiddup(const struct object_id *src)
{
struct object_id *dst = xmalloc(sizeof(struct object_id));
oidcpy(dst, src);
return dst;
}
static inline void hashclr(unsigned char *hash)
{
memset(hash, 0, the_hash_algo->rawsz);
}
static inline void oidclr(struct object_id *oid)
{
memset(oid->hash, 0, GIT_MAX_RAWSZ);
}
static inline void oidread(struct object_id *oid, const unsigned char *hash)
{
memcpy(oid->hash, hash, the_hash_algo->rawsz);
}
static inline int is_empty_blob_sha1(const unsigned char *sha1)
{
return hasheq(sha1, the_hash_algo->empty_blob->hash);
}
static inline int is_empty_blob_oid(const struct object_id *oid)
{
return oideq(oid, the_hash_algo->empty_blob);
}
static inline int is_empty_tree_sha1(const unsigned char *sha1)
{
return hasheq(sha1, the_hash_algo->empty_tree->hash);
}
static inline int is_empty_tree_oid(const struct object_id *oid)
{
return oideq(oid, the_hash_algo->empty_tree);
}
const char *empty_tree_oid_hex(void);
const char *empty_blob_oid_hex(void);
#endif

View file

@ -14,8 +14,10 @@ static int void_hashcmp(const void *a, const void *b)
return oidcmp(a, b);
}
static void oid_array_sort(struct oid_array *array)
void oid_array_sort(struct oid_array *array)
{
if (array->sorted)
return;
QSORT(array->oid, array->nr, void_hashcmp);
array->sorted = 1;
}
@ -28,8 +30,7 @@ static const unsigned char *sha1_access(size_t index, void *table)
int oid_array_lookup(struct oid_array *array, const struct object_id *oid)
{
if (!array->sorted)
oid_array_sort(array);
oid_array_sort(array);
return sha1_pos(oid->hash, array->oid, array->nr, sha1_access);
}
@ -64,14 +65,10 @@ int oid_array_for_each_unique(struct oid_array *array,
{
size_t i;
if (!array->sorted)
oid_array_sort(array);
oid_array_sort(array);
for (i = 0; i < array->nr; i++) {
int ret;
if (i > 0 && oideq(array->oid + i, array->oid + i - 1))
continue;
ret = fn(array->oid + i, data);
for (i = 0; i < array->nr; i = oid_array_next_unique(array, i)) {
int ret = fn(array->oid + i, data);
if (ret)
return ret;
}

View file

@ -1,5 +1,7 @@
#ifndef SHA1_ARRAY_H
#define SHA1_ARRAY_H
#ifndef OID_ARRAY_H
#define OID_ARRAY_H
#include "hash.h"
/**
* The API provides storage and manipulation of sets of object identifiers.
@ -106,4 +108,30 @@ void oid_array_filter(struct oid_array *array,
for_each_oid_fn want,
void *cbdata);
#endif /* SHA1_ARRAY_H */
/**
* Sort the array in order of ascending object id.
*/
void oid_array_sort(struct oid_array *array);
/**
* Find the next unique oid in the array after position "cur".
* The array must be sorted for this to work. You can iterate
* over unique elements like this:
*
* size_t i;
* oid_array_sort(array);
* for (i = 0; i < array->nr; i = oid_array_next_unique(array, i))
* printf("%s", oid_to_hex(array->oids[i]);
*
* Non-unique iteration can just increment with "i++" to visit each element.
*/
static inline size_t oid_array_next_unique(struct oid_array *array, size_t cur)
{
do {
cur++;
} while (cur < array->nr &&
oideq(array->oid + cur, array->oid + cur - 1));
return cur;
}
#endif /* OID_ARRAY_H */

24
refs.c
View file

@ -562,7 +562,20 @@ void expand_ref_prefix(struct strvec *prefixes, const char *prefix)
strvec_pushf(prefixes, *p, len, prefix);
}
char *repo_default_branch_name(struct repository *r)
static const char default_branch_name_advice[] = N_(
"Using '%s' as the name for the initial branch. This default branch name\n"
"is subject to change. To configure the initial branch name to use in all\n"
"of your new repositories, which will suppress this warning, call:\n"
"\n"
"\tgit config --global init.defaultBranch <name>\n"
"\n"
"Names commonly chosen instead of 'master' are 'main', 'trunk' and\n"
"'development'. The just-created branch can be renamed via this command:\n"
"\n"
"\tgit branch -m <name>\n"
);
char *repo_default_branch_name(struct repository *r, int quiet)
{
const char *config_key = "init.defaultbranch";
const char *config_display_key = "init.defaultBranch";
@ -574,8 +587,11 @@ char *repo_default_branch_name(struct repository *r)
else if (repo_config_get_string(r, config_key, &ret) < 0)
die(_("could not retrieve `%s`"), config_display_key);
if (!ret)
if (!ret) {
ret = xstrdup("master");
if (!quiet)
advise(_(default_branch_name_advice), ret);
}
full_ref = xstrfmt("refs/heads/%s", ret);
if (check_refname_format(full_ref, 0))
@ -585,12 +601,12 @@ char *repo_default_branch_name(struct repository *r)
return ret;
}
const char *git_default_branch_name(void)
const char *git_default_branch_name(int quiet)
{
static char *ret;
if (!ret)
ret = repo_default_branch_name(the_repository);
ret = repo_default_branch_name(the_repository, quiet);
return ret;
}

4
refs.h
View file

@ -170,8 +170,8 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
* The return value of `repo_default_branch_name()` is an allocated string. The
* return value of `git_default_branch_name()` is a singleton.
*/
const char *git_default_branch_name(void);
char *repo_default_branch_name(struct repository *r);
const char *git_default_branch_name(int quiet);
char *repo_default_branch_name(struct repository *r, int quiet);
/*
* A ref_transaction represents a collection of reference updates that

View file

@ -284,7 +284,7 @@ static void read_branches_file(struct remote *remote)
if (frag)
*(frag++) = '\0';
else
frag = (char *)git_default_branch_name();
frag = (char *)git_default_branch_name(0);
add_url_alias(remote, strbuf_detach(&buf, NULL));
refspec_appendf(&remote->fetch, "refs/heads/%s:refs/heads/%s",
@ -2206,7 +2206,8 @@ struct ref *guess_remote_head(const struct ref *head,
/* If a remote branch exists with the default branch name, let's use it. */
if (!all) {
char *ref = xstrfmt("refs/heads/%s", git_default_branch_name());
char *ref = xstrfmt("refs/heads/%s",
git_default_branch_name(0));
r = find_ref_by_name(refs, ref);
free(ref);

View file

@ -165,7 +165,7 @@ static inline int strintmap_contains(struct strintmap *map, const char *str)
static inline void strintmap_remove(struct strintmap *map, const char *str)
{
return strmap_remove(&map->map, str, 0);
strmap_remove(&map->map, str, 0);
}
static inline int strintmap_empty(struct strintmap *map)
@ -249,7 +249,7 @@ static inline int strset_contains(struct strset *set, const char *str)
static inline void strset_remove(struct strset *set, const char *str)
{
return strmap_remove(&set->map, str, 0);
strmap_remove(&set->map, str, 0);
}
static inline int strset_empty(struct strset *set)

View file

@ -148,13 +148,18 @@ test_run_perf_ () {
. '"$TEST_DIRECTORY"/test-lib-functions.sh'
test_export () {
[ $# != 0 ] || return 0
test_export_="$test_export_\\|$1"
test_export_="$test_export_ $1"
shift
test_export "$@"
}
'"$1"'
ret=$?
set | sed -n "s'"/'/'\\\\''/g"';s/^\\($test_export_\\)/export '"'&'"'/p" >test_vars
needles=
for v in $test_export_
do
needles="$needles;s/^$v=/export $v=/p"
done
set | sed -n "s'"/'/'\\\\''/g"'$needles" >test_vars
exit $ret' >&3 2>&4
eval_ret=$?

View file

@ -163,7 +163,7 @@ test_expect_success 'reinit' '
(
mkdir again &&
cd again &&
git init >out1 2>err1 &&
git -c init.defaultBranch=initial init >out1 2>err1 &&
git init >out2 2>err2
) &&
test_i18ngrep "Initialized empty" again/out1 &&
@ -558,6 +558,13 @@ test_expect_success 'overridden default initial branch name (config)' '
grep nmb actual
'
test_expect_success 'advice on unconfigured init.defaultBranch' '
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git -c color.advice=always \
init unconfigured-default-branch-name 2>err &&
test_decode_color <err >decoded &&
test_i18ngrep "<YELLOW>hint: " decoded
'
test_expect_success 'overridden default main branch name (env)' '
test_config_global init.defaultBranch nmb &&
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env &&
@ -571,4 +578,12 @@ test_expect_success 'invalid default branch name' '
test_i18ngrep "invalid branch name" err
'
test_expect_success 'branch -m with the initial branch' '
git init rename-initial &&
git -C rename-initial branch -m renamed &&
test renamed = $(git -C rename-initial symbolic-ref --short HEAD) &&
git -C rename-initial branch -m renamed again &&
test again = $(git -C rename-initial symbolic-ref --short HEAD)
'
test_done

View file

@ -1,6 +1,6 @@
#!/bin/sh
test_description='basic tests for the SHA1 array implementation'
test_description='basic tests for the oid array implementation'
. ./test-lib.sh
echoid () {
@ -25,6 +25,7 @@ test_expect_success 'ordered enumeration' '
test_expect_success 'ordered enumeration with duplicate suppression' '
echoid "" 44 55 88 aa >expect &&
{
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echo for_each_unique
@ -52,17 +53,19 @@ test_expect_success 'lookup non-existing entry' '
test_expect_success 'lookup with duplicates' '
{
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echoid lookup 55
} | test-tool oid-array >actual &&
n=$(cat actual) &&
test "$n" -ge 2 &&
test "$n" -le 3
test "$n" -ge 3 &&
test "$n" -le 5
'
test_expect_success 'lookup non-existing entry with duplicates' '
{
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echoid append 88 44 aa 55 &&
echoid lookup 66

View file

@ -79,7 +79,7 @@ setup_repo () {
name=$1 worktreecfg=$2 gitfile=$3 barecfg=$4 &&
sane_unset GIT_DIR GIT_WORK_TREE &&
git init "$name" &&
git -c init.defaultBranch=initial init "$name" &&
maybe_config "$name/.git/config" core.worktree "$worktreecfg" &&
maybe_config "$name/.git/config" core.bare "$barecfg" &&
mkdir -p "$name/sub/sub" &&

View file

@ -567,6 +567,30 @@ test_expect_success '--check and --quiet are not exclusive' '
git diff --check --quiet
'
test_expect_success '-w and --exit-code interact sensibly' '
test_when_finished "git checkout x" &&
{
test_seq 15 &&
echo " 16"
} >x &&
test_must_fail git diff --exit-code &&
git diff -w >actual &&
test_must_be_empty actual &&
git diff -w --exit-code
'
test_expect_success '-I and --exit-code interact sensibly' '
test_when_finished "git checkout x" &&
{
test_seq 15 &&
echo " 16"
} >x &&
test_must_fail git diff --exit-code &&
git diff -I. >actual &&
test_must_be_empty actual &&
git diff -I. --exit-code
'
test_expect_success 'check staged with no whitespace errors' '
echo "foo();" >x &&
git add x &&

View file

@ -289,7 +289,15 @@ test_expect_success 'upload-pack limits tree depth filters' '
test_config -C srv.bare uploadpackfilter.tree.maxDepth 0 &&
test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:1 \
"file://$(pwd)/srv.bare" pc3 2>err &&
test_i18ngrep "tree filter allows max depth 0, but got 1" err
test_i18ngrep "tree filter allows max depth 0, but got 1" err &&
git clone --no-checkout --filter=tree:0 "file://$(pwd)/srv.bare" pc4 &&
test_config -C srv.bare uploadpackfilter.tree.maxDepth 5 &&
git clone --no-checkout --filter=tree:5 "file://$(pwd)/srv.bare" pc5 &&
test_must_fail ok=sigpipe git clone --no-checkout --filter=tree:6 \
"file://$(pwd)/srv.bare" pc6 2>err &&
test_i18ngrep "tree filter allows max depth 5, but got 6" err
'
test_expect_success 'partial clone fetches blobs pointed to by refs even if normally filtered out' '

View file

@ -28,12 +28,13 @@ test_expect_success setup '
echo "Using $datestamp" > one &&
git add one &&
git commit -m "Initial" &&
git branch -M main &&
setdate_and_increment &&
git tag -a -m "Tagging at $datestamp" testtag &&
git update-ref refs/remotes/origin/master master &&
git update-ref refs/remotes/origin/main main &&
git remote add origin nowhere &&
git config branch.master.remote origin &&
git config branch.master.merge refs/heads/master &&
git config branch.main.remote origin &&
git config branch.main.merge refs/heads/main &&
git remote add myfork elsewhere &&
git config remote.pushdefault myfork &&
git config push.default current
@ -41,7 +42,7 @@ test_expect_success setup '
test_atom() {
case "$1" in
head) ref=refs/heads/master ;;
head) ref=refs/heads/main ;;
tag) ref=refs/tags/testtag ;;
sym) ref=refs/heads/sym ;;
*) ref=$1 ;;
@ -76,49 +77,49 @@ test_atom() {
hexlen=$(test_oid hexsz)
disklen=$(test_oid disklen)
test_atom head refname refs/heads/master
test_atom head refname: refs/heads/master
test_atom head refname:short master
test_atom head refname:lstrip=1 heads/master
test_atom head refname:lstrip=2 master
test_atom head refname:lstrip=-1 master
test_atom head refname:lstrip=-2 heads/master
test_atom head refname refs/heads/main
test_atom head refname: refs/heads/main
test_atom head refname:short main
test_atom head refname:lstrip=1 heads/main
test_atom head refname:lstrip=2 main
test_atom head refname:lstrip=-1 main
test_atom head refname:lstrip=-2 heads/main
test_atom head refname:rstrip=1 refs/heads
test_atom head refname:rstrip=2 refs
test_atom head refname:rstrip=-1 refs
test_atom head refname:rstrip=-2 refs/heads
test_atom head refname:strip=1 heads/master
test_atom head refname:strip=2 master
test_atom head refname:strip=-1 master
test_atom head refname:strip=-2 heads/master
test_atom head upstream refs/remotes/origin/master
test_atom head upstream:short origin/master
test_atom head upstream:lstrip=2 origin/master
test_atom head upstream:lstrip=-2 origin/master
test_atom head refname:strip=1 heads/main
test_atom head refname:strip=2 main
test_atom head refname:strip=-1 main
test_atom head refname:strip=-2 heads/main
test_atom head upstream refs/remotes/origin/main
test_atom head upstream:short origin/main
test_atom head upstream:lstrip=2 origin/main
test_atom head upstream:lstrip=-2 origin/main
test_atom head upstream:rstrip=2 refs/remotes
test_atom head upstream:rstrip=-2 refs/remotes
test_atom head upstream:strip=2 origin/master
test_atom head upstream:strip=-2 origin/master
test_atom head push refs/remotes/myfork/master
test_atom head push:short myfork/master
test_atom head push:lstrip=1 remotes/myfork/master
test_atom head push:lstrip=-1 master
test_atom head upstream:strip=2 origin/main
test_atom head upstream:strip=-2 origin/main
test_atom head push refs/remotes/myfork/main
test_atom head push:short myfork/main
test_atom head push:lstrip=1 remotes/myfork/main
test_atom head push:lstrip=-1 main
test_atom head push:rstrip=1 refs/remotes/myfork
test_atom head push:rstrip=-1 refs
test_atom head push:strip=1 remotes/myfork/master
test_atom head push:strip=-1 master
test_atom head push:strip=1 remotes/myfork/main
test_atom head push:strip=-1 main
test_atom head objecttype commit
test_atom head objectsize $((131 + hexlen))
test_atom head objectsize:disk $disklen
test_atom head deltabase $ZERO_OID
test_atom head objectname $(git rev-parse refs/heads/master)
test_atom head objectname:short $(git rev-parse --short refs/heads/master)
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
test_atom head tree $(git rev-parse refs/heads/master^{tree})
test_atom head tree:short $(git rev-parse --short refs/heads/master^{tree})
test_atom head tree:short=1 $(git rev-parse --short=1 refs/heads/master^{tree})
test_atom head tree:short=10 $(git rev-parse --short=10 refs/heads/master^{tree})
test_atom head objectname $(git rev-parse refs/heads/main)
test_atom head objectname:short $(git rev-parse --short refs/heads/main)
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/main)
test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/main)
test_atom head tree $(git rev-parse refs/heads/main^{tree})
test_atom head tree:short $(git rev-parse --short refs/heads/main^{tree})
test_atom head tree:short=1 $(git rev-parse --short=1 refs/heads/main^{tree})
test_atom head tree:short=10 $(git rev-parse --short=10 refs/heads/main^{tree})
test_atom head parent ''
test_atom head parent:short ''
test_atom head parent:short=1 ''
@ -171,8 +172,8 @@ test_atom tag deltabase $ZERO_OID
test_atom tag '*deltabase' $ZERO_OID
test_atom tag objectname $(git rev-parse refs/tags/testtag)
test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag)
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/master)
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/main)
test_atom head objectname:short=10 $(git rev-parse --short=10 refs/heads/main)
test_atom tag tree ''
test_atom tag tree:short ''
test_atom tag tree:short=1 ''
@ -253,7 +254,7 @@ test_date () {
author_date=$3 &&
tagger_date=$4 &&
cat >expected <<-EOF &&
'refs/heads/master' '$committer_date' '$author_date'
'refs/heads/main' '$committer_date' '$author_date'
'refs/tags/testtag' '$tagger_date'
EOF
(
@ -375,8 +376,8 @@ test_expect_success 'exercise strftime with odd fields' '
'
cat >expected <<\EOF
refs/heads/master
refs/remotes/origin/master
refs/heads/main
refs/remotes/origin/main
refs/tags/testtag
EOF
@ -388,8 +389,8 @@ test_expect_success 'Verify ascending sort' '
cat >expected <<\EOF
refs/tags/testtag
refs/remotes/origin/master
refs/heads/master
refs/remotes/origin/main
refs/heads/main
EOF
test_expect_success 'Verify descending sort' '
@ -424,8 +425,8 @@ test_expect_success 'exercise glob patterns with prefixes' '
'
cat >expected <<\EOF
'refs/heads/master'
'refs/remotes/origin/master'
'refs/heads/main'
'refs/remotes/origin/main'
'refs/tags/testtag'
EOF
@ -445,8 +446,8 @@ test_expect_success 'Quoting style: python' '
'
cat >expected <<\EOF
"refs/heads/master"
"refs/remotes/origin/master"
"refs/heads/main"
"refs/remotes/origin/main"
"refs/tags/testtag"
EOF
@ -473,8 +474,8 @@ test_atom head upstream:nobracket,track 'ahead 1'
test_expect_success 'setup for push:track[short]' '
test_commit third &&
git update-ref refs/remotes/myfork/master master &&
git reset master~1
git update-ref refs/remotes/myfork/main main &&
git reset main~1
'
test_atom head push:track '[behind 1]'
@ -490,8 +491,8 @@ test_expect_success 'Check that :track[short] works when upstream is invalid' '
[gone]
EOF
test_when_finished "git config branch.master.merge refs/heads/master" &&
git config branch.master.merge refs/heads/does-not-exist &&
test_when_finished "git config branch.main.merge refs/heads/main" &&
git config branch.main.merge refs/heads/does-not-exist &&
git for-each-ref \
--format="%(upstream:track)$LF%(upstream:trackshort)" \
refs/heads >actual &&
@ -504,9 +505,9 @@ test_expect_success 'Check for invalid refname format' '
test_expect_success 'set up color tests' '
cat >expected.color <<-EOF &&
$(git rev-parse --short refs/heads/master) <GREEN>master<RESET>
$(git rev-parse --short refs/remotes/myfork/master) <GREEN>myfork/master<RESET>
$(git rev-parse --short refs/remotes/origin/master) <GREEN>origin/master<RESET>
$(git rev-parse --short refs/heads/main) <GREEN>main<RESET>
$(git rev-parse --short refs/remotes/myfork/main) <GREEN>myfork/main<RESET>
$(git rev-parse --short refs/remotes/origin/main) <GREEN>origin/main<RESET>
$(git rev-parse --short refs/tags/testtag) <GREEN>testtag<RESET>
$(git rev-parse --short refs/tags/third) <GREEN>third<RESET>
$(git rev-parse --short refs/tags/two) <GREEN>two<RESET>
@ -538,8 +539,8 @@ test_expect_success 'color.ui=always does not override tty check' '
'
cat >expected <<\EOF
heads/master
tags/master
heads/main
tags/main
EOF
test_expect_success 'Check ambiguous head and tag refs (strict)' '
@ -549,19 +550,19 @@ test_expect_success 'Check ambiguous head and tag refs (strict)' '
git add one &&
git commit -m "Branch" &&
setdate_and_increment &&
git tag -m "Tagging at $datestamp" master &&
git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
git tag -m "Tagging at $datestamp" main &&
git for-each-ref --format "%(refname:short)" refs/heads/main refs/tags/main >actual &&
test_cmp expected actual
'
cat >expected <<\EOF
heads/master
master
heads/main
main
EOF
test_expect_success 'Check ambiguous head and tag refs (loose)' '
git config --bool core.warnambiguousrefs false &&
git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual &&
git for-each-ref --format "%(refname:short)" refs/heads/main refs/tags/main >actual &&
test_cmp expected actual
'
@ -571,7 +572,7 @@ ambiguous
EOF
test_expect_success 'Check ambiguous head and tag refs II (loose)' '
git checkout master &&
git checkout main &&
git tag ambiguous testtag^0 &&
git branch ambiguous testtag^0 &&
git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual &&
@ -705,8 +706,8 @@ body contents
$sig"
test_expect_success 'set up refs pointing to tree and blob' '
git update-ref refs/mytrees/first refs/heads/master^{tree} &&
git update-ref refs/myblobs/first refs/heads/master:one
git update-ref refs/mytrees/first refs/heads/main^{tree} &&
git update-ref refs/myblobs/first refs/heads/main:one
'
test_atom refs/mytrees/first subject ""
@ -778,7 +779,7 @@ test_expect_success 'equivalent sorts fall back on refname' '
'
test_expect_success 'do not dereference NULL upon %(HEAD) on unborn branch' '
test_when_finished "git checkout master" &&
test_when_finished "git checkout main" &&
git for-each-ref --format="%(HEAD) %(refname:short)" refs/heads/ >actual &&
sed -e "s/^\* / /" actual >expect &&
git checkout --orphan orphaned-branch &&
@ -815,9 +816,9 @@ test_expect_success '%(trailers:unfold) unfolds trailers' '
unfold <trailers
echo
} >expect &&
git for-each-ref --format="%(trailers:unfold)" refs/heads/master >actual &&
git for-each-ref --format="%(trailers:unfold)" refs/heads/main >actual &&
test_cmp expect actual &&
git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/master >actual &&
git for-each-ref --format="%(contents:trailers:unfold)" refs/heads/main >actual &&
test_cmp expect actual
'
@ -826,9 +827,9 @@ test_expect_success '%(trailers:only) shows only "key: value" trailers' '
grep -v patch.description <trailers &&
echo
} >expect &&
git for-each-ref --format="%(trailers:only)" refs/heads/master >actual &&
git for-each-ref --format="%(trailers:only)" refs/heads/main >actual &&
test_cmp expect actual &&
git for-each-ref --format="%(contents:trailers:only)" refs/heads/master >actual &&
git for-each-ref --format="%(contents:trailers:only)" refs/heads/main >actual &&
test_cmp expect actual
'
@ -837,13 +838,13 @@ test_expect_success '%(trailers:only) and %(trailers:unfold) work together' '
grep -v patch.description <trailers | unfold &&
echo
} >expect &&
git for-each-ref --format="%(trailers:only,unfold)" refs/heads/master >actual &&
git for-each-ref --format="%(trailers:only,unfold)" refs/heads/main >actual &&
test_cmp expect actual &&
git for-each-ref --format="%(trailers:unfold,only)" refs/heads/master >actual &&
git for-each-ref --format="%(trailers:unfold,only)" refs/heads/main >actual &&
test_cmp actual actual &&
git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/master >actual &&
git for-each-ref --format="%(contents:trailers:only,unfold)" refs/heads/main >actual &&
test_cmp expect actual &&
git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/master >actual &&
git for-each-ref --format="%(contents:trailers:unfold,only)" refs/heads/main >actual &&
test_cmp actual actual
'
@ -867,7 +868,7 @@ test_expect_success 'if arguments, %(contents:trailers) shows error if colon is
'
test_expect_success 'basic atom: head contents:trailers' '
git for-each-ref --format="%(contents:trailers)" refs/heads/master >actual &&
git for-each-ref --format="%(contents:trailers)" refs/heads/main >actual &&
sanitize_pgp <actual >actual.clean &&
# git for-each-ref ends with a blank line
cat >expect <<-EOF &&
@ -896,16 +897,16 @@ test_expect_success 'trailer parsing not fooled by --- line' '
echo "trailer: right" &&
echo
} >expect &&
git for-each-ref --format="%(trailers)" refs/heads/master >actual &&
git for-each-ref --format="%(trailers)" refs/heads/main >actual &&
test_cmp expect actual
'
test_expect_success 'Add symbolic ref for the following tests' '
git symbolic-ref refs/heads/sym refs/heads/master
git symbolic-ref refs/heads/sym refs/heads/main
'
cat >expected <<EOF
refs/heads/master
refs/heads/main
EOF
test_expect_success 'Verify usage of %(symref) atom' '
@ -914,7 +915,7 @@ test_expect_success 'Verify usage of %(symref) atom' '
'
cat >expected <<EOF
heads/master
heads/main
EOF
test_expect_success 'Verify usage of %(symref:short) atom' '
@ -923,8 +924,8 @@ test_expect_success 'Verify usage of %(symref:short) atom' '
'
cat >expected <<EOF
master
heads/master
main
heads/main
EOF
test_expect_success 'Verify usage of %(symref:lstrip) atom' '
@ -953,22 +954,23 @@ test_expect_success ':remotename and :remoteref' '
(
cd remote-tests &&
test_commit initial &&
git branch -M main &&
git remote add from fifth.coffee:blub &&
git config branch.master.remote from &&
git config branch.master.merge refs/heads/stable &&
git config branch.main.remote from &&
git config branch.main.merge refs/heads/stable &&
git remote add to southridge.audio:repo &&
git config remote.to.push "refs/heads/*:refs/heads/pushed/*" &&
git config branch.master.pushRemote to &&
git config branch.main.pushRemote to &&
for pair in "%(upstream)=refs/remotes/from/stable" \
"%(upstream:remotename)=from" \
"%(upstream:remoteref)=refs/heads/stable" \
"%(push)=refs/remotes/to/pushed/master" \
"%(push)=refs/remotes/to/pushed/main" \
"%(push:remotename)=to" \
"%(push:remoteref)=refs/heads/pushed/master"
"%(push:remoteref)=refs/heads/pushed/main"
do
echo "${pair#*=}" >expect &&
git for-each-ref --format="${pair%=*}" \
refs/heads/master >actual &&
refs/heads/main >actual &&
test_cmp expect actual
done &&
git branch push-simple &&
@ -981,12 +983,12 @@ test_expect_success ':remotename and :remoteref' '
'
test_expect_success 'for-each-ref --ignore-case ignores case' '
git for-each-ref --format="%(refname)" refs/heads/MASTER >actual &&
git for-each-ref --format="%(refname)" refs/heads/MAIN >actual &&
test_must_be_empty actual &&
echo refs/heads/master >expect &&
echo refs/heads/main >expect &&
git for-each-ref --format="%(refname)" --ignore-case \
refs/heads/MASTER >actual &&
refs/heads/MAIN >actual &&
test_cmp expect actual
'

View file

@ -9,6 +9,7 @@ This test exercises porcelain V2 output for git status.'
test_expect_success setup '
git checkout -f --orphan initial-branch &&
test_tick &&
git config core.autocrlf false &&
echo x >file_x &&
@ -22,7 +23,7 @@ test_expect_success setup '
test_expect_success 'before initial commit, nothing added, only untracked' '
cat >expect <<-EOF &&
# branch.oid (initial)
# branch.head master
# branch.head initial-branch
? actual
? dir1/
? expect
@ -45,7 +46,7 @@ test_expect_success 'before initial commit, things added' '
cat >expect <<-EOF &&
# branch.oid (initial)
# branch.head master
# branch.head initial-branch
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
@ -62,7 +63,7 @@ test_expect_success 'before initial commit, things added' '
test_expect_success 'before initial commit, things added (-z)' '
lf_to_nul >expect <<-EOF &&
# branch.oid (initial)
# branch.head master
# branch.head initial-branch
1 A. N... 000000 100644 100644 $ZERO_OID $OID_A dir1/file_a
1 A. N... 000000 100644 100644 $ZERO_OID $OID_B dir1/file_b
1 A. N... 000000 100644 100644 $ZERO_OID $OID_X file_x
@ -81,7 +82,7 @@ test_expect_success 'make first commit, comfirm HEAD oid and branch' '
H0=$(git rev-parse HEAD) &&
cat >expect <<-EOF &&
# branch.oid $H0
# branch.head master
# branch.head initial-branch
? actual
? expect
EOF
@ -98,7 +99,7 @@ test_expect_success 'after first commit, create unstaged changes' '
cat >expect <<-EOF &&
# branch.oid $H0
# branch.head master
# branch.head initial-branch
1 .M N... 100644 100644 100644 $OID_X $OID_X file_x
1 .D N... 100644 100644 000000 $OID_Z $OID_Z file_z
? actual
@ -126,7 +127,7 @@ test_expect_success 'after first commit, stage existing changes' '
cat >expect <<-EOF &&
# branch.oid $H0
# branch.head master
# branch.head initial-branch
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
? actual
@ -143,7 +144,7 @@ test_expect_success 'rename causes 2 path lines' '
q_to_tab >expect <<-EOF &&
# branch.oid $H0
# branch.head master
# branch.head initial-branch
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
@ -161,7 +162,7 @@ test_expect_success 'rename causes 2 path lines (-z)' '
## Lines use NUL path separator and line terminator, so double transform here.
q_to_nul <<-EOF | lf_to_nul >expect &&
# branch.oid $H0
# branch.head master
# branch.head initial-branch
1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
1 D. N... 100644 000000 000000 $OID_Z $ZERO_OID file_z
2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
@ -179,7 +180,7 @@ test_expect_success 'make second commit, confirm clean and new HEAD oid' '
cat >expect <<-EOF &&
# branch.oid $H1
# branch.head master
# branch.head initial-branch
? actual
? expect
EOF
@ -231,7 +232,7 @@ test_expect_success 'create and commit permanent ignore file' '
cat >expect <<-EOF &&
# branch.oid $H1
# branch.head master
# branch.head initial-branch
EOF
git status --porcelain=v2 --branch >actual &&
@ -257,14 +258,14 @@ test_expect_success 'verify --intent-to-add output' '
test_expect_success 'verify AA (add-add) conflict' '
test_when_finished "git reset --hard" &&
git branch AA_A master &&
git branch AA_A initial-branch &&
git checkout AA_A &&
echo "Branch AA_A" >conflict.txt &&
OID_AA_A=$(git hash-object -t blob -- conflict.txt) &&
git add conflict.txt &&
git commit -m "branch aa_a" &&
git branch AA_B master &&
git branch AA_B initial-branch &&
git checkout AA_B &&
echo "Branch AA_B" >conflict.txt &&
OID_AA_B=$(git hash-object -t blob -- conflict.txt) &&
@ -290,7 +291,7 @@ test_expect_success 'verify AA (add-add) conflict' '
test_expect_success 'verify UU (edit-edit) conflict' '
test_when_finished "git reset --hard" &&
git branch UU_ANC master &&
git branch UU_ANC initial-branch &&
git checkout UU_ANC &&
echo "Ancestor" >conflict.txt &&
OID_UU_ANC=$(git hash-object -t blob -- conflict.txt) &&
@ -328,18 +329,18 @@ test_expect_success 'verify UU (edit-edit) conflict' '
'
test_expect_success 'verify upstream fields in branch header' '
git checkout master &&
git checkout initial-branch &&
test_when_finished "rm -rf sub_repo" &&
git clone . sub_repo &&
(
## Confirm local master tracks remote master.
## Confirm local initial-branch tracks remote initial-branch.
cd sub_repo &&
HUF=$(git rev-parse HEAD) &&
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
EOF
@ -355,8 +356,8 @@ test_expect_success 'verify upstream fields in branch header' '
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +1 -0
EOF
@ -367,9 +368,9 @@ test_expect_success 'verify upstream fields in branch header' '
git status --porcelain=v2 --untracked-files=all >actual &&
test_must_be_empty actual &&
## Test upstream-gone case. Fake this by pointing origin/master at
## a non-existing commit.
OLD=$(git rev-parse origin/master) &&
## Test upstream-gone case. Fake this by pointing
## origin/initial-branch at a non-existing commit.
OLD=$(git rev-parse origin/initial-branch) &&
NEW=$ZERO_OID &&
mv .git/packed-refs .git/old-packed-refs &&
sed "s/$OLD/$NEW/g" <.git/old-packed-refs >.git/packed-refs &&
@ -378,8 +379,8 @@ test_expect_success 'verify upstream fields in branch header' '
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
EOF
git status --porcelain=v2 --branch --untracked-files=all >actual &&
@ -388,19 +389,19 @@ test_expect_success 'verify upstream fields in branch header' '
'
test_expect_success 'verify --[no-]ahead-behind with V2 format' '
git checkout master &&
git checkout initial-branch &&
test_when_finished "rm -rf sub_repo" &&
git clone . sub_repo &&
(
## Confirm local master tracks remote master.
## Confirm local initial-branch tracks remote initial-branch.
cd sub_repo &&
HUF=$(git rev-parse HEAD) &&
# Confirm --no-ahead-behind reports traditional branch.ab with 0/0 for equal branches.
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
EOF
@ -410,8 +411,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
# Confirm --ahead-behind reports traditional branch.ab with 0/0.
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
EOF
@ -428,8 +429,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
# Confirm --no-ahead-behind reports branch.ab with ?/? for non-equal branches.
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +? -?
EOF
@ -439,8 +440,8 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
# Confirm --ahead-behind reports traditional branch.ab with 1/0.
cat >expect <<-EOF &&
# branch.oid $HUF
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +1 -0
EOF
@ -458,7 +459,7 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
'
test_expect_success 'create and add submodule, submodule appears clean (A. S...)' '
git checkout master &&
git checkout initial-branch &&
git clone . sub_repo &&
git clone . super_repo &&
( cd super_repo &&
@ -471,8 +472,8 @@ test_expect_success 'create and add submodule, submodule appears clean (A. S...)
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 A. S... 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -496,8 +497,8 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S..U 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -521,8 +522,8 @@ test_expect_success 'staged changes in added submodule (AM S.M.)' '
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -548,8 +549,8 @@ test_expect_success 'staged and unstaged changes in added (AM S.M.)' '
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.M. 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -575,8 +576,8 @@ test_expect_success 'staged and untracked changes in added submodule (AM S.MU)'
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM S.MU 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -602,8 +603,8 @@ test_expect_success 'commit within the submodule appears as new commit in super
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +0 -0
1 A. N... 000000 100644 100644 $ZERO_OID $HMOD .gitmodules
1 AM SC.. 000000 160000 160000 $ZERO_OID $HSUB sub1
@ -625,8 +626,8 @@ test_expect_success 'stage submodule in super and commit' '
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +1 -0
EOF
@ -646,8 +647,8 @@ test_expect_success 'make unstaged changes in existing submodule (.M S.M.)' '
cat >expect <<-EOF &&
# branch.oid $HSUP
# branch.head master
# branch.upstream origin/master
# branch.head initial-branch
# branch.upstream origin/initial-branch
# branch.ab +1 -0
1 .M S.M. 160000 160000 160000 $HSUB $HSUB sub1
EOF

View file

@ -422,7 +422,7 @@ test_expect_success 'start from empty cron table' '
GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance start &&
# start registers the repo
git config --get --global maintenance.repo "$(pwd)" &&
git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
grep "for-each-repo --config=maintenance.repo maintenance run --schedule=daily" cron.txt &&
grep "for-each-repo --config=maintenance.repo maintenance run --schedule=hourly" cron.txt &&
@ -433,7 +433,7 @@ test_expect_success 'stop from existing schedule' '
GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop &&
# stop does not unregister the repo
git config --get --global maintenance.repo "$(pwd)" &&
git config --get --global --fixed-value maintenance.repo "$(pwd)" &&
# Operation is idempotent
GIT_TEST_CRONTAB="test-tool crontab cron.txt" git maintenance stop &&

View file

@ -1202,7 +1202,9 @@ test_create_repo () {
mkdir -p "$repo"
(
cd "$repo" || error "Cannot setup test environment"
"${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" init \
"${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" -c \
init.defaultBranch="${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}" \
init \
"--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled

View file

@ -156,7 +156,7 @@ static void upload_pack_data_clear(struct upload_pack_data *data)
string_list_clear(&data->deepen_not, 0);
object_array_clear(&data->extra_edge_obj);
list_objects_filter_release(&data->filter_options);
string_list_clear(&data->allowed_filters, 1);
string_list_clear(&data->allowed_filters, 0);
free((char *)data->pack_objects_hook);
}