diff options
-rw-r--r-- | Documentation/RelNotes/2.13.4.txt | 10 | ||||
-rw-r--r-- | Documentation/RelNotes/2.14.0.txt | 98 | ||||
-rw-r--r-- | Documentation/git-commit.txt | 11 | ||||
-rw-r--r-- | Documentation/i18n.txt | 10 | ||||
-rw-r--r-- | Makefile | 28 | ||||
-rw-r--r-- | alias.c | 2 | ||||
-rw-r--r-- | builtin/gc.c | 4 | ||||
-rw-r--r-- | compat/cygwin.c | 19 | ||||
-rw-r--r-- | compat/cygwin.h | 2 | ||||
-rw-r--r-- | config.mak.uname | 2 | ||||
-rw-r--r-- | git-compat-util.h | 3 | ||||
-rwxr-xr-x | git-p4.py | 94 | ||||
-rw-r--r-- | progress.c | 8 | ||||
-rw-r--r-- | sha1_file.c | 6 | ||||
-rwxr-xr-x | t/t0060-path-utils.sh | 2 | ||||
-rwxr-xr-x | t/t1300-repo-config.sh | 7 | ||||
-rwxr-xr-x | t/t6500-gc.sh | 21 | ||||
-rwxr-xr-x | t/t9831-git-p4-triggers.sh | 103 | ||||
-rw-r--r-- | t/test-lib-functions.sh | 1 | ||||
-rwxr-xr-x | templates/hooks--pre-rebase.sample | 6 |
20 files changed, 366 insertions, 71 deletions
diff --git a/Documentation/RelNotes/2.13.4.txt b/Documentation/RelNotes/2.13.4.txt new file mode 100644 index 0000000000..4f46ef6fca --- /dev/null +++ b/Documentation/RelNotes/2.13.4.txt @@ -0,0 +1,10 @@ +Git v2.13.4 Release Notes +========================= + +Fixes since v2.13.3 +------------------- + + * Update the character width tables. + + * A recent update broke an alias that contained an uppercase letter, + which has been fixed. diff --git a/Documentation/RelNotes/2.14.0.txt b/Documentation/RelNotes/2.14.0.txt index 60595ba0be..6544e7f82a 100644 --- a/Documentation/RelNotes/2.14.0.txt +++ b/Documentation/RelNotes/2.14.0.txt @@ -1,7 +1,7 @@ Git 2.14 Release Notes ====================== -Backward compatibility notes. +Backward compatibility notes and other notable changes. * Use of an empty string as a pathspec element that is used for 'everything matches' is still warned and Git asks users to use a @@ -22,6 +22,12 @@ Backward compatibility notes. diff output has finished, and the "indent heuristics" has now become the default. + * Git can now be built with PCRE v2 instead of v1 of the PCRE + library. Replace USE_LIBPCRE=YesPlease with USE_LIBPCRE2=YesPlease + in existing build scripts to build against the new version. As the + upstream PCRE maintainer has abandoned v1 maintenance for all but + the most critical bug fixes, use of v2 is recommended. + Updates since v2.13 ------------------- @@ -53,16 +59,16 @@ UI, Workflows & Features when the $sha1 names an object at the tip of an advertised ref, even when the other side hasn't enabled allowTipSHA1InWant. - * The recently introduced "[includeIf "gitdir:$dir"] path=..." - mechanism has further been taught to take symlinks into account. - The directory "$dir" specified in "gitdir:$dir" may be a symlink to - a real location, not something that $(getcwd) may return. In such - a case, a realpath of "$dir" is compared with the real path of the - current repository to determine if the contents from the named path - should be included. + * The "[includeIf "gitdir:$dir"] path=..." mechanism introduced in + 2.13.0 would canonicalize the path of the gitdir being matched, + and did not match e.g. "gitdir:~/work/*" against a repo in + "~/work/main" if "~/work" was a symlink to "/mnt/storage/work". + Now we match both the resolved canonical path and what "pwd" would + show. The include will happen if either one matches. - * Make the "indent" heuristics the default in "diff" and diff.indentHeuristics - configuration variable an escape hatch for those who do no want it. + * The "indent" heuristics is now the default in "diff". The + diff.indentHeuristic configuration variable can be set to "false" + for those who do not want it. * Many commands learned to pay attention to submodule.recurse configuration. @@ -91,8 +97,8 @@ UI, Workflows & Features would appear as a not-quite-initialized submodule to others. We learned to give warnings when this happens. - * "git status" learned to optionally give how many stash entries the - user has in its output. + * "git status" learned to optionally give how many stash entries there + are in its output. * "git status" has long shown essentially the same message as "git commit"; the message it gives while preparing for the root commit, @@ -101,9 +107,9 @@ UI, Workflows & Features (rather than the commit the user is preparing for, which is more in line with the focus of "git commit"). - * "git send-email" learned to overcome some SMTP server limitation - that does not allow many pieces of e-mails to be sent over a single - session. + * "git send-email" now has --batch-size and --relogin-delay options + which can be used to overcome limitations on SMTP servers that + restrict on how many of e-mails can be sent in a single session. * An old message shown in the commit log template was removed, as it has outlived its usefulness. @@ -111,6 +117,11 @@ UI, Workflows & Features * "git pull --rebase --recurse-submodules" learns to rebase the branch in the submodules to an updated base. + * "git log" learned -P as a synonym for --perl-regexp, "git grep" + already had such a synonym. + + * "git log" didn't understand --regexp-ignore-case when combined with + --perl-regexp. This has been fixed. Performance, Internal Implementation, Development Support etc. @@ -224,6 +235,27 @@ Performance, Internal Implementation, Development Support etc. behaviour of the comparison function can be specified at the time a hashmap is initialized. + * The "collision detecting" SHA-1 implementation shipped with 2.13 is + now integrated into git.git as a submodule (the first submodule to + ship with git.git). Clone git.git with --recurse-submodules to get + it. For now a non-submodule copy of the same code is also shipped + as part of the tree. + + * A recent update made it easier to use "-fsanitize=" option while + compiling but supported only one sanitize option. Allow more than + one to be combined, joined with a comma, like "make SANITIZE=foo,bar". + + * Use "p4 -G" to make "p4 changes" output more Python-friendly + to parse. + + * We started using "%" PRItime, imitating "%" PRIuMAX and friends, as + a way to format the internal timestamp value, but this does not + play well with gettext(1) i18n framework, and causes "make pot" + that is run by the l10n coordinator to create a broken po/git.pot + file. This is a possible workaround for that problem. + + * It turns out that Cygwin also needs the fopen() wrapper that + returns failure when a directory is opened for reading. Also contains various documentation updates and code clean-ups. @@ -425,19 +457,17 @@ notes for details). * A recent regression in "git rebase -i" has been fixed and tests that would have caught it and others have been added. - * An unaligned 32-bit access in pack-bitmap code ahs been corrected. + * An unaligned 32-bit access in pack-bitmap code has been corrected. * Tighten error checks for invalid "git apply" input. - * The split index code did not honor core.sharedrepository setting + * The split index code did not honor core.sharedRepository setting correctly. * The Makefile rule in contrib/subtree for building documentation learned to honour USE_ASCIIDOCTOR just like the main documentation set does. - * Update the sha1dc again to fix portability glitches. - * Code clean-up to fix possible buffer over-reading. (merge 2d105451c0 rs/apply-avoid-over-reading later to maint). @@ -459,7 +489,32 @@ notes for details). * The build procedure has been improved to allow building and testing Git with address sanitizer more easily. - (merge 566cf0b3bd jk/build-with-asan later to maint). + (merge 425ca6710b jk/build-with-asan later to maint). + + * On Cygwin, similar to Windows, "git push //server/share/repository" + ought to mean a repository on a network share that can be accessed + locally, but this did not work correctly due to stripping the double + slashes at the beginning. + (merge 496f256989 tb/push-to-cygwin-unc-path later to maint). + + * The progress meter did not give a useful output when we haven't had + 0.5 seconds to measure the throughput during the interval. Instead + show the overall throughput rate at the end, which is a much more + useful number. + (merge 0fae1e072a rs/progress-overall-throughput-at-the-end later to maint). + + * Code clean-up, that makes us in sync with Debian by one patch. + (merge 8db1ae5740 jn/hooks-pre-rebase-sample-fix later to maint). + + * We run an early part of "git gc" that deals with refs before + daemonising (and not under lock) even when running a background + auto-gc, which caused multiple gc processes attempting to run the + early part at the same time. This is now prevented by running the + early part also under the GC lock. + (merge c45af94dbc jk/gc-pre-detach-under-hook later to maint). + + * A recent update broke an alias that contained an uppercase letter. + (merge 643df7e234 js/alias-case-sensitivity later to maint). * Other minor doc, test and build updates and code cleanups. (merge 3f9c637ec7 pw/unquote-path-in-git-pm later to maint). @@ -467,3 +522,6 @@ notes for details). (merge 42c78a216e rs/use-div-round-up later to maint). (merge 5e8d2729ae rs/wt-status-cleanup later to maint). (merge 01826066b0 ks/fix-rebase-doc-picture later to maint). + (merge f7f6dc340e jk/test-copy-bytes-fix later to maint). + (merge 9fb9495dae ew/fd-cloexec-fix later to maint). + (merge 3a33fe5c97 ks/doc-fixes later to maint). diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt index afb06adba4..8c74a2ca03 100644 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@ -196,11 +196,12 @@ whitespace:: verbatim:: Do not change the message at all. scissors:: - Same as `whitespace`, except that everything from (and - including) the line - "`# ------------------------ >8 ------------------------`" - is truncated if the message is to be edited. "`#`" can be - customized with core.commentChar. + Same as `whitespace` except that everything from (and including) + the line found below is truncated, if the message is to be edited. + "`#`" can be customized with core.commentChar. + + # ------------------------ >8 ------------------------ + default:: Same as `strip` if the message is to be edited. Otherwise `whitespace`. diff --git a/Documentation/i18n.txt b/Documentation/i18n.txt index 2dd79db5cb..7e36e5b55b 100644 --- a/Documentation/i18n.txt +++ b/Documentation/i18n.txt @@ -42,11 +42,11 @@ mind. + ------------ [i18n] - commitencoding = ISO-8859-1 + commitEncoding = ISO-8859-1 ------------ + Commit objects created with the above setting record the value -of `i18n.commitencoding` in its `encoding` header. This is to +of `i18n.commitEncoding` in its `encoding` header. This is to help other people who look at them later. Lack of this header implies that the commit log message is encoded in UTF-8. @@ -54,15 +54,15 @@ implies that the commit log message is encoded in UTF-8. `encoding` header of a commit object, and try to re-code the log message into UTF-8 unless otherwise specified. You can specify the desired output encoding with - `i18n.logoutputencoding` in `.git/config` file, like this: + `i18n.logOutputEncoding` in `.git/config` file, like this: + ------------ [i18n] - logoutputencoding = ISO-8859-1 + logOutputEncoding = ISO-8859-1 ------------ + If you do not have this configuration variable, the value of -`i18n.commitencoding` is used instead. +`i18n.commitEncoding` is used instead. Note that we deliberately chose not to re-code the commit log message when a commit is made to force UTF-8 at the commit @@ -1022,10 +1022,15 @@ ifdef DEVELOPER CFLAGS += $(DEVELOPER_CFLAGS) endif +comma := , +empty := +space := $(empty) $(empty) + ifdef SANITIZE +SANITIZERS := $(foreach flag,$(subst $(comma),$(space),$(SANITIZE)),$(flag)) BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE) BASIC_CFLAGS += -fno-omit-frame-pointer -ifeq ($(SANITIZE),undefined) +ifneq ($(filter undefined,$(SANITIZERS)),) BASIC_CFLAGS += -DNO_UNALIGNED_LOADS endif endif @@ -2216,12 +2221,33 @@ LOCALIZED_SH += t/t0200/test.sh LOCALIZED_PERL += t/t0200/test.perl endif +## Note that this is meant to be run only by the localization coordinator +## under a very controlled condition, i.e. (1) it is to be run in a +## Git repository (not a tarball extract), (2) any local modifications +## will be lost. +## Gettext tools cannot work with our own custom PRItime type, so +## we replace PRItime with PRIuMAX. We need to update this to +## PRIdMAX if we switch to a signed type later. + po/git.pot: $(GENERATED_H) FORCE + # All modifications will be reverted at the end, so we do not + # want to have any local change. + git diff --quiet HEAD && git diff --quiet --cached + + @for s in $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL); \ + do \ + sed -e 's|PRItime|PRIuMAX|g' <"$$s" >"$$s+" && \ + cat "$$s+" >"$$s" && rm "$$s+"; \ + done + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \ $(LOCALIZED_SH) $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \ $(LOCALIZED_PERL) + + # Reverting the munged source, leaving only the updated $@ + git reset --hard mv $@+ $@ .PHONY: pot @@ -11,7 +11,7 @@ static int config_alias_cb(const char *key, const char *value, void *d) struct config_alias_data *data = d; const char *p; - if (skip_prefix(key, "alias.", &p) && !strcmp(p, data->alias)) + if (skip_prefix(key, "alias.", &p) && !strcasecmp(p, data->alias)) return git_config_string((const char **)&data->v, key, value); return 0; diff --git a/builtin/gc.c b/builtin/gc.c index 2ba50a2873..e6b84475ae 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -414,8 +414,12 @@ int cmd_gc(int argc, const char **argv, const char *prefix) if (report_last_gc_error()) return -1; + if (lock_repo_for_gc(force, &pid)) + return 0; if (gc_before_repack()) return -1; + delete_tempfile(&pidfile); + /* * failure to daemonize is ok, we'll continue * in foreground diff --git a/compat/cygwin.c b/compat/cygwin.c new file mode 100644 index 0000000000..b9862d606d --- /dev/null +++ b/compat/cygwin.c @@ -0,0 +1,19 @@ +#include "../git-compat-util.h" +#include "../cache.h" + +int cygwin_offset_1st_component(const char *path) +{ + const char *pos = path; + /* unc paths */ + if (is_dir_sep(pos[0]) && is_dir_sep(pos[1])) { + /* skip server name */ + pos = strchr(pos + 2, '/'); + if (!pos) + return 0; /* Error: malformed unc path */ + + do { + pos++; + } while (*pos && pos[0] != '/'); + } + return pos + is_dir_sep(*pos) - path; +} diff --git a/compat/cygwin.h b/compat/cygwin.h new file mode 100644 index 0000000000..8e52de4644 --- /dev/null +++ b/compat/cygwin.h @@ -0,0 +1,2 @@ +int cygwin_offset_1st_component(const char *path); +#define offset_1st_component cygwin_offset_1st_component diff --git a/config.mak.uname b/config.mak.uname index adfb90b601..6604b130f8 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -184,6 +184,8 @@ ifeq ($(uname_O),Cygwin) UNRELIABLE_FSTAT = UnfortunatelyYes SPARSE_FLAGS = -isystem /usr/include/w32api -Wno-one-bit-signed-bitfield OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo + COMPAT_OBJS += compat/cygwin.o + FREAD_READS_DIRECTORIES = UnfortunatelyYes endif ifeq ($(uname_S),FreeBSD) NEEDS_LIBICONV = YesPlease diff --git a/git-compat-util.h b/git-compat-util.h index 047172d173..db9c22de76 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -189,6 +189,9 @@ #include <sys/sysctl.h> #endif +#if defined(__CYGWIN__) +#include "compat/cygwin.h" +#endif #if defined(__MINGW32__) /* pull in Windows compatibility stuff */ #include "compat/mingw.h" @@ -313,7 +313,7 @@ def p4_move(src, dest): p4_system(["move", "-k", wildcard_encode(src), wildcard_encode(dest)]) def p4_last_change(): - results = p4CmdList(["changes", "-m", "1"]) + results = p4CmdList(["changes", "-m", "1"], skip_info=True) return int(results[0]['change']) def p4_describe(change): @@ -321,7 +321,7 @@ def p4_describe(change): the presence of field "time". Return a dict of the results.""" - ds = p4CmdList(["describe", "-s", str(change)]) + ds = p4CmdList(["describe", "-s", str(change)], skip_info=True) if len(ds) != 1: die("p4 describe -s %d did not return 1 result: %s" % (change, str(ds))) @@ -509,7 +509,7 @@ def isModeExec(mode): def isModeExecChanged(src_mode, dst_mode): return isModeExec(src_mode) != isModeExec(dst_mode) -def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None): +def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False): if isinstance(cmd,basestring): cmd = "-G " + cmd @@ -545,6 +545,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None): try: while True: entry = marshal.load(p4.stdout) + if skip_info: + if 'code' in entry and entry['code'] == 'info': + continue if cb is not None: cb(entry) else: @@ -879,8 +882,12 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize): cmd += ["%s...@%s" % (p, revisionRange)] # Insert changes in chronological order - for line in reversed(p4_read_pipe_lines(cmd)): - changes.add(int(line.split(" ")[1])) + for entry in reversed(p4CmdList(cmd)): + if entry.has_key('p4ExitCode'): + die('Error retrieving changes descriptions ({})'.format(entry['p4ExitCode'])) + if not entry.has_key('change'): + continue + changes.add(int(entry['change'])) if not block_size: break @@ -1526,37 +1533,62 @@ class P4Submit(Command, P4UserMap): [upstream, settings] = findUpstreamBranchPoint() - template = "" + template = """\ +# A Perforce Change Specification. +# +# Change: The change number. 'new' on a new changelist. +# Date: The date this specification was last modified. +# Client: The client on which the changelist was created. Read-only. +# User: The user who created the changelist. +# Status: Either 'pending' or 'submitted'. Read-only. +# Type: Either 'public' or 'restricted'. Default is 'public'. +# Description: Comments about the changelist. Required. +# Jobs: What opened jobs are to be closed by this changelist. +# You may delete jobs from this list. (New changelists only.) +# Files: What opened files from the default changelist are to be added +# to this changelist. You may delete files from this list. +# (New changelists only.) +""" + files_list = [] inFilesSection = False + change_entry = None args = ['change', '-o'] if changelist: args.append(str(changelist)) - - for line in p4_read_pipe_lines(args): - if line.endswith("\r\n"): - line = line[:-2] + "\n" - if inFilesSection: - if line.startswith("\t"): - # path starts and ends with a tab - path = line[1:] - lastTab = path.rfind("\t") - if lastTab != -1: - path = path[:lastTab] - if settings.has_key('depot-paths'): - if not [p for p in settings['depot-paths'] - if p4PathStartsWith(path, p)]: - continue - else: - if not p4PathStartsWith(path, self.depotPath): - continue + for entry in p4CmdList(args): + if not entry.has_key('code'): + continue + if entry['code'] == 'stat': + change_entry = entry + break + if not change_entry: + die('Failed to decode output of p4 change -o') + for key, value in change_entry.iteritems(): + if key.startswith('File'): + if settings.has_key('depot-paths'): + if not [p for p in settings['depot-paths'] + if p4PathStartsWith(value, p)]: + continue else: - inFilesSection = False - else: - if line.startswith("Files:"): - inFilesSection = True - - template += line - + if not p4PathStartsWith(value, self.depotPath): + continue + files_list.append(value) + continue + # Output in the order expected by prepareLogMessage + for key in ['Change', 'Client', 'User', 'Status', 'Description', 'Jobs']: + if not change_entry.has_key(key): + continue + template += '\n' + template += key + ':' + if key == 'Description': + template += '\n' + for field_line in change_entry[key].splitlines(): + template += '\t'+field_line+'\n' + if len(files_list) > 0: + template += '\n' + template += 'Files:\n' + for path in files_list: + template += '\t'+path+'\n' return template def edit_template(self, template_file): diff --git a/progress.c b/progress.c index 29378caa05..73e36d4a42 100644 --- a/progress.c +++ b/progress.c @@ -36,6 +36,7 @@ struct progress { unsigned delay; unsigned delayed_percent_treshold; struct throughput *throughput; + uint64_t start_ns; }; static volatile sig_atomic_t progress_update; @@ -221,6 +222,7 @@ struct progress *start_progress_delay(const char *title, unsigned total, progress->delayed_percent_treshold = percent_treshold; progress->delay = delay; progress->throughput = NULL; + progress->start_ns = getnanotime(); set_progress_signal(); return progress; } @@ -247,8 +249,10 @@ void stop_progress_msg(struct progress **p_progress, const char *msg) struct throughput *tp = progress->throughput; if (tp) { - unsigned int rate = !tp->avg_misecs ? 0 : - tp->avg_bytes / tp->avg_misecs; + uint64_t now_ns = getnanotime(); + unsigned int misecs, rate; + misecs = ((now_ns - progress->start_ns) * 4398) >> 32; + rate = tp->curr_total / (misecs ? misecs : 1); throughput_string(&tp->display, tp->curr_total, rate); } progress_update = 1; diff --git a/sha1_file.c b/sha1_file.c index fca165f13c..b60ae15f70 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1684,14 +1684,14 @@ int git_open_cloexec(const char *name, int flags) fd = open(name, flags | o_cloexec); } -#if defined(F_GETFL) && defined(F_SETFL) && defined(FD_CLOEXEC) +#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) { static int fd_cloexec = FD_CLOEXEC; if (!o_cloexec && 0 <= fd && fd_cloexec) { /* Opened w/o O_CLOEXEC? try with fcntl(2) to add it */ - int flags = fcntl(fd, F_GETFL); - if (fcntl(fd, F_SETFL, flags | fd_cloexec)) + int flags = fcntl(fd, F_GETFD); + if (fcntl(fd, F_SETFD, flags | fd_cloexec)) fd_cloexec = 0; } } diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh index 444b5a4df8..7ea2bb515b 100755 --- a/t/t0060-path-utils.sh +++ b/t/t0060-path-utils.sh @@ -70,6 +70,8 @@ ancestor() { case $(uname -s) in *MINGW*) ;; +*CYGWIN*) + ;; *) test_set_prereq POSIX ;; diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index a37ef04222..364a537000 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -1075,6 +1075,13 @@ test_expect_success 'git -c works with aliases of builtins' ' test_cmp expect actual ' +test_expect_success 'aliases can be CamelCased' ' + test_config alias.CamelCased "rev-parse HEAD" && + git CamelCased >out && + git rev-parse HEAD >expect && + test_cmp expect out +' + test_expect_success 'git -c does not split values on equals' ' echo "value with = in it" >expect && git -c core.foo="value with = in it" config core.foo >actual && diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index cc7acd101d..41b0be575d 100755 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@ -95,6 +95,27 @@ test_expect_success 'background auto gc does not run if gc.log is present and re test_line_count = 1 packs ' +test_expect_success 'background auto gc respects lock for all operations' ' + # make sure we run a background auto-gc + test_commit make-pack && + git repack && + test_config gc.autopacklimit 1 && + test_config gc.autodetach true && + + # create a ref whose loose presence we can use to detect a pack-refs run + git update-ref refs/heads/should-be-loose HEAD && + test_path_is_file .git/refs/heads/should-be-loose && + + # now fake a concurrent gc that holds the lock; we can use our + # shell pid so that it looks valid. + hostname=$(hostname || echo unknown) && + printf "$$ %s" "$hostname" >.git/gc.pid && + + # our gc should exit zero without doing anything + run_and_wait_for_auto_gc && + test_path_is_file .git/refs/heads/should-be-loose +' + # DO NOT leave a detached auto gc process running near the end of the # test script: it can run long enough in the background to racily # interfere with the cleanup in 'test_done'. diff --git a/t/t9831-git-p4-triggers.sh b/t/t9831-git-p4-triggers.sh new file mode 100755 index 0000000000..bbcf14c664 --- /dev/null +++ b/t/t9831-git-p4-triggers.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +test_description='git p4 with server triggers' + +. ./lib-git-p4.sh + +test_expect_success 'start p4d' ' + start_p4d +' + +test_expect_success 'init depot' ' + ( + cd "$cli" && + echo file1 >file1 && + p4 add file1 && + p4 submit -d "change 1" + echo file2 >file2 && + p4 add file2 && + p4 submit -d "change 2" + ) +' + +test_expect_success 'clone with extra info lines from verbose p4 trigger' ' + test_when_finished cleanup_git && + ( + p4 triggers -i <<-EOF + Triggers: p4triggertest-command command pre-user-change "echo verbose trigger" + EOF + ) && + ( + p4 change -o | grep -s "verbose trigger" + ) && + git p4 clone --dest="$git" //depot/@all && + ( + p4 triggers -i <<-EOF + Triggers: + EOF + ) +' + +test_expect_success 'import with extra info lines from verbose p4 trigger' ' + test_when_finished cleanup_git && + ( + cd "$cli" && + echo file3 >file3 && + p4 add file3 && + p4 submit -d "change 3" + ) && + ( + p4 triggers -i <<-EOF + Triggers: p4triggertest-command command pre-user-describe "echo verbose trigger" + EOF + ) && + ( + p4 describe 1 | grep -s "verbose trigger" + ) && + git p4 clone --dest="$git" //depot/@all && + ( + cd "$git" && + git p4 sync + )&& + ( + p4 triggers -i <<-EOF + Triggers: + EOF + ) +' + +test_expect_success 'submit description with extra info lines from verbose p4 change trigger' ' + test_when_finished cleanup_git && + ( + p4 triggers -i <<-EOF + Triggers: p4triggertest-command command pre-user-change "echo verbose trigger" + EOF + ) && + ( + p4 change -o | grep -s "verbose trigger" + ) && + git p4 clone --dest="$git" //depot && + ( + cd "$git" && + git config git-p4.skipSubmitEdit true && + echo file4 >file4 && + git add file4 && + git commit -m file4 && + git p4 submit + ) && + ( + p4 triggers -i <<-EOF + Triggers: + EOF + ) && + ( + cd "$cli" && + test_path_is_file file4 + ) +' + +test_expect_success 'kill p4d' ' + kill_p4d +' + +test_done diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index db622c3555..50a9a1d1c4 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -999,6 +999,7 @@ test_copy_bytes () { my $s; my $nread = sysread(STDIN, $s, $len); die "cannot read: $!" unless defined($nread); + last unless $nread; print $s; $len -= $nread; } diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks--pre-rebase.sample index 053f1111c0..b7f81c198e 100755 --- a/templates/hooks--pre-rebase.sample +++ b/templates/hooks--pre-rebase.sample @@ -88,9 +88,7 @@ else exit 1 fi -exit 0 - -################################################################ +<<\DOC_END This sample hook safeguards topic branches that have been published from being rewound. @@ -167,3 +165,5 @@ To compute (2): git rev-list master..topic if this is empty, it is fully merged to "master". + +DOC_END |