summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/Makefile4
-rw-r--r--Documentation/config.txt6
-rw-r--r--Documentation/git-pack-objects.txt3
-rw-r--r--Documentation/manpage-1.72.xsl17
-rw-r--r--builtin-fsck.c6
-rw-r--r--builtin-init-db.c6
-rw-r--r--builtin-pack-objects.c10
-rw-r--r--config.c6
-rwxr-xr-xcontrib/completion/git-completion.bash37
-rw-r--r--contrib/emacs/git.el188
-rwxr-xr-xcontrib/fast-import/git-p4102
-rwxr-xr-xgit-remote.perl10
-rwxr-xr-xgit-svn.perl31
-rw-r--r--git.spec.in5
-rwxr-xr-xgitweb/gitweb.perl4
-rw-r--r--object.c12
-rw-r--r--t/README14
-rwxr-xr-xt/t0000-basic.sh30
-rwxr-xr-xt/t0030-stripspace.sh40
-rwxr-xr-xt/t0040-parse-options.sh4
-rwxr-xr-xt/t1000-read-tree-m-3way.sh161
-rwxr-xr-xt/t1200-tutorial.sh8
-rwxr-xr-xt/t1300-repo-config.sh62
-rwxr-xr-xt/t1302-repo-version.sh5
-rwxr-xr-xt/t1400-update-ref.sh24
-rwxr-xr-xt/t2000-checkout-cache-clash.sh4
-rwxr-xr-xt/t2002-checkout-cache-u.sh4
-rwxr-xr-xt/t2008-checkout-subdir.sh16
-rwxr-xr-xt/t2100-update-cache-badpath.sh4
-rwxr-xr-xt/t3020-ls-files-error-unmatch.sh4
-rwxr-xr-xt/t3200-branch.sh36
-rwxr-xr-xt/t3210-pack-refs.sh26
-rwxr-xr-xt/t3400-rebase.sh4
-rwxr-xr-xt/t3403-rebase-skip.sh6
-rwxr-xr-xt/t3600-rm.sh17
-rwxr-xr-xt/t4103-apply-binary.sh68
-rwxr-xr-xt/t4113-apply-ending.sh8
-rwxr-xr-xt/t5300-pack-object.sh10
-rwxr-xr-xt/t5302-pack-index.sh32
-rwxr-xr-xt/t5401-update-hooks.sh8
-rwxr-xr-xt/t5402-post-merge-hook.sh4
-rwxr-xr-xt/t5500-fetch-pack.sh4
-rwxr-xr-xt/t5510-fetch.sh12
-rwxr-xr-xt/t5530-upload-pack-error.sh14
-rwxr-xr-xt/t5600-clone-fail-cleanup.sh12
-rwxr-xr-xt/t5710-info-alternate.sh14
-rwxr-xr-xt/t6009-rev-list-parent.sh38
-rwxr-xr-xt/t6023-merge-file.sh12
-rwxr-xr-xt/t6024-recursive-merge.sh2
-rwxr-xr-xt/t6025-merge-symlinks.sh21
-rwxr-xr-xt/t6101-rev-parse-parents.sh2
-rwxr-xr-xt/t6300-for-each-ref.sh8
-rwxr-xr-xt/t7001-mv.sh4
-rwxr-xr-xt/t7002-grep.sh4
-rwxr-xr-xt/t7004-tag.sh36
-rwxr-xr-xt/t7101-reset.sh24
-rwxr-xr-xt/t7201-co.sh16
-rwxr-xr-xt/t7501-commit.sh40
-rwxr-xr-xt/t7503-pre-commit-hook.sh4
-rwxr-xr-xt/t7504-commit-msg-hook.sh8
-rwxr-xr-xt/t9100-git-svn-basic.sh28
-rwxr-xr-xt/t9106-git-svn-commit-diff-clobber.sh18
-rwxr-xr-xt/t9106-git-svn-dcommit-clobber-series.sh4
-rwxr-xr-xt/t9300-fast-import.sh24
-rwxr-xr-xt/t9400-git-cvsserver-server.sh30
-rw-r--r--t/test-lib.sh37
-rw-r--r--transport.c7
67 files changed, 898 insertions, 571 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 7a325462ee..43781fb248 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -45,6 +45,7 @@ man7dir=$(mandir)/man7
ASCIIDOC=asciidoc
ASCIIDOC_EXTRA =
+MANPAGE_XSL = callouts.xsl
INSTALL?=install
RM ?= rm -f
DOC_REF = origin/man
@@ -65,6 +66,7 @@ ASCIIDOC_EXTRA += -a asciidoc7compatible
endif
ifdef DOCBOOK_XSL_172
ASCIIDOC_EXTRA += -a docbook-xsl-172
+MANPAGE_XSL = manpage-1.72.xsl
endif
#
@@ -159,7 +161,7 @@ $(MAN_HTML): %.html : %.txt
%.1 %.5 %.7 : %.xml
$(RM) $@
- xmlto -m callouts.xsl man $<
+ xmlto -m $(MANPAGE_XSL) man $<
%.xml : %.txt
$(RM) $@+ $@
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 4e222f15a5..3e10feb9fb 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -766,6 +766,12 @@ pack.indexVersion::
whenever the corresponding pack is larger than 2 GB. Otherwise
the default is 1.
+pack.packSizeLimit:
+ The default maximum size of a pack. This setting only affects
+ packing to a file, i.e. the git:// protocol is unaffected. It
+ can be overridden by the `\--max-pack-size` option of
+ linkgit:git-repack[1].
+
pull.octopus::
The default merge strategy to use when pulling multiple branches
at once.
diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index 74cc7c1cb8..8353be186f 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -99,7 +99,8 @@ base-name::
--max-pack-size=<n>::
Maximum size of each output packfile, expressed in MiB.
If specified, multiple packfiles may be created.
- The default is unlimited.
+ The default is unlimited, unless the config variable
+ `pack.packSizeLimit` is set.
--incremental::
This flag causes an object already in a pack ignored
diff --git a/Documentation/manpage-1.72.xsl b/Documentation/manpage-1.72.xsl
new file mode 100644
index 0000000000..fe3cd72d6f
--- /dev/null
+++ b/Documentation/manpage-1.72.xsl
@@ -0,0 +1,17 @@
+<!-- callout.xsl: converts asciidoc callouts to man page format -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:template match="co">
+ <xsl:value-of select="concat('&#x2593;fB(',substring-after(@id,'-'),')&#x2593;fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+ <xsl:text>&#x2302;sp&#10;</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>&#10;</xsl:text>
+</xsl:template>
+<xsl:template match="callout">
+ <xsl:value-of select="concat('&#x2593;fB',substring-after(@arearefs,'-'),'. &#x2593;fR')"/>
+ <xsl:apply-templates/>
+ <xsl:text>&#x2302;br&#10;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 2a6e94deaf..8c564345f4 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -360,6 +360,9 @@ static int fsck_commit(struct commit *commit)
fprintf(stderr, "Checking commit %s\n",
sha1_to_hex(commit->object.sha1));
+ if (!commit->date)
+ return objerror(&commit->object, "invalid author/committer line");
+
if (memcmp(buffer, "tree ", 5))
return objerror(&commit->object, "invalid format - expected 'tree' line");
if (get_sha1_hex(buffer+5, tree_sha1) || buffer[45] != '\n')
@@ -378,9 +381,6 @@ static int fsck_commit(struct commit *commit)
return objerror(&commit->object, "could not load commit's tree %s", tree_sha1);
if (!commit->parents && show_root)
printf("root %s\n", sha1_to_hex(commit->object.sha1));
- if (!commit->date)
- printf("bad commit date in %s\n",
- sha1_to_hex(commit->object.sha1));
return 0;
}
diff --git a/builtin-init-db.c b/builtin-init-db.c
index e1393b8d1e..5d7cdda933 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -141,9 +141,9 @@ static void copy_templates(const char *git_dir, int len, const char *template_di
*/
template_dir = DEFAULT_GIT_TEMPLATE_DIR;
if (!is_absolute_path(template_dir)) {
- const char *exec_path = git_exec_path();
- template_dir = prefix_path(exec_path, strlen(exec_path),
- template_dir);
+ struct strbuf d = STRBUF_INIT;
+ strbuf_addf(&d, "%s/%s", git_exec_path(), template_dir);
+ template_dir = strbuf_detach(&d, NULL);
}
}
strcpy(template_path, template_dir);
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index d3efeff03f..692a76126b 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -68,7 +68,7 @@ static int allow_ofs_delta;
static const char *base_name;
static int progress = 1;
static int window = 10;
-static uint32_t pack_size_limit;
+static uint32_t pack_size_limit, pack_size_limit_cfg;
static int depth = 50;
static int delta_search_threads = 1;
static int pack_to_stdout;
@@ -1867,6 +1867,10 @@ static int git_pack_config(const char *k, const char *v)
die("bad pack.indexversion=%d", pack_idx_default_version);
return 0;
}
+ if (!strcmp(k, "pack.packsizelimit")) {
+ pack_size_limit_cfg = git_config_ulong(k, v);
+ return 0;
+ }
return git_default_config(k, v);
}
@@ -2096,6 +2100,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
}
if (!prefixcmp(arg, "--max-pack-size=")) {
char *end;
+ pack_size_limit_cfg = 0;
pack_size_limit = strtoul(arg+16, &end, 0) * 1024 * 1024;
if (!arg[16] || *end)
usage(pack_usage);
@@ -2220,6 +2225,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (pack_to_stdout != !base_name)
usage(pack_usage);
+ if (!pack_to_stdout && !pack_size_limit)
+ pack_size_limit = pack_size_limit_cfg;
+
if (pack_to_stdout && pack_size_limit)
die("--max-pack-size cannot be used to build a pack for transfer.");
diff --git a/config.c b/config.c
index 526a3f4294..498259ebef 100644
--- a/config.c
+++ b/config.c
@@ -484,9 +484,9 @@ const char *git_etc_gitconfig(void)
system_wide = ETC_GITCONFIG;
if (!is_absolute_path(system_wide)) {
/* interpret path relative to exec-dir */
- const char *exec_path = git_exec_path();
- system_wide = prefix_path(exec_path, strlen(exec_path),
- system_wide);
+ struct strbuf d = STRBUF_INIT;
+ strbuf_addf(&d, "%s/%s", git_exec_path(), system_wide);
+ system_wide = strbuf_detach(&d, NULL);
}
}
return system_wide;
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0d33f9a3dc..4ea727b143 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -64,12 +64,41 @@ __gitdir ()
__git_ps1 ()
{
- local b="$(git symbolic-ref HEAD 2>/dev/null)"
- if [ -n "$b" ]; then
+ local g="$(git rev-parse --git-dir 2>/dev/null)"
+ if [ -n "$g" ]; then
+ local r
+ local b
+ if [ -d "$g/../.dotest" ]
+ then
+ r="|AM/REBASE"
+ b="$(git symbolic-ref HEAD 2>/dev/null)"
+ elif [ -f "$g/.dotest-merge/interactive" ]
+ then
+ r="|REBASE-i"
+ b="$(cat $g/.dotest-merge/head-name)"
+ elif [ -d "$g/.dotest-merge" ]
+ then
+ r="|REBASE-m"
+ b="$(cat $g/.dotest-merge/head-name)"
+ elif [ -f "$g/MERGE_HEAD" ]
+ then
+ r="|MERGING"
+ b="$(git symbolic-ref HEAD 2>/dev/null)"
+ else
+ if [ -f $g/BISECT_LOG ]
+ then
+ r="|BISECTING"
+ fi
+ if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
+ then
+ b="$(cut -c1-7 $g/HEAD)..."
+ fi
+ fi
+
if [ -n "$1" ]; then
- printf "$1" "${b##refs/heads/}"
+ printf "$1" "${b##refs/heads/}$r"
else
- printf " (%s)" "${b##refs/heads/}"
+ printf " (%s)" "${b##refs/heads/}$r"
fi
fi
}
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index d8a06381f4..a8bf0ef883 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -35,7 +35,6 @@
;;
;; TODO
;; - portability to XEmacs
-;; - better handling of subprocess errors
;; - diff against other branch
;; - renaming files from the status buffer
;; - creating tags
@@ -191,6 +190,18 @@ if there is already one that displays the same directory."
(append (git-get-env-strings env) (list "git") args))
(apply #'call-process "git" nil buffer nil args)))
+(defun git-call-process-display-error (&rest args)
+ "Wrapper for call-process that displays error messages."
+ (let* ((dir default-directory)
+ (buffer (get-buffer-create "*Git Command Output*"))
+ (ok (with-current-buffer buffer
+ (let ((default-directory dir)
+ (buffer-read-only nil))
+ (erase-buffer)
+ (eq 0 (apply 'call-process "git" nil (list buffer t) nil args))))))
+ (unless ok (display-message-or-buffer buffer))
+ ok))
+
(defun git-call-process-env-string (env &rest args)
"Wrapper for call-process that sets environment strings,
and returns the process output as a string."
@@ -377,7 +388,7 @@ and returns the process output as a string."
(when reason
(push reason args)
(push "-m" args))
- (eq 0 (apply #'git-call-process-env nil nil "update-ref" args))))
+ (apply 'git-call-process-display-error "update-ref" args)))
(defun git-read-tree (tree &optional index-file)
"Read a tree into the index file."
@@ -558,12 +569,15 @@ and returns the process output as a string."
(?\100 " (type change file -> subproject)")
(?\120 " (type change symlink -> subproject)")
(t " (subproject)")))
+ (?\110 nil) ;; directory (internal, not a real git state)
(?\000 ;; deleted or unknown
(case old-type
(?\120 " (symlink)")
(?\160 " (subproject)")))
(t (format " (unknown type %o)" new-type)))))
- (if str (propertize str 'face 'git-status-face) "")))
+ (cond (str (propertize str 'face 'git-status-face))
+ ((eq new-type ?\110) "/")
+ (t ""))))
(defun git-rename-as-string (info)
"Return a string describing the copy or rename associated with INFO, or an empty string if none."
@@ -666,9 +680,11 @@ Return the list of files that haven't been handled."
(with-temp-buffer
(apply #'git-call-process-env t nil "ls-files" "-z" (append options (list "--") files))
(goto-char (point-min))
- (while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
+ (while (re-search-forward "\\([^\0]*?\\)\\(/?\\)\0" nil t 1)
(let ((name (match-string 1)))
- (push (git-create-fileinfo default-state name) infolist)
+ (push (git-create-fileinfo default-state name 0
+ (if (string-equal "/" (match-string 2)) (lsh ?\110 9) 0))
+ infolist)
(setq files (delete name files)))))
(git-insert-info-list status infolist)
files))
@@ -713,7 +729,7 @@ Return the list of files that haven't been handled."
(defun git-run-ls-files-with-excludes (status files default-state &rest options)
"Run git-ls-files on FILES with appropriate --exclude-from options."
(let ((exclude-files (git-get-exclude-files)))
- (apply #'git-run-ls-files status files default-state
+ (apply #'git-run-ls-files status files default-state "--directory"
(concat "--exclude-per-directory=" git-per-dir-ignore-file)
(append options (mapcar (lambda (f) (concat "--exclude-from=" f)) exclude-files)))))
@@ -735,6 +751,27 @@ Return the list of files that haven't been handled."
(git-refresh-files)
(git-refresh-ewoc-hf git-status)))
+(defun git-mark-files (status files)
+ "Mark all the specified FILES, and unmark the others."
+ (setq files (sort files #'string-lessp))
+ (let ((file (and files (pop files)))
+ (node (ewoc-nth status 0)))
+ (while node
+ (let ((info (ewoc-data node)))
+ (if (and file (string-equal (git-fileinfo->name info) file))
+ (progn
+ (unless (git-fileinfo->marked info)
+ (setf (git-fileinfo->marked info) t)
+ (setf (git-fileinfo->needs-refresh info) t))
+ (setq file (pop files))
+ (setq node (ewoc-next status node)))
+ (when (git-fileinfo->marked info)
+ (setf (git-fileinfo->marked info) nil)
+ (setf (git-fileinfo->needs-refresh info) t))
+ (if (and file (string-lessp file (git-fileinfo->name info)))
+ (setq file (pop files))
+ (setq node (ewoc-next status node))))))))
+
(defun git-marked-files ()
"Return a list of all marked files, or if none a list containing just the file at cursor position."
(unless git-status (error "Not in git-status buffer."))
@@ -840,16 +877,17 @@ Return the list of files that haven't been handled."
(if (or (not (string-equal tree head-tree))
(yes-or-no-p "The tree was not modified, do you really want to perform an empty commit? "))
(let ((commit (git-commit-tree buffer tree head)))
- (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
- (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
- (with-current-buffer buffer (erase-buffer))
- (git-update-status-files (git-get-filenames files) 'uptodate)
- (git-call-process-env nil nil "rerere")
- (git-call-process-env nil nil "gc" "--auto")
- (git-refresh-files)
- (git-refresh-ewoc-hf git-status)
- (message "Committed %s." commit)
- (git-run-hook "post-commit" nil))
+ (when commit
+ (condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
+ (condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
+ (with-current-buffer buffer (erase-buffer))
+ (git-update-status-files (git-get-filenames files) 'uptodate)
+ (git-call-process-env nil nil "rerere")
+ (git-call-process-env nil nil "gc" "--auto")
+ (git-refresh-files)
+ (git-refresh-ewoc-hf git-status)
+ (message "Committed %s." commit)
+ (git-run-hook "post-commit" nil)))
(message "Commit aborted."))))
(message "No files to commit.")))
(delete-file index-file))))))
@@ -957,11 +995,12 @@ Return the list of files that haven't been handled."
"Add marked file(s) to the index cache."
(interactive)
(let ((files (git-get-filenames (git-marked-files-state 'unknown 'ignored))))
+ ;; FIXME: add support for directories
(unless files
(push (file-relative-name (read-file-name "File to add: " nil nil t)) files))
- (apply #'git-call-process-env nil nil "update-index" "--add" "--" files)
- (git-update-status-files files 'uptodate)
- (git-success-message "Added" files)))
+ (when (apply 'git-call-process-display-error "update-index" "--add" "--" files)
+ (git-update-status-files files 'uptodate)
+ (git-success-message "Added" files))))
(defun git-ignore-file ()
"Add marked file(s) to the ignore list."
@@ -983,16 +1022,19 @@ Return the list of files that haven't been handled."
(format "Remove %d file%s? " (length files) (if (> (length files) 1) "s" "")))
(progn
(dolist (name files)
- (when (file-exists-p name) (delete-file name)))
- (apply #'git-call-process-env nil nil "update-index" "--remove" "--" files)
- (git-update-status-files files nil)
- (git-success-message "Removed" files))
+ (ignore-errors
+ (if (file-directory-p name)
+ (delete-directory name)
+ (delete-file name))))
+ (when (apply 'git-call-process-display-error "update-index" "--remove" "--" files)
+ (git-update-status-files files nil)
+ (git-success-message "Removed" files)))
(message "Aborting"))))
(defun git-revert-file ()
"Revert changes to the marked file(s)."
(interactive)
- (let ((files (git-marked-files))
+ (let ((files (git-marked-files-state 'added 'deleted 'modified 'unmerged))
added modified)
(when (and files
(yes-or-no-p
@@ -1003,21 +1045,31 @@ Return the list of files that haven't been handled."
('deleted (push (git-fileinfo->name info) modified))
('unmerged (push (git-fileinfo->name info) modified))
('modified (push (git-fileinfo->name info) modified))))
- (when added
- (apply #'git-call-process-env nil nil "update-index" "--force-remove" "--" added))
- (when modified
- (apply #'git-call-process-env nil nil "checkout" "HEAD" modified))
- (git-update-status-files (append added modified) 'uptodate)
- (git-success-message "Reverted" (git-get-filenames files)))))
+ ;; check if a buffer contains one of the files and isn't saved
+ (dolist (file modified)
+ (let ((buffer (get-file-buffer file)))
+ (when (and buffer (buffer-modified-p buffer))
+ (error "Buffer %s is modified. Please kill or save modified buffers before reverting." (buffer-name buffer)))))
+ (let ((ok (and
+ (or (not added)
+ (apply 'git-call-process-display-error "update-index" "--force-remove" "--" added))
+ (or (not modified)
+ (apply 'git-call-process-display-error "checkout" "HEAD" modified)))))
+ (git-update-status-files (append added modified) 'uptodate)
+ (when ok
+ (dolist (file modified)
+ (let ((buffer (get-file-buffer file)))
+ (when buffer (with-current-buffer buffer (revert-buffer t t t)))))
+ (git-success-message "Reverted" (git-get-filenames files)))))))
(defun git-resolve-file ()
"Resolve conflicts in marked file(s)."
(interactive)
(let ((files (git-get-filenames (git-marked-files-state 'unmerged))))
(when files
- (apply #'git-call-process-env nil nil "update-index" "--" files)
- (git-update-status-files files 'uptodate)
- (git-success-message "Resolved" files))))
+ (when (apply 'git-call-process-display-error "update-index" "--" files)
+ (git-update-status-files files 'uptodate)
+ (git-success-message "Resolved" files)))))
(defun git-remove-handled ()
"Remove handled files from the status list."
@@ -1063,6 +1115,16 @@ Return the list of files that haven't been handled."
(message "Inserting unknown files...done"))
(git-remove-handled)))
+(defun git-expand-directory (info)
+ "Expand the directory represented by INFO to list its files."
+ (when (eq (lsh (git-fileinfo->new-perm info) -9) ?\110)
+ (let ((dir (git-fileinfo->name info)))
+ (git-set-filenames-state git-status (list dir) nil)
+ (git-run-ls-files-with-excludes git-status (list (concat dir "/")) 'unknown "-o")
+ (git-refresh-files)
+ (git-refresh-ewoc-hf git-status)
+ t)))
+
(defun git-setup-diff-buffer (buffer)
"Setup a buffer for displaying a diff."
(let ((dir default-directory))
@@ -1199,7 +1261,8 @@ Return the list of files that haven't been handled."
(goto-char (point-min))
(when (re-search-forward "\n+\\'" nil t)
(replace-match "\n" t t))
- (when sign-off (git-append-sign-off committer-name committer-email)))))
+ (when sign-off (git-append-sign-off committer-name committer-email)))
+ buffer))
(defun git-commit-file ()
"Commit the marked file(s), asking for a commit message."
@@ -1232,14 +1295,61 @@ Return the list of files that haven't been handled."
(setq buffer-file-coding-system coding-system)
(re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
+(defun git-setup-commit-buffer (commit)
+ "Setup the commit buffer with the contents of COMMIT."
+ (let (author-name author-email subject date msg)
+ (with-temp-buffer
+ (let ((coding-system (git-get-logoutput-coding-system)))
+ (git-call-process-env t nil "log" "-1" commit)
+ (goto-char (point-min))
+ (when (re-search-forward "^Author: *\\(.*\\) <\\(.*\\)>$" nil t)
+ (setq author-name (match-string 1))
+ (setq author-email (match-string 2)))
+ (when (re-search-forward "^Date: *\\(.*\\)$" nil t)
+ (setq date (match-string 1)))
+ (while (re-search-forward "^ \\(.*\\)$" nil t)
+ (push (match-string 1) msg))
+ (setq msg (nreverse msg))
+ (setq subject (pop msg))
+ (while (and msg (zerop (length (car msg))) (pop msg)))))
+ (git-setup-log-buffer (get-buffer-create "*git-commit*")
+ author-name author-email subject date
+ (mapconcat #'identity msg "\n"))))
+
+(defun git-get-commit-files (commit)
+ "Retrieve the list of files modified by COMMIT."
+ (let (files)
+ (with-temp-buffer
+ (git-call-process-env t nil "diff-tree" "-r" "-z" "--name-only" "--no-commit-id" commit)
+ (goto-char (point-min))
+ (while (re-search-forward "\\([^\0]*\\)\0" nil t 1)
+ (push (match-string 1) files)))
+ files))
+
+(defun git-amend-commit ()
+ "Undo the last commit on HEAD, and set things up to commit an
+amended version of it."
+ (interactive)
+ (unless git-status (error "Not in git-status buffer."))
+ (when (git-empty-db-p) (error "No commit to amend."))
+ (let* ((commit (git-rev-parse "HEAD"))
+ (files (git-get-commit-files commit)))
+ (when (git-call-process-display-error "reset" "--soft" "HEAD^")
+ (git-update-status-files (copy-sequence files) 'uptodate)
+ (git-mark-files git-status files)
+ (git-refresh-files)
+ (git-setup-commit-buffer commit)
+ (git-commit-file))))
+
(defun git-find-file ()
"Visit the current file in its own buffer."
(interactive)
(unless git-status (error "Not in git-status buffer."))
(let ((info (ewoc-data (ewoc-locate git-status))))
- (find-file (git-fileinfo->name info))
- (when (eq 'unmerged (git-fileinfo->state info))
- (smerge-mode 1))))
+ (unless (git-expand-directory info)
+ (find-file (git-fileinfo->name info))
+ (when (eq 'unmerged (git-fileinfo->state info))
+ (smerge-mode 1)))))
(defun git-find-file-other-window ()
"Visit the current file in its own buffer in another window."
@@ -1309,6 +1419,7 @@ Return the list of files that haven't been handled."
(unless git-status-mode-map
(let ((map (make-keymap))
+ (commit-map (make-sparse-keymap))
(diff-map (make-sparse-keymap))
(toggle-map (make-sparse-keymap)))
(suppress-keymap map)
@@ -1317,6 +1428,7 @@ Return the list of files that haven't been handled."
(define-key map " " 'git-next-file)
(define-key map "a" 'git-add-file)
(define-key map "c" 'git-commit-file)
+ (define-key map "\C-c" commit-map)
(define-key map "d" diff-map)
(define-key map "=" 'git-diff-file)
(define-key map "f" 'git-find-file)
@@ -1342,6 +1454,8 @@ Return the list of files that haven't been handled."
(define-key map "x" 'git-remove-handled)
(define-key map "\C-?" 'git-unmark-file-up)
(define-key map "\M-\C-?" 'git-unmark-all)
+ ; the commit submap
+ (define-key commit-map "\C-a" 'git-amend-commit)
; the diff submap
(define-key diff-map "b" 'git-diff-file-base)
(define-key diff-map "c" 'git-diff-file-combined)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index c80a6da252..781a0cbbbc 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -469,9 +469,7 @@ class P4Submit(Command):
optparse.make_option("--origin", dest="origin"),
optparse.make_option("--reset", action="store_true", dest="reset"),
optparse.make_option("--log-substitutions", dest="substFile"),
- optparse.make_option("--dry-run", action="store_true"),
optparse.make_option("--direct", dest="directSubmit", action="store_true"),
- optparse.make_option("--trust-me-like-a-fool", dest="trustMeLikeAFool", action="store_true"),
optparse.make_option("-M", dest="detectRename", action="store_true"),
]
self.description = "Submit changes from git to the perforce depot."
@@ -479,12 +477,10 @@ class P4Submit(Command):
self.firstTime = True
self.reset = False
self.interactive = True
- self.dryRun = False
self.substFile = ""
self.firstTime = True
self.origin = ""
self.directSubmit = False
- self.trustMeLikeAFool = False
self.detectRename = False
self.verbose = False
self.isWindows = (platform.system() == "Windows")
@@ -681,57 +677,30 @@ class P4Submit(Command):
separatorLine += "\r"
separatorLine += "\n"
- response = "e"
- if self.trustMeLikeAFool:
- response = "y"
-
- firstIteration = True
- while response == "e":
- if not firstIteration:
- response = raw_input("Do you want to submit this change? [y]es/[e]dit/[n]o/[s]kip ")
- firstIteration = False
- if response == "e":
- [handle, fileName] = tempfile.mkstemp()
- tmpFile = os.fdopen(handle, "w+")
- tmpFile.write(submitTemplate + separatorLine + diff)
- tmpFile.close()
- defaultEditor = "vi"
- if platform.system() == "Windows":
- defaultEditor = "notepad"
- editor = os.environ.get("EDITOR", defaultEditor);
- system(editor + " " + fileName)
- tmpFile = open(fileName, "rb")
- message = tmpFile.read()
- tmpFile.close()
- os.remove(fileName)
- submitTemplate = message[:message.index(separatorLine)]
- if self.isWindows:
- submitTemplate = submitTemplate.replace("\r\n", "\n")
-
- if response == "y" or response == "yes":
- if self.dryRun:
- print submitTemplate
- raw_input("Press return to continue...")
- else:
- if self.directSubmit:
- print "Submitting to git first"
- os.chdir(self.oldWorkingDirectory)
- write_pipe("git commit -a -F -", submitTemplate)
- os.chdir(self.clientPath)
-
- write_pipe("p4 submit -i", submitTemplate)
- elif response == "s":
- for f in editedFiles:
- system("p4 revert \"%s\"" % f);
- for f in filesToAdd:
- system("p4 revert \"%s\"" % f);
- system("rm %s" %f)
- for f in filesToDelete:
- system("p4 delete \"%s\"" % f);
- return
- else:
- print "Not submitting!"
- self.interactive = False
+ [handle, fileName] = tempfile.mkstemp()
+ tmpFile = os.fdopen(handle, "w+")
+ tmpFile.write(submitTemplate + separatorLine + diff)
+ tmpFile.close()
+ defaultEditor = "vi"
+ if platform.system() == "Windows":
+ defaultEditor = "notepad"
+ editor = os.environ.get("EDITOR", defaultEditor);
+ system(editor + " " + fileName)
+ tmpFile = open(fileName, "rb")
+ message = tmpFile.read()
+ tmpFile.close()
+ os.remove(fileName)
+ submitTemplate = message[:message.index(separatorLine)]
+ if self.isWindows:
+ submitTemplate = submitTemplate.replace("\r\n", "\n")
+
+ if self.directSubmit:
+ print "Submitting to git first"
+ os.chdir(self.oldWorkingDirectory)
+ write_pipe("git commit -a -F -", submitTemplate)
+ os.chdir(self.clientPath)
+
+ write_pipe("p4 submit -i", submitTemplate)
else:
fileName = "submit.txt"
file = open(fileName, "w+")
@@ -828,10 +797,8 @@ class P4Submit(Command):
sync = P4Sync()
sync.run([])
- response = raw_input("Do you want to rebase current HEAD from Perforce now using git-p4 rebase? [y]es/[n]o ")
- if response == "y" or response == "yes":
- rebase = P4Rebase()
- rebase.rebase()
+ rebase = P4Rebase()
+ rebase.rebase()
os.remove(self.configFile)
return True
@@ -964,9 +931,13 @@ class P4Sync(Command):
stat = filedata[j]
j += 1
text = ''
- while j < len(filedata) and filedata[j]['code'] in ('text',
- 'binary'):
- text += filedata[j]['data']
+ while j < len(filedata) and filedata[j]['code'] in ('text', 'unicode', 'binary'):
+ tmp = filedata[j]['data']
+ if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
+ tmp = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', tmp)
+ elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
+ tmp = re.sub(r'(?i)\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', tmp)
+ text += tmp
j += 1
@@ -1640,6 +1611,11 @@ class P4Rebase(Command):
return self.rebase()
def rebase(self):
+ if os.system("git update-index --refresh") != 0:
+ die("Some files in your working directory are modified and different than what is in your index. You can use git update-index <filename> to bring the index up-to-date or stash away all your changes with git stash.");
+ if len(read_pipe("git diff-index HEAD --")) > 0:
+ die("You have uncommited changes. Please commit them before rebasing or stash them away with git stash.");
+
[upstream, settings] = findUpstreamBranchPoint()
if len(upstream) == 0:
die("Cannot find upstream branchpoint for rebase")
@@ -1670,7 +1646,7 @@ class P4Clone(P4Sync):
depotPath = args[0]
depotDir = re.sub("(@[^@]*)$", "", depotPath)
depotDir = re.sub("(#[^#]*)$", "", depotDir)
- depotDir = re.sub(r"\.\.\.$,", "", depotDir)
+ depotDir = re.sub(r"\.\.\.$", "", depotDir)
depotDir = re.sub(r"/$", "", depotDir)
return os.path.split(depotDir)[1]
diff --git a/git-remote.perl b/git-remote.perl
index d13e4c1fea..5cd69513cf 100755
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -1,5 +1,6 @@
#!/usr/bin/perl -w
+use strict;
use Git;
my $git = Git->repository();
@@ -296,12 +297,13 @@ sub add_remote {
sub update_remote {
my ($name) = @_;
+ my @remotes;
my $conf = $git->config("remotes." . $name);
if (defined($conf)) {
@remotes = split(' ', $conf);
} elsif ($name eq 'default') {
- undef @remotes;
+ @remotes = ();
for (sort keys %$remote) {
my $do_fetch = $git->config_bool("remote." . $_ .
".skipDefaultUpdate");
@@ -341,7 +343,7 @@ sub rm_remote {
my @refs = $git->command('for-each-ref',
'--format=%(refname) %(objectname)', "refs/remotes/$name");
for (@refs) {
- ($ref, $object) = split;
+ my ($ref, $object) = split;
$git->command(qw(update-ref -d), $ref, $object);
}
return 0;
@@ -352,7 +354,7 @@ sub add_usage {
exit(1);
}
-local $VERBOSE = 0;
+my $VERBOSE = 0;
@ARGV = grep {
if ($_ eq '-v' or $_ eq '--verbose') {
$VERBOSE=1;
@@ -395,7 +397,7 @@ elsif ($ARGV[0] eq 'update') {
update_remote("default");
exit(1);
}
- for ($i = 1; $i < @ARGV; $i++) {
+ for (my $i = 1; $i < @ARGV; $i++) {
update_remote($ARGV[$i]);
}
}
diff --git a/git-svn.perl b/git-svn.perl
index 75e97cc72f..7889ccea7a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1247,7 +1247,8 @@ use File::Path qw/mkpath/;
use File::Copy qw/copy/;
use IPC::Open3;
-my $_repack_nr;
+my ($_gc_nr, $_gc_period);
+
# properties that we do not log:
my %SKIP_PROP;
BEGIN {
@@ -1408,9 +1409,10 @@ sub read_all_remotes {
}
sub init_vars {
- $_repack = 1000 unless (defined $_repack && $_repack > 0);
- $_repack_nr = $_repack;
- $_repack_flags ||= '-d';
+ $_gc_nr = $_gc_period = 1000;
+ if (defined $_repack || defined $_repack_flags) {
+ warn "Repack options are obsolete; they have no effect.\n";
+ }
}
sub verify_remotes_sanity {
@@ -2096,6 +2098,10 @@ sub restore_commit_header_env {
}
}
+sub gc {
+ command_noisy('gc', '--auto');
+};
+
sub do_git_commit {
my ($self, $log_entry) = @_;
my $lr = $self->last_rev;
@@ -2149,12 +2155,9 @@ sub do_git_commit {
0, $self->svm_uuid);
}
print " = $commit ($self->{ref_id})\n";
- if ($_repack && (--$_repack_nr == 0)) {
- $_repack_nr = $_repack;
- # repack doesn't use any arguments with spaces in them, does it?
- print "Running git repack $_repack_flags ...\n";
- command_noisy('repack', split(/\s+/, $_repack_flags));
- print "Done repacking\n";
+ if (--$_gc_nr == 0) {
+ $_gc_nr = $_gc_period;
+ gc();
}
return $commit;
}
@@ -2226,7 +2229,12 @@ sub find_parent_branch {
# just grow a tail if we're not unique enough :x
$ref_id .= '-' while find_ref($ref_id);
print STDERR "Initializing parent: $ref_id\n";
- $gs = Git::SVN->init($new_url, '', $ref_id, $ref_id, 1);
+ my ($u, $p) = ($new_url, '');
+ if ($u =~ s#^\Q$url\E(/|$)##) {
+ $p = $u;
+ $u = $url;
+ }
+ $gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1);
}
my ($r0, $parent) = $gs->find_rev_before($r, 1);
if (!defined $r0 || !defined $parent) {
@@ -3983,6 +3991,7 @@ sub gs_fetch_loop_common {
$max += $inc;
$max = $head if ($max > $head);
}
+ Git::SVN::gc();
}
sub match_globs {
diff --git a/git.spec.in b/git.spec.in
index 659f058819..3f9f88815b 100644
--- a/git.spec.in
+++ b/git.spec.in
@@ -8,7 +8,7 @@ License: GPL
Group: Development/Tools
URL: http://kernel.org/pub/software/scm/git/
Source: http://kernel.org/pub/software/scm/git/%{name}-%{version}.tar.gz
-BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
+BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, expat-devel, gettext %{!?_without_docs:, xmlto, asciidoc > 6.0.3}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: git-core = %{version}-%{release}
@@ -181,6 +181,9 @@ rm -rf $RPM_BUILD_ROOT
%{!?_without_docs: %doc Documentation/technical}
%changelog
+* Sun Feb 03 2008 James Bowes <jbowes@dangerouslyinc.com>
+- Add a BuildRequires for gettext
+
* Fri Jan 11 2008 Junio C Hamano <gitster@pobox.com>
- Include gitk message files
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ae2d05763f..5e88637b5e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1620,7 +1620,7 @@ sub git_get_project_url_list {
my $path = shift;
$git_dir = "$projectroot/$path";
- open my $fd, "$projectroot/$path/cloneurl"
+ open my $fd, "$git_dir/cloneurl"
or return wantarray ?
@{ config_to_multi(git_get_project_config('url')) } :
config_to_multi(git_get_project_config('url'));
@@ -5565,7 +5565,7 @@ XML
or next;
# print element (entry, item)
- my $co_url = href(-full=>1, action=>"commit", hash=>$commit);
+ my $co_url = href(-full=>1, action=>"commitdiff", hash=>$commit);
if ($format eq 'rss') {
print "<item>\n" .
"<title>" . esc_html($co{'title'}) . "</title>\n" .
diff --git a/object.c b/object.c
index 5a5ebe27b0..50b6528001 100644
--- a/object.c
+++ b/object.c
@@ -140,7 +140,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
if (type == OBJ_BLOB) {
struct blob *blob = lookup_blob(sha1);
if (blob) {
- parse_blob_buffer(blob, buffer, size);
+ if (parse_blob_buffer(blob, buffer, size))
+ return NULL;
obj = &blob->object;
}
} else if (type == OBJ_TREE) {
@@ -148,14 +149,16 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
if (tree) {
obj = &tree->object;
if (!tree->object.parsed) {
- parse_tree_buffer(tree, buffer, size);
+ if (parse_tree_buffer(tree, buffer, size))
+ return NULL;
eaten = 1;
}
}
} else if (type == OBJ_COMMIT) {
struct commit *commit = lookup_commit(sha1);
if (commit) {
- parse_commit_buffer(commit, buffer, size);
+ if (parse_commit_buffer(commit, buffer, size))
+ return NULL;
if (!commit->buffer) {
commit->buffer = buffer;
eaten = 1;
@@ -165,7 +168,8 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
} else if (type == OBJ_TAG) {
struct tag *tag = lookup_tag(sha1);
if (tag) {
- parse_tag_buffer(tag, buffer, size);
+ if (parse_tag_buffer(tag, buffer, size))
+ return NULL;
obj = &tag->object;
}
} else {
diff --git a/t/README b/t/README
index 36f2517617..73ed11bfe2 100644
--- a/t/README
+++ b/t/README
@@ -160,14 +160,12 @@ library for your script to use.
- test_expect_failure <message> <script>
- This is the opposite of test_expect_success. If <script>
- yields success, test is considered a failure.
-
- Example:
-
- test_expect_failure \
- 'git-update-index without --add should fail adding.' \
- 'git-update-index should-be-empty'
+ This is NOT the opposite of test_expect_success, but is used
+ to mark a test that demonstrates a known breakage. Unlike
+ the usual test_expect_success tests, which say "ok" on
+ success and "FAIL" on failure, this will say "FIXED" on
+ success and "still broken" on failure. Failures from these
+ tests won't cause -i (immediate) to stop.
- test_debug <script>
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 4e49d59065..cd0de506d2 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -47,12 +47,24 @@ test_expect_success \
'test $(wc -l < full-of-directories) = 3'
################################################################
+# Test harness
+test_expect_success 'success is reported like this' '
+ :
+'
+test_expect_failure 'pretend we have a known breakage' '
+ false
+'
+test_expect_failure 'pretend we have fixed a known breakage' '
+ :
+'
+
+################################################################
# Basics of the basics
# updating a new file without --add should fail.
-test_expect_failure \
- 'git update-index without --add should fail adding.' \
- 'git update-index should-be-empty'
+test_expect_success 'git update-index without --add should fail adding.' '
+ ! git update-index should-be-empty
+'
# and with --add it should succeed, even if it is empty (it used to fail).
test_expect_success \
@@ -70,9 +82,9 @@ test_expect_success \
# Removing paths.
rm -f should-be-empty full-of-directories
-test_expect_failure \
- 'git update-index without --remove should fail removing.' \
- 'git update-index should-be-empty'
+test_expect_success 'git update-index without --remove should fail removing.' '
+ ! git update-index should-be-empty
+'
test_expect_success \
'git update-index with --remove should be able to remove.' \
@@ -204,9 +216,9 @@ test_expect_success \
'put invalid objects into the index.' \
'git update-index --index-info < badobjects'
-test_expect_failure \
- 'writing this tree without --missing-ok.' \
- 'git write-tree'
+test_expect_success 'writing this tree without --missing-ok.' '
+ ! git write-tree
+'
test_expect_success \
'writing this tree with --missing-ok.' \
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index cad95f35ad..818c8621f2 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -243,14 +243,14 @@ test_expect_success \
test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0
'
-test_expect_failure \
+test_expect_success \
'text plus spaces without newline at end should not show spaces' '
- printf "$ttt$sss" | git stripspace | grep -q " " ||
- printf "$ttt$ttt$sss" | git stripspace | grep -q " " ||
- printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
- printf "$ttt$sss$sss" | git stripspace | grep -q " " ||
- printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
- printf "$ttt$sss$sss$sss" | git stripspace | grep -q " "
+ ! (printf "$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$ttt$sss$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
@@ -280,14 +280,14 @@ test_expect_success \
git diff expect actual
'
-test_expect_failure \
+test_expect_success \
'text plus spaces at end should not show spaces' '
- echo "$ttt$sss" | git stripspace | grep -q " " ||
- echo "$ttt$ttt$sss" | git stripspace | grep -q " " ||
- echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " ||
- echo "$ttt$sss$sss" | git stripspace | grep -q " " ||
- echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " " ||
- echo "$ttt$sss$sss$sss" | git stripspace | grep -q " "
+ ! (echo "$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (echo "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
+ ! (echo "$ttt$sss$sss" | git stripspace | grep -q " ") &&
+ ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
+ ! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
@@ -339,13 +339,13 @@ test_expect_success \
git diff expect actual
'
-test_expect_failure \
+test_expect_success \
'spaces without newline at end should not show spaces' '
- printf "" | git stripspace | grep -q " " ||
- printf "$sss" | git stripspace | grep -q " " ||
- printf "$sss$sss" | git stripspace | grep -q " " ||
- printf "$sss$sss$sss" | git stripspace | grep -q " " ||
- printf "$sss$sss$sss$sss" | git stripspace | grep -q " "
+ ! (printf "" | git stripspace | grep -q " ") &&
+ ! (printf "$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$sss$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
+ ! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
'
test_expect_success \
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 0a3b55d121..0e2933a984 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -87,9 +87,9 @@ test_expect_success 'unambiguously abbreviated option with "="' '
git diff expect output
'
-test_expect_failure 'ambiguously abbreviated option' '
+test_expect_success 'ambiguously abbreviated option' '
test-parse-options --strin 123;
- test $? != 129
+ test $? = 129
'
cat > expect << EOF
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
index 37add1b504..6c065bfa21 100755
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -210,12 +210,12 @@ DF (file) when tree B require DF to be a directory by having DF/DF
END_OF_CASE_TABLE
-test_expect_failure \
- '1 - must not have an entry not in A.' \
- "rm -f .git/index XX &&
+test_expect_success '1 - must not have an entry not in A.' "
+ rm -f .git/index XX &&
echo XX >XX &&
git update-index --add XX &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'2 - must match B in !O && !A && B case.' \
@@ -248,13 +248,14 @@ test_expect_success \
echo extra >>AN &&
git read-tree -m $tree_O $tree_A $tree_B"
-test_expect_failure \
- '3 (fail) - must match A in !O && A && !B case.' \
- "rm -f .git/index AN &&
+test_expect_success \
+ '3 (fail) - must match A in !O && A && !B case.' "
+ rm -f .git/index AN &&
cp .orig-A/AN AN &&
echo extra >>AN &&
git update-index --add AN &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'4 - must match and be up-to-date in !O && A && B && A!=B case.' \
@@ -264,21 +265,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
- "rm -f .git/index AA &&
+test_expect_success \
+ '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
+ rm -f .git/index AA &&
cp .orig-A/AA AA &&
git update-index --add AA &&
echo extra >>AA &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \
- "rm -f .git/index AA &&
+test_expect_success \
+ '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' "
+ rm -f .git/index AA &&
cp .orig-A/AA AA &&
echo extra >>AA &&
git update-index --add AA &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'5 - must match in !O && A && B && A==B case.' \
@@ -297,34 +300,38 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '5 (fail) - must match A in !O && A && B && A==B case.' \
- "rm -f .git/index LL &&
+test_expect_success \
+ '5 (fail) - must match A in !O && A && B && A==B case.' "
+ rm -f .git/index LL &&
cp .orig-A/LL LL &&
echo extra >>LL &&
git update-index --add LL &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '6 - must not exist in O && !A && !B case' \
- "rm -f .git/index DD &&
+test_expect_success \
+ '6 - must not exist in O && !A && !B case' "
+ rm -f .git/index DD &&
echo DD >DD
git update-index --add DD &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '7 - must not exist in O && !A && B && O!=B case' \
- "rm -f .git/index DM &&
+test_expect_success \
+ '7 - must not exist in O && !A && B && O!=B case' "
+ rm -f .git/index DM &&
cp .orig-B/DM DM &&
git update-index --add DM &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '8 - must not exist in O && !A && B && O==B case' \
- "rm -f .git/index DN &&
+test_expect_success \
+ '8 - must not exist in O && !A && B && O==B case' "
+ rm -f .git/index DN &&
cp .orig-B/DN DN &&
git update-index --add DN &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'9 - must match and be up-to-date in O && A && !B && O!=A case' \
@@ -334,21 +341,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
- "rm -f .git/index MD &&
+test_expect_success \
+ '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
+ rm -f .git/index MD &&
cp .orig-A/MD MD &&
git update-index --add MD &&
echo extra >>MD &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \
- "rm -f .git/index MD &&
+test_expect_success \
+ '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' "
+ rm -f .git/index MD &&
cp .orig-A/MD MD &&
echo extra >>MD &&
git update-index --add MD &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'10 - must match and be up-to-date in O && A && !B && O==A case' \
@@ -358,21 +367,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
- "rm -f .git/index ND &&
+test_expect_success \
+ '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
+ rm -f .git/index ND &&
cp .orig-A/ND ND &&
git update-index --add ND &&
echo extra >>ND &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \
- "rm -f .git/index ND &&
+test_expect_success \
+ '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' "
+ rm -f .git/index ND &&
cp .orig-A/ND ND &&
echo extra >>ND &&
git update-index --add ND &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
@@ -382,21 +393,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
- "rm -f .git/index MM &&
+test_expect_success \
+ '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
+ rm -f .git/index MM &&
cp .orig-A/MM MM &&
git update-index --add MM &&
echo extra >>MM &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \
- "rm -f .git/index MM &&
+test_expect_success \
+ '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' "
+ rm -f .git/index MM &&
cp .orig-A/MM MM &&
echo extra >>MM &&
git update-index --add MM &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'12 - must match A in O && A && B && O!=A && A==B case' \
@@ -415,13 +428,14 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '12 (fail) - must match A in O && A && B && O!=A && A==B case' \
- "rm -f .git/index SS &&
+test_expect_success \
+ '12 (fail) - must match A in O && A && B && O!=A && A==B case' "
+ rm -f .git/index SS &&
cp .orig-A/SS SS &&
echo extra >>SS &&
git update-index --add SS &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'13 - must match A in O && A && B && O!=A && O==B case' \
@@ -457,21 +471,23 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
- "rm -f .git/index NM &&
+test_expect_success \
+ '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
+ rm -f .git/index NM &&
cp .orig-A/NM NM &&
git update-index --add NM &&
echo extra >>NM &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
-test_expect_failure \
- '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \
- "rm -f .git/index NM &&
+test_expect_success \
+ '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' "
+ rm -f .git/index NM &&
cp .orig-A/NM NM &&
echo extra >>NM &&
git update-index --add NM &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
test_expect_success \
'15 - must match A in O && A && B && O==A && O==B case' \
@@ -490,13 +506,14 @@ test_expect_success \
git read-tree -m $tree_O $tree_A $tree_B &&
check_result"
-test_expect_failure \
- '15 (fail) - must match A in O && A && B && O==A && O==B case' \
- "rm -f .git/index NN &&
+test_expect_success \
+ '15 (fail) - must match A in O && A && B && O==A && O==B case' "
+ rm -f .git/index NN &&
cp .orig-A/NN NN &&
echo extra >>NN &&
git update-index --add NN &&
- git read-tree -m $tree_O $tree_A $tree_B"
+ ! git read-tree -m $tree_O $tree_A $tree_B
+"
# #16
test_expect_success \
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 991d3c5e9c..dcb3108c29 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -101,8 +101,8 @@ echo "Play, play, play" >>hello
echo "Lots of fun" >>example
git commit -m 'Some fun.' -i hello example
-test_expect_failure 'git resolve now fails' '
- git merge -m "Merge work in mybranch" mybranch
+test_expect_success 'git resolve now fails' '
+ ! git merge -m "Merge work in mybranch" mybranch
'
cat > hello << EOF
@@ -156,6 +156,8 @@ test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.outp
test_expect_success 'git repack' 'git repack'
test_expect_success 'git prune-packed' 'git prune-packed'
-test_expect_failure '-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]'
+test_expect_success '-> only packed objects' '
+ ! find -type f .git/objects/[0-9a-f][0-9a-f]
+'
test_done
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 42eac2a7cb..66aeb88db8 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -181,8 +181,9 @@ test_expect_success 'non-match' \
test_expect_success 'non-match value' \
'test wow = $(git config --get nextsection.nonewline !for)'
-test_expect_failure 'ambiguous get' \
- 'git config --get nextsection.nonewline'
+test_expect_success 'ambiguous get' '
+ ! git config --get nextsection.nonewline
+'
test_expect_success 'get multivar' \
'git config --get-all nextsection.nonewline'
@@ -202,13 +203,17 @@ EOF
test_expect_success 'multivar replace' 'cmp .git/config expect'
-test_expect_failure 'ambiguous value' 'git config nextsection.nonewline'
+test_expect_success 'ambiguous value' '
+ ! git config nextsection.nonewline
+'
-test_expect_failure 'ambiguous unset' \
- 'git config --unset nextsection.nonewline'
+test_expect_success 'ambiguous unset' '
+ ! git config --unset nextsection.nonewline
+'
-test_expect_failure 'invalid unset' \
- 'git config --unset somesection.nonewline'
+test_expect_success 'invalid unset' '
+ ! git config --unset somesection.nonewline
+'
git config --unset nextsection.nonewline "wow3$"
@@ -224,7 +229,7 @@ EOF
test_expect_success 'multivar unset' 'cmp .git/config expect'
-test_expect_failure 'invalid key' 'git config inval.2key blabla'
+test_expect_success 'invalid key' '! git config inval.2key blabla'
test_expect_success 'correct key' 'git config 123456.a123 987'
@@ -278,17 +283,40 @@ test_expect_success '--add' \
cat > .git/config << EOF
[novalue]
variable
+[emptyvalue]
+ variable =
EOF
test_expect_success 'get variable with no value' \
'git config --get novalue.variable ^$'
+test_expect_success 'get variable with empty value' \
+ 'git config --get emptyvalue.variable ^$'
+
echo novalue.variable > expect
test_expect_success 'get-regexp variable with no value' \
'git config --get-regexp novalue > output &&
cmp output expect'
+echo 'emptyvalue.variable ' > expect
+
+test_expect_success 'get-regexp variable with empty value' \
+ 'git config --get-regexp emptyvalue > output &&
+ cmp output expect'
+
+echo true > expect
+
+test_expect_success 'get bool variable with no value' \
+ 'git config --bool novalue.variable > output &&
+ cmp output expect'
+
+echo false > expect
+
+test_expect_success 'get bool variable with empty value' \
+ 'git config --bool emptyvalue.variable > output &&
+ cmp output expect'
+
git config > output 2>&1
test_expect_success 'no arguments, but no crash' \
@@ -382,8 +410,9 @@ EOF
test_expect_success "rename succeeded" "git diff expect .git/config"
-test_expect_failure "rename non-existing section" \
- 'git config --rename-section branch."world domination" branch.drei'
+test_expect_success "rename non-existing section" '
+ ! git config --rename-section branch."world domination" branch.drei
+'
test_expect_success "rename succeeded" "git diff expect .git/config"
@@ -494,14 +523,14 @@ test_expect_success bool '
done &&
cmp expect result'
-test_expect_failure 'invalid bool (--get)' '
+test_expect_success 'invalid bool (--get)' '
git config bool.nobool foobar &&
- git config --bool --get bool.nobool'
+ ! git config --bool --get bool.nobool'
-test_expect_failure 'invalid bool (set)' '
+test_expect_success 'invalid bool (set)' '
- git config --bool bool.nobool foobar'
+ ! git config --bool bool.nobool foobar'
rm .git/config
@@ -562,8 +591,9 @@ EOF
test_expect_success 'quoting' 'cmp .git/config expect'
-test_expect_failure 'key with newline' 'git config key.with\\\
-newline 123'
+test_expect_success 'key with newline' '
+ ! git config "key.with
+newline" 123'
test_expect_success 'value with newline' 'git config key.sub value.with\\\
newline'
diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh
index 37fc1c8d36..9be0770e76 100755
--- a/t/t1302-repo-version.sh
+++ b/t/t1302-repo-version.sh
@@ -40,7 +40,8 @@ test_expect_success 'gitdir required mode on normal repos' '
(git apply --check --index test.patch &&
cd test && git apply --check --index ../test.patch)'
-test_expect_failure 'gitdir required mode on unsupported repo' '
- (cd test2 && git apply --check --index ../test.patch)'
+test_expect_success 'gitdir required mode on unsupported repo' '
+ (cd test2 && ! git apply --check --index ../test.patch)
+'
test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 71ab2dd0ee..78cd41245b 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -51,23 +51,23 @@ test_expect_success \
test $B"' = $(cat .git/'"$m"')'
rm -f .git/$m
-test_expect_failure \
- '(not) create HEAD with old sha1' \
- "git update-ref HEAD $A $B"
-test_expect_failure \
- "(not) prior created .git/$m" \
- "test -f .git/$m"
+test_expect_success '(not) create HEAD with old sha1' "
+ ! git update-ref HEAD $A $B
+"
+test_expect_success "(not) prior created .git/$m" "
+ ! test -f .git/$m
+"
rm -f .git/$m
test_expect_success \
"create HEAD" \
"git update-ref HEAD $A"
-test_expect_failure \
- '(not) change HEAD with wrong SHA1' \
- "git update-ref HEAD $B $Z"
-test_expect_failure \
- "(not) changed .git/$m" \
- "test $B"' = $(cat .git/'"$m"')'
+test_expect_success '(not) change HEAD with wrong SHA1' "
+ ! git update-ref HEAD $B $Z
+"
+test_expect_success "(not) changed .git/$m" "
+ ! test $B"' = $(cat .git/'"$m"')
+'
rm -f .git/$m
: a repository with working tree always has reflog these days...
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index ac84335b0a..5141fab7cf 100755
--- a/t/t2000-checkout-cache-clash.sh
+++ b/t/t2000-checkout-cache-clash.sh
@@ -36,9 +36,9 @@ mkdir path0
date >path0/file0
date >path1
-test_expect_failure \
+test_expect_success \
'git checkout-index without -f should fail on conflicting work tree.' \
- 'git checkout-index -a'
+ '! git checkout-index -a'
test_expect_success \
'git checkout-index with -f should succeed.' \
diff --git a/t/t2002-checkout-cache-u.sh b/t/t2002-checkout-cache-u.sh
index f7a0055920..0f441bcef7 100755
--- a/t/t2002-checkout-cache-u.sh
+++ b/t/t2002-checkout-cache-u.sh
@@ -16,12 +16,12 @@ echo frotz >path0 &&
git update-index --add path0 &&
t=$(git write-tree)'
-test_expect_failure \
+test_expect_success \
'without -u, git checkout-index smudges stat information.' '
rm -f path0 &&
git read-tree $t &&
git checkout-index -f -a &&
-git diff-files | diff - /dev/null'
+! git diff-files | diff - /dev/null'
test_expect_success \
'with -u, git checkout-index picks up stat information from new files.' '
diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh
index f78945ed8e..4a723dc0e5 100755
--- a/t/t2008-checkout-subdir.sh
+++ b/t/t2008-checkout-subdir.sh
@@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' '
'
-test_expect_failure 'relative path outside tree should fail' \
- 'git checkout HEAD -- ../../Makefile'
+test_expect_success 'relative path outside tree should fail' \
+ '! git checkout HEAD -- ../../Makefile'
-test_expect_failure 'incorrect relative path to file should fail (1)' \
- 'git checkout HEAD -- ../file0'
+test_expect_success 'incorrect relative path to file should fail (1)' \
+ '! git checkout HEAD -- ../file0'
-test_expect_failure 'incorrect relative path should fail (2)' \
- '( cd dir1 && git checkout HEAD -- ./file0 )'
+test_expect_success 'incorrect relative path should fail (2)' \
+ '( cd dir1 && ! git checkout HEAD -- ./file0 )'
-test_expect_failure 'incorrect relative path should fail (3)' \
- '( cd dir1 && git checkout HEAD -- ../../file0 )'
+test_expect_success 'incorrect relative path should fail (3)' \
+ '( cd dir1 && ! git checkout HEAD -- ../../file0 )'
test_done
diff --git a/t/t2100-update-cache-badpath.sh b/t/t2100-update-cache-badpath.sh
index 04a1ed1a6b..9beaecd18b 100755
--- a/t/t2100-update-cache-badpath.sh
+++ b/t/t2100-update-cache-badpath.sh
@@ -44,8 +44,8 @@ date >path1/file1
for p in path0/file0 path1/file1 path2 path3
do
- test_expect_failure \
+ test_expect_success \
"git update-index to add conflicting path $p should fail." \
- "git update-index --add -- $p"
+ "! git update-index --add -- $p"
done
test_done
diff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh
index c83f820ad2..f4da869932 100755
--- a/t/t3020-ls-files-error-unmatch.sh
+++ b/t/t3020-ls-files-error-unmatch.sh
@@ -15,9 +15,9 @@ touch foo bar
git update-index --add foo bar
git-commit -m "add foo bar"
-test_expect_failure \
+test_expect_success \
'git ls-files --error-unmatch should fail with unmatched path.' \
- 'git ls-files --error-unmatch foo bar-does-not-match'
+ '! git ls-files --error-unmatch foo bar-does-not-match'
test_expect_success \
'git ls-files --error-unmatch should succeed eith matched paths.' \
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index ef1eeb7d8a..d21081d0f1 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -17,10 +17,11 @@ test_expect_success \
git-commit -m "Initial commit." &&
HEAD=$(git rev-parse --verify HEAD)'
-test_expect_failure \
- 'git branch --help should not have created a bogus branch' \
- 'git branch --help </dev/null >/dev/null 2>/dev/null || :
- test -f .git/refs/heads/--help'
+test_expect_success \
+ 'git branch --help should not have created a bogus branch' '
+ git branch --help </dev/null >/dev/null 2>/dev/null;
+ ! test -f .git/refs/heads/--help
+'
test_expect_success \
'git branch abc should create a branch' \
@@ -71,17 +72,17 @@ test_expect_success \
git branch -m n/n n
test -f .git/logs/refs/heads/n'
-test_expect_failure \
- 'git branch -m o/o o should fail when o/p exists' \
- 'git branch o/o &&
+test_expect_success 'git branch -m o/o o should fail when o/p exists' '
+ git branch o/o &&
git branch o/p &&
- git branch -m o/o o'
+ ! git branch -m o/o o
+'
-test_expect_failure \
- 'git branch -m q r/q should fail when r exists' \
- 'git branch q &&
- git branch r &&
- git branch -m q r/q'
+test_expect_success 'git branch -m q r/q should fail when r exists' '
+ git branch q &&
+ git branch r &&
+ ! git branch -m q r/q
+'
mv .git/config .git/config-saved
@@ -108,12 +109,13 @@ test_expect_success 'config information was renamed, too' \
"test $(git config branch.s.dummy) = Hello &&
! git config branch.s/s/dummy"
-test_expect_failure \
- 'git branch -m u v should fail when the reflog for u is a symlink' \
- 'git branch -l u &&
+test_expect_success \
+ 'git branch -m u v should fail when the reflog for u is a symlink' '
+ git branch -l u &&
mv .git/logs/refs/heads/u real-u &&
ln -s real-u .git/logs/refs/heads/u &&
- git branch -m u v'
+ ! git branch -m u v
+'
test_expect_success 'test tracking setup via --track' \
'git config remote.local.url . &&
diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh
index 4ddc6342a9..b64ccfbc5b 100755
--- a/t/t3210-pack-refs.sh
+++ b/t/t3210-pack-refs.sh
@@ -39,12 +39,12 @@ test_expect_success \
git show-ref b >result &&
diff expect result'
-test_expect_failure \
- 'git branch c/d should barf if branch c exists' \
- 'git branch c &&
+test_expect_success 'git branch c/d should barf if branch c exists' '
+ git branch c &&
git pack-refs --all &&
- rm .git/refs/heads/c &&
- git branch c/d'
+ rm -f .git/refs/heads/c &&
+ ! git branch c/d
+'
test_expect_success \
'see if a branch still exists after git pack-refs --prune' \
@@ -54,11 +54,11 @@ test_expect_success \
git show-ref e >result &&
diff expect result'
-test_expect_failure \
- 'see if git pack-refs --prune remove ref files' \
- 'git branch f &&
+test_expect_success 'see if git pack-refs --prune remove ref files' '
+ git branch f &&
git pack-refs --all --prune &&
- ls .git/refs/heads/f'
+ ! test -f .git/refs/heads/f
+'
test_expect_success \
'git branch g should work when git branch g/h has been deleted' \
@@ -69,11 +69,11 @@ test_expect_success \
git pack-refs --all &&
git branch -d g'
-test_expect_failure \
- 'git branch i/j/k should barf if branch i exists' \
- 'git branch i &&
+test_expect_success 'git branch i/j/k should barf if branch i exists' '
+ git branch i &&
git pack-refs --all --prune &&
- git branch i/j/k'
+ ! git branch i/j/k
+'
test_expect_success \
'test git branch k after branch k/l/m and k/lm have been deleted' \
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 95e33b5210..496f4ec172 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -42,9 +42,9 @@ test_expect_success \
test_expect_success 'rebase against master' '
git rebase master'
-test_expect_failure \
+test_expect_success \
'the rebase operation should not have destroyed author information' \
- 'git log | grep "Author:" | grep "<>"'
+ '! git log | grep "Author:" | grep "<>"'
test_expect_success 'rebase after merge master' '
git reset --hard topic &&
diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
index 657f68104d..0a26099658 100755
--- a/t/t3403-rebase-skip.sh
+++ b/t/t3403-rebase-skip.sh
@@ -31,8 +31,8 @@ test_expect_success setup '
git branch skip-merge skip-reference
'
-test_expect_failure 'rebase with git am -3 (default)' '
- git rebase master
+test_expect_success 'rebase with git am -3 (default)' '
+ ! git rebase master
'
test_expect_success 'rebase --skip with am -3' '
@@ -53,7 +53,7 @@ test_expect_success 'rebase moves back to skip-reference' '
test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
-test_expect_failure 'rebase with --merge' 'git rebase --merge master'
+test_expect_success 'rebase with --merge' '! git rebase --merge master'
test_expect_success 'rebase --skip with --merge' '
git rebase --skip
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b1ee622ef7..f542f0af41 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -59,15 +59,16 @@ test_expect_success \
echo "other content" > foo
git rm --cached foo'
-test_expect_failure \
- 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' \
- 'echo content > foo
+test_expect_success \
+ 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
+ echo content > foo
git add foo
git commit -m foo
echo "other content" > foo
git add foo
echo "yet another content" > foo
- git rm --cached foo'
+ ! git rm --cached foo
+'
test_expect_success \
'Test that git rm --cached -f foo works in case where --cached only did not' \
@@ -106,9 +107,9 @@ embedded'"
if test "$test_failed_remove" = y; then
chmod a-w .
-test_expect_failure \
+test_expect_success \
'Test that "git rm -f" fails if its rm fails' \
- 'git rm -f baz'
+ '! git rm -f baz'
chmod 775 .
else
test_expect_success 'skipping removal failure (perhaps running as root?)' :
@@ -212,8 +213,8 @@ test_expect_success 'Recursive with -r -f' '
! test -d frotz
'
-test_expect_failure 'Remove nonexistent file returns nonzero exit status' '
- git rm nonexistent
+test_expect_success 'Remove nonexistent file returns nonzero exit status' '
+ ! git rm nonexistent
'
test_done
diff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh
index 74f06ec730..7c25634fc2 100755
--- a/t/t4103-apply-binary.sh
+++ b/t/t4103-apply-binary.sh
@@ -46,21 +46,25 @@ test_expect_success 'stat binary diff (copy) -- should not fail.' \
'git-checkout master
git apply --stat --summary C.diff'
-test_expect_failure 'check binary diff -- should fail.' \
- 'git-checkout master
- git apply --check B.diff'
-
-test_expect_failure 'check binary diff (copy) -- should fail.' \
- 'git-checkout master
- git apply --check C.diff'
-
-test_expect_failure 'check incomplete binary diff with replacement -- should fail.' \
- 'git-checkout master
- git apply --check --allow-binary-replacement B.diff'
+test_expect_success 'check binary diff -- should fail.' \
+ 'git-checkout master &&
+ ! git apply --check B.diff'
+
+test_expect_success 'check binary diff (copy) -- should fail.' \
+ 'git-checkout master &&
+ ! git apply --check C.diff'
+
+test_expect_success \
+ 'check incomplete binary diff with replacement -- should fail.' '
+ git-checkout master &&
+ ! git apply --check --allow-binary-replacement B.diff
+'
-test_expect_failure 'check incomplete binary diff with replacement (copy) -- should fail.' \
- 'git-checkout master
- git apply --check --allow-binary-replacement C.diff'
+test_expect_success \
+ 'check incomplete binary diff with replacement (copy) -- should fail.' '
+ git-checkout master &&
+ ! git apply --check --allow-binary-replacement C.diff
+'
test_expect_success 'check binary diff with replacement.' \
'git-checkout master
@@ -73,42 +77,42 @@ test_expect_success 'check binary diff with replacement (copy).' \
# Now we start applying them.
do_reset () {
- rm -f file?
- git-reset --hard
+ rm -f file? &&
+ git-reset --hard &&
git-checkout -f master
}
-test_expect_failure 'apply binary diff -- should fail.' \
- 'do_reset
- git apply B.diff'
+test_expect_success 'apply binary diff -- should fail.' \
+ 'do_reset &&
+ ! git apply B.diff'
-test_expect_failure 'apply binary diff -- should fail.' \
- 'do_reset
- git apply --index B.diff'
+test_expect_success 'apply binary diff -- should fail.' \
+ 'do_reset &&
+ ! git apply --index B.diff'
-test_expect_failure 'apply binary diff (copy) -- should fail.' \
- 'do_reset
- git apply C.diff'
+test_expect_success 'apply binary diff (copy) -- should fail.' \
+ 'do_reset &&
+ ! git apply C.diff'
-test_expect_failure 'apply binary diff (copy) -- should fail.' \
- 'do_reset
- git apply --index C.diff'
+test_expect_success 'apply binary diff (copy) -- should fail.' \
+ 'do_reset &&
+ ! git apply --index C.diff'
test_expect_success 'apply binary diff without replacement.' \
- 'do_reset
+ 'do_reset &&
git apply BF.diff'
test_expect_success 'apply binary diff without replacement (copy).' \
- 'do_reset
+ 'do_reset &&
git apply CF.diff'
test_expect_success 'apply binary diff.' \
- 'do_reset
+ 'do_reset &&
git apply --allow-binary-replacement --index BF.diff &&
test -z "$(git diff --name-status binary)"'
test_expect_success 'apply binary diff (copy).' \
- 'do_reset
+ 'do_reset &&
git apply --allow-binary-replacement --index CF.diff &&
test -z "$(git diff --name-status binary)"'
diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh
index 1c6bec044a..d741039882 100755
--- a/t/t4113-apply-ending.sh
+++ b/t/t4113-apply-ending.sh
@@ -29,8 +29,8 @@ test_expect_success setup \
# test
-test_expect_failure 'apply at the end' \
- 'git apply --index test-patch'
+test_expect_success 'apply at the end' \
+ '! git apply --index test-patch'
cat >test-patch <<\EOF
diff a/file b/file
@@ -47,7 +47,7 @@ b
c'
git update-index file
-test_expect_failure 'apply at the beginning' \
- 'git apply --index test-patch'
+test_expect_success 'apply at the beginning' \
+ '! git apply --index test-patch'
test_done
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 6e594bf1e2..cd3c149800 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -264,8 +264,14 @@ test_expect_success \
cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
-test_expect_failure \
+test_expect_success \
'make sure index-pack detects the SHA1 collision' \
- 'git-index-pack -o bad.idx test-3.pack'
+ '! git-index-pack -o bad.idx test-3.pack'
+
+test_expect_success \
+ 'honor pack.packSizeLimit' \
+ 'git config pack.packSizeLimit 200 &&
+ packname_4=$(git pack-objects test-4 <obj-list) &&
+ test 3 = $(ls test-4-*.pack | wc -l)'
test_done
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 2a2878b572..67b9a7b84a 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -42,9 +42,9 @@ test_expect_success \
'both packs should be identical' \
'cmp "test-1-${pack1}.pack" "test-2-${pack2}.pack"'
-test_expect_failure \
+test_expect_success \
'index v1 and index v2 should be different' \
- 'cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
+ '! cmp "test-1-${pack1}.idx" "test-2-${pack2}.idx"'
test_expect_success \
'index-pack with index version 1' \
@@ -78,9 +78,9 @@ test_expect_success \
'git verify-pack -v "test-3-${pack3}.pack"'
test "$have_64bits" &&
-test_expect_failure \
+test_expect_success \
'64-bit offsets: should be different from previous index v2 results' \
- 'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
+ '! cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"'
test "$have_64bits" &&
test_expect_success \
@@ -112,22 +112,22 @@ test_expect_success \
bs=1 count=20 conv=notrunc &&
git cat-file blob "$delta_sha1" > blob_2 )'
-test_expect_failure \
+test_expect_success \
'[index v1] 3) corrupted delta happily returned wrong data' \
- 'cmp blob_1 blob_2'
+ '! cmp blob_1 blob_2'
-test_expect_failure \
+test_expect_success \
'[index v1] 4) confirm that the pack is actually corrupted' \
- 'git fsck --full $commit'
+ '! git fsck --full $commit'
test_expect_success \
'[index v1] 5) pack-objects happily reuses corrupted data' \
'pack4=$(git pack-objects test-4 <obj-list) &&
test -f "test-4-${pack1}.pack"'
-test_expect_failure \
+test_expect_success \
'[index v1] 6) newly created pack is BAD !' \
- 'git verify-pack -v "test-4-${pack1}.pack"'
+ '! git verify-pack -v "test-4-${pack1}.pack"'
test_expect_success \
'[index v2] 1) stream pack to repository' \
@@ -150,16 +150,16 @@ test_expect_success \
bs=1 count=20 conv=notrunc &&
git cat-file blob "$delta_sha1" > blob_4 )'
-test_expect_failure \
+test_expect_success \
'[index v2] 3) corrupted delta happily returned wrong data' \
- 'cmp blob_3 blob_4'
+ '! cmp blob_3 blob_4'
-test_expect_failure \
+test_expect_success \
'[index v2] 4) confirm that the pack is actually corrupted' \
- 'git fsck --full $commit'
+ '! git fsck --full $commit'
-test_expect_failure \
+test_expect_success \
'[index v2] 5) pack-objects refuses to reuse corrupted data' \
- 'git pack-objects test-5 <obj-list'
+ '! git pack-objects test-5 <obj-list'
test_done
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index 9734fc542f..9a12024241 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -60,8 +60,8 @@ echo STDERR post-update >&2
EOF
chmod u+x victim/.git/hooks/post-update
-test_expect_failure push '
- git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
+test_expect_success push '
+ ! git-send-pack --force ./victim/.git master tofail >send.out 2>send.err
'
test_expect_success 'updated as expected' '
@@ -112,8 +112,8 @@ test_expect_success 'all *-receive hook args are empty' '
! test -s victim/.git/post-receive.args
'
-test_expect_failure 'send-pack produced no output' '
- test -s send.out
+test_expect_success 'send-pack produced no output' '
+ ! test -s send.out
'
cat <<EOF >expect
diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh
index 1c4b0b32ab..1394047a8d 100755
--- a/t/t5402-post-merge-hook.sh
+++ b/t/t5402-post-merge-hook.sh
@@ -30,9 +30,9 @@ EOF
chmod u+x clone${clone}/.git/hooks/post-merge
done
-test_expect_failure 'post-merge does not run for up-to-date ' '
+test_expect_success 'post-merge does not run for up-to-date ' '
GIT_DIR=clone1/.git git merge $commit0 &&
- test -e clone1/.git/post-merge.args
+ ! test -f clone1/.git/post-merge.args
'
test_expect_success 'post-merge runs as expected ' '
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7b6798d8b5..788b4a5aae 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -176,7 +176,7 @@ test_expect_success "deepening fetch in shallow repo" \
test_expect_success "clone shallow object count" \
"test \"count: 18\" = \"$(grep count count.shallow)\""
-test_expect_failure "pull in shallow repo with missing merge base" \
- "(cd shallow; git pull --depth 4 .. A)"
+test_expect_success "pull in shallow repo with missing merge base" \
+ "(cd shallow && ! git pull --depth 4 .. A)"
test_done
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 02882c1e4b..9b948c14e6 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -95,7 +95,7 @@ test_expect_success 'fetch following tags' '
'
-test_expect_failure 'fetch must not resolve short tag name' '
+test_expect_success 'fetch must not resolve short tag name' '
cd "$D" &&
@@ -103,11 +103,11 @@ test_expect_failure 'fetch must not resolve short tag name' '
cd five &&
git init &&
- git fetch .. anno:five
+ ! git fetch .. anno:five
'
-test_expect_failure 'fetch must not resolve short remote name' '
+test_expect_success 'fetch must not resolve short remote name' '
cd "$D" &&
git-update-ref refs/remotes/six/HEAD HEAD
@@ -116,7 +116,7 @@ test_expect_failure 'fetch must not resolve short remote name' '
cd six &&
git init &&
- git fetch .. six:six
+ ! git fetch .. six:six
'
@@ -139,10 +139,10 @@ test_expect_success 'create bundle 2' '
git bundle create bundle2 master~2..master
'
-test_expect_failure 'unbundle 1' '
+test_expect_success 'unbundle 1' '
cd "$D/bundle" &&
git checkout -b some-branch &&
- git fetch "$D/bundle1" master:master
+ ! git fetch "$D/bundle1" master:master
'
test_expect_success 'bundle 1 has only 3 files ' '
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index cc8949e3ef..8b05091069 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -26,9 +26,8 @@ test_expect_success 'setup and corrupt repository' '
'
-test_expect_failure 'fsck fails' '
-
- git fsck
+test_expect_success 'fsck fails' '
+ ! git fsck
'
test_expect_success 'upload-pack fails due to error in pack-objects' '
@@ -46,9 +45,8 @@ test_expect_success 'corrupt repo differently' '
'
-test_expect_failure 'fsck fails' '
-
- git fsck
+test_expect_success 'fsck fails' '
+ ! git fsck
'
test_expect_success 'upload-pack fails due to error in rev-list' '
@@ -66,9 +64,9 @@ test_expect_success 'create empty repository' '
'
-test_expect_failure 'fetch fails' '
+test_expect_success 'fetch fails' '
- git fetch .. master
+ ! git fetch .. master
'
diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh
index 1776b377f3..acf34cec8f 100755
--- a/t/t5600-clone-fail-cleanup.sh
+++ b/t/t5600-clone-fail-cleanup.sh
@@ -11,13 +11,13 @@ remove the directory before attempting a clone again.'
. ./test-lib.sh
-test_expect_failure \
+test_expect_success \
'clone of non-existent source should fail' \
- 'git-clone foo bar'
+ '! git-clone foo bar'
-test_expect_failure \
+test_expect_success \
'failed clone should not leave a directory' \
- 'cd bar'
+ '! test -d bar'
# Need a repo to clone
test_create_repo foo
@@ -27,9 +27,9 @@ test_create_repo foo
# source repository given to git-clone should be relative to the
# current path not to the target dir
-test_expect_failure \
+test_expect_success \
'clone of non-existent (relative to $PWD) source should fail' \
- 'git-clone ../foo baz'
+ '! git-clone ../foo baz'
test_expect_success \
'clone should work now that source exists' \
diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh
index 1908dc8b06..910ccb4fff 100755
--- a/t/t5710-info-alternate.sh
+++ b/t/t5710-info-alternate.sh
@@ -87,10 +87,10 @@ test_valid_repo"
cd "$base_dir"
-test_expect_failure 'that info/alternates is necessary' \
+test_expect_success 'that info/alternates is necessary' \
'cd C &&
-rm .git/objects/info/alternates &&
-test_valid_repo'
+rm -f .git/objects/info/alternates &&
+! (test_valid_repo)'
cd "$base_dir"
@@ -101,9 +101,11 @@ test_valid_repo'
cd "$base_dir"
-test_expect_failure 'that relative alternate is only possible for current dir' \
-'cd D &&
-test_valid_repo'
+test_expect_success \
+ 'that relative alternate is only possible for current dir' '
+ cd D &&
+ ! (test_valid_repo)
+'
cd "$base_dir"
diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh
new file mode 100755
index 0000000000..be3d238d99
--- /dev/null
+++ b/t/t6009-rev-list-parent.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='properly cull all ancestors'
+
+. ./test-lib.sh
+
+commit () {
+ test_tick &&
+ echo $1 >file &&
+ git commit -a -m $1 &&
+ git tag $1
+}
+
+test_expect_success setup '
+
+ touch file &&
+ git add file &&
+
+ commit one &&
+
+ test_tick=$(($test_tick - 2400))
+
+ commit two &&
+ commit three &&
+ commit four &&
+
+ git log --pretty=oneline --abbrev-commit
+'
+
+test_expect_failure 'one is ancestor of others and should not be shown' '
+
+ git rev-list one --not four >result &&
+ >expect &&
+ diff -u expect result
+
+'
+
+test_done
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index ae3b6f2831..86419964b4 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -66,8 +66,8 @@ test_expect_success "merge result added missing LF" \
"git diff test.txt test2.txt"
cp test.txt backup.txt
-test_expect_failure "merge with conflicts" \
- "git merge-file test.txt orig.txt new3.txt"
+test_expect_success "merge with conflicts" \
+ "! git merge-file test.txt orig.txt new3.txt"
cat > expect.txt << EOF
<<<<<<< test.txt
@@ -89,8 +89,8 @@ EOF
test_expect_success "expected conflict markers" "git diff test.txt expect.txt"
cp backup.txt test.txt
-test_expect_failure "merge with conflicts, using -L" \
- "git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
+test_expect_success "merge with conflicts, using -L" \
+ "! git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
cat > expect.txt << EOF
<<<<<<< 1
@@ -113,8 +113,8 @@ test_expect_success "expected conflict markers, with -L" \
"git diff test.txt expect.txt"
sed "s/ tu / TU /" < new1.txt > new5.txt
-test_expect_failure "conflict in removed tail" \
- "git merge-file -p orig.txt new1.txt new5.txt > out"
+test_expect_success "conflict in removed tail" \
+ "! git merge-file -p orig.txt new1.txt new5.txt > out"
cat > expect << EOF
Dominus regit me,
diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh
index c154f03cf5..149ea8543a 100755
--- a/t/t6024-recursive-merge.sh
+++ b/t/t6024-recursive-merge.sh
@@ -60,7 +60,7 @@ git update-index a1 &&
GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F
'
-test_expect_failure "combined merge conflicts" "git merge -m final G"
+test_expect_success "combined merge conflicts" "! git merge -m final G"
cat > expect << EOF
<<<<<<< HEAD:a1
diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh
index 950c2e9b63..6004deb432 100755
--- a/t/t6025-merge-symlinks.sh
+++ b/t/t6025-merge-symlinks.sh
@@ -30,30 +30,29 @@ echo plain-file > symlink &&
git add symlink &&
git-commit -m b-file'
-test_expect_failure \
+test_expect_success \
'merge master into b-symlink, which has a different symbolic link' '
-! git-checkout b-symlink ||
-git-merge master'
+git-checkout b-symlink &&
+! git-merge master'
test_expect_success \
'the merge result must be a file' '
test -f symlink'
-test_expect_failure \
+test_expect_success \
'merge master into b-file, which has a file instead of a symbolic link' '
-! (git-reset --hard &&
-git-checkout b-file) ||
-git-merge master'
+git-reset --hard && git-checkout b-file &&
+! git-merge master'
test_expect_success \
'the merge result must be a file' '
test -f symlink'
-test_expect_failure \
+test_expect_success \
'merge b-file, which has a file instead of a symbolic link, into master' '
-! (git-reset --hard &&
-git-checkout master) ||
-git-merge b-file'
+git-reset --hard &&
+git-checkout master &&
+! git-merge b-file'
test_expect_success \
'the merge result must be a file' '
diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh
index 0724864e56..2328b69947 100755
--- a/t/t6101-rev-parse-parents.sh
+++ b/t/t6101-rev-parse-parents.sh
@@ -26,7 +26,7 @@ test_expect_success 'final^1^1^1 = final^^^' "test $(git rev-parse final^1^1^1)
test_expect_success 'final^1^2' "test $(git rev-parse start2) = $(git rev-parse final^1^2)"
test_expect_success 'final^1^2 != final^1^1' "test $(git rev-parse final^1^2) != $(git rev-parse final^1^1)"
test_expect_success 'final^1^3 not valid' "if git rev-parse --verify final^1^3; then false; else :; fi"
-test_expect_failure '--verify start2^1' 'git rev-parse --verify start2^1'
+test_expect_success '--verify start2^1' '! git rev-parse --verify start2^1'
test_expect_success '--verify start2^0' 'git rev-parse --verify start2^0'
test_expect_success 'repack for next test' 'git repack -a -d'
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 8a23aaf21b..f46ec93c83 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -43,8 +43,8 @@ test_expect_success 'Check atom names are valid' '
test -z "$bad"
'
-test_expect_failure 'Check invalid atoms names are errors' '
- git-for-each-ref --format="%(INVALID)" refs/heads
+test_expect_success 'Check invalid atoms names are errors' '
+ ! git-for-each-ref --format="%(INVALID)" refs/heads
'
test_expect_success 'Check format specifiers are ignored in naming date atoms' '
@@ -63,8 +63,8 @@ test_expect_success 'Check valid format specifiers for date fields' '
git-for-each-ref --format="%(authordate:rfc2822)" refs/heads
'
-test_expect_failure 'Check invalid format specifiers are errors' '
- git-for-each-ref --format="%(authordate:INVALID)" refs/heads
+test_expect_success 'Check invalid format specifiers are errors' '
+ ! git-for-each-ref --format="%(authordate:INVALID)" refs/heads
'
cat >expected <<\EOF
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index b730c900b1..b1243b4163 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -78,9 +78,9 @@ test_expect_success \
git diff-tree -r -M --name-status HEAD^ HEAD | \
grep "^R100..*path2/README..*path1/path2/README"'
-test_expect_failure \
+test_expect_success \
'do not move directory over existing directory' \
- 'mkdir path0 && mkdir path0/path2 && git mv path2 path0'
+ 'mkdir path0 && mkdir path0/path2 && ! git mv path2 path0'
test_expect_success \
'move into "."' \
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index 68b2b92879..c8b4f65f38 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -107,8 +107,8 @@ do
diff expected actual
'
- test_expect_failure "grep -c $L (no /dev/null)" '
- git grep -c test $H | grep -q "/dev/null"
+ test_expect_success "grep -c $L (no /dev/null)" '
+ ! git grep -c test $H | grep -q /dev/null
'
done
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index df496a95ff..75cd33bde8 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -26,8 +26,8 @@ test_expect_success 'listing all tags in an empty tree should output nothing' '
test `git-tag | wc -l` -eq 0
'
-test_expect_failure 'looking for a tag in an empty tree should fail' \
- 'tag_exists mytag'
+test_expect_success 'looking for a tag in an empty tree should fail' \
+ '! (tag_exists mytag)'
test_expect_success 'creating a tag in an empty tree should fail' '
! git-tag mynotag &&
@@ -83,9 +83,9 @@ test_expect_success \
# special cases for creating tags:
-test_expect_failure \
+test_expect_success \
'trying to create a tag with the name of one existing should fail' \
- 'git tag mytag'
+ '! git tag mytag'
test_expect_success \
'trying to create a tag with a non-valid name should fail' '
@@ -146,8 +146,8 @@ test_expect_success \
! tag_exists myhead
'
-test_expect_failure 'trying to delete an already deleted tag should fail' \
- 'git-tag -d mytag'
+test_expect_success 'trying to delete an already deleted tag should fail' \
+ '! git-tag -d mytag'
# listing various tags with pattern matching:
@@ -265,16 +265,16 @@ test_expect_success \
test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD)
'
-test_expect_failure 'trying to verify an unknown tag should fail' \
- 'git-tag -v unknown-tag'
+test_expect_success 'trying to verify an unknown tag should fail' \
+ '! git-tag -v unknown-tag'
-test_expect_failure \
+test_expect_success \
'trying to verify a non-annotated and non-signed tag should fail' \
- 'git-tag -v non-annotated-tag'
+ '! git-tag -v non-annotated-tag'
-test_expect_failure \
+test_expect_success \
'trying to verify many non-annotated or unknown tags, should fail' \
- 'git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
+ '! git-tag -v unknown-tag1 non-annotated-tag unknown-tag2'
# creating annotated tags:
@@ -1027,21 +1027,21 @@ test_expect_success \
# try to sign with bad user.signingkey
git config user.signingkey BobTheMouse
-test_expect_failure \
+test_expect_success \
'git-tag -s fails if gpg is misconfigured' \
- 'git tag -s -m tail tag-gpg-failure'
+ '! git tag -s -m tail tag-gpg-failure'
git config --unset user.signingkey
# try to verify without gpg:
rm -rf gpghome
-test_expect_failure \
+test_expect_success \
'verify signed tag fails when public key is not present' \
- 'git-tag -v signed-tag'
+ '! git-tag -v signed-tag'
-test_expect_failure \
+test_expect_success \
'git-tag -a fails if tag annotation is empty' '
- GIT_EDITOR=cat git tag -a initial-comment
+ ! (GIT_EDITOR=cat git tag -a initial-comment)
'
test_expect_success \
diff --git a/t/t7101-reset.sh b/t/t7101-reset.sh
index 66d40430b2..0d9874bfd7 100755
--- a/t/t7101-reset.sh
+++ b/t/t7101-reset.sh
@@ -36,28 +36,28 @@ test_expect_success \
'test -d path0 &&
test -f path0/COPYING'
-test_expect_failure \
+test_expect_success \
'checking lack of path1/path2/COPYING' \
- 'test -f path1/path2/COPYING'
+ '! test -f path1/path2/COPYING'
-test_expect_failure \
+test_expect_success \
'checking lack of path1/COPYING' \
- 'test -f path1/COPYING'
+ '! test -f path1/COPYING'
-test_expect_failure \
+test_expect_success \
'checking lack of COPYING' \
- 'test -f COPYING'
+ '! test -f COPYING'
-test_expect_failure \
+test_expect_success \
'checking checking lack of path1/COPYING-TOO' \
- 'test -f path0/COPYING-TOO'
+ '! test -f path0/COPYING-TOO'
-test_expect_failure \
+test_expect_success \
'checking lack of path1/path2' \
- 'test -d path1/path2'
+ '! test -d path1/path2'
-test_expect_failure \
+test_expect_success \
'checking lack of path1' \
- 'test -d path1'
+ '! test -d path1'
test_done
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 73d8a00e2c..dbf1ace29e 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -214,6 +214,22 @@ test_expect_success 'checkout to detach HEAD with branchname^' '
fi
'
+test_expect_success 'checkout to detach HEAD with :/message' '
+
+ git checkout -f master && git clean -f &&
+ git checkout ":/Initial" &&
+ H=$(git rev-parse --verify HEAD) &&
+ M=$(git show-ref -s --verify refs/heads/master) &&
+ test "z$H" = "z$M" &&
+ if git symbolic-ref HEAD >/dev/null 2>&1
+ then
+ echo "OOPS, HEAD is still symbolic???"
+ false
+ else
+ : happy
+ fi
+'
+
test_expect_success 'checkout to detach HEAD with HEAD^0' '
git checkout -f master && git clean -f &&
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 55043d102f..361886c3d6 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -17,49 +17,49 @@ test_expect_success \
git-add file && \
git-status | grep 'Initial commit'"
-test_expect_failure \
+test_expect_success \
"fail initial amend" \
- "git-commit --amend"
+ "! git-commit --amend"
test_expect_success \
"initial commit" \
"git-commit -m initial"
-test_expect_failure \
+test_expect_success \
"invalid options 1" \
- "git-commit -m foo -m bar -F file"
+ "! git-commit -m foo -m bar -F file"
-test_expect_failure \
+test_expect_success \
"invalid options 2" \
- "git-commit -C HEAD -m illegal"
+ "! git-commit -C HEAD -m illegal"
-test_expect_failure \
+test_expect_success \
"using paths with -a" \
"echo King of the bongo >file &&
- git-commit -m foo -a file"
+ ! git-commit -m foo -a file"
-test_expect_failure \
+test_expect_success \
"using paths with --interactive" \
"echo bong-o-bong >file &&
- echo 7 | git-commit -m foo --interactive file"
+ ! echo 7 | git-commit -m foo --interactive file"
-test_expect_failure \
+test_expect_success \
"using invalid commit with -C" \
- "git-commit -C bogus"
+ "! git-commit -C bogus"
-test_expect_failure \
+test_expect_success \
"testing nothing to commit" \
- "git-commit -m initial"
+ "! git-commit -m initial"
test_expect_success \
"next commit" \
"echo 'bongo bongo bongo' >file \
git-commit -m next -a"
-test_expect_failure \
+test_expect_success \
"commit message from non-existing file" \
"echo 'more bongo: bongo bongo bongo bongo' >file && \
- git-commit -F gah -a"
+ ! git-commit -F gah -a"
# Empty except stray tabs and spaces on a few lines.
sed -e 's/@$//' >msg <<EOF
@@ -68,9 +68,9 @@ sed -e 's/@$//' >msg <<EOF
@
Signed-off-by: hula
EOF
-test_expect_failure \
+test_expect_success \
"empty commit message" \
- "git-commit -F msg -a"
+ "! git-commit -F msg -a"
test_expect_success \
"commit message from file" \
@@ -88,10 +88,10 @@ test_expect_success \
"amend commit" \
"VISUAL=./editor git-commit --amend"
-test_expect_failure \
+test_expect_success \
"passing -m and -F" \
"echo 'enough with the bongos' >file && \
- git-commit -F msg -m amending ."
+ ! git-commit -F msg -m amending ."
test_expect_success \
"using message from other commit" \
diff --git a/t/t7503-pre-commit-hook.sh b/t/t7503-pre-commit-hook.sh
index d787cac2f7..2dd5a5e302 100755
--- a/t/t7503-pre-commit-hook.sh
+++ b/t/t7503-pre-commit-hook.sh
@@ -52,11 +52,11 @@ cat > "$HOOK" <<EOF
exit 1
EOF
-test_expect_failure 'with failing hook' '
+test_expect_success 'with failing hook' '
echo "another" >> file &&
git add file &&
- git commit -m "another"
+ ! git commit -m "another"
'
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index 751b11300b..eff36aaee3 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -98,20 +98,20 @@ cat > "$HOOK" <<EOF
exit 1
EOF
-test_expect_failure 'with failing hook' '
+test_expect_success 'with failing hook' '
echo "another" >> file &&
git add file &&
- git commit -m "another"
+ ! git commit -m "another"
'
-test_expect_failure 'with failing hook (editor)' '
+test_expect_success 'with failing hook (editor)' '
echo "more another" >> file &&
git add file &&
echo "more another" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
'
diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 614cf50d19..4e24ab3a7d 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -56,19 +56,19 @@ test_expect_success "$name" "
name='detect node change from file to directory #1'
-test_expect_failure "$name" "
+test_expect_success "$name" "
mkdir dir/new_file &&
mv dir/file dir/new_file/file &&
mv dir/new_file dir/file &&
git update-index --remove dir/file &&
git update-index --add dir/file/file &&
- git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
+ git commit -m '$name' &&
+ ! git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch" || true
name='detect node change from directory to file #1'
-test_expect_failure "$name" "
+test_expect_success "$name" "
rm -rf dir '$GIT_DIR'/index &&
git checkout -f -b mybranch2 remotes/git-svn &&
mv bar/zzz zzz &&
@@ -77,12 +77,12 @@ test_expect_failure "$name" "
git update-index --remove -- bar/zzz &&
git update-index --add -- bar &&
git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
+ ! git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch2" || true
name='detect node change from file to directory #2'
-test_expect_failure "$name" "
+test_expect_success "$name" "
rm -f '$GIT_DIR'/index &&
git checkout -f -b mybranch3 remotes/git-svn &&
rm bar/zzz &&
@@ -91,12 +91,12 @@ test_expect_failure "$name" "
echo yyy > bar/zzz/yyy &&
git update-index --add bar/zzz/yyy &&
git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
+ ! git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch3" || true
name='detect node change from directory to file #2'
-test_expect_failure "$name" "
+test_expect_success "$name" "
rm -f '$GIT_DIR'/index &&
git checkout -f -b mybranch4 remotes/git-svn &&
rm -rf dir &&
@@ -105,7 +105,7 @@ test_expect_failure "$name" "
echo asdf > dir &&
git update-index --add -- dir &&
git commit -m '$name' &&
- git-svn set-tree --find-copies-harder --rmdir \
+ ! git-svn set-tree --find-copies-harder --rmdir \
remotes/git-svn..mybranch4" || true
@@ -213,18 +213,18 @@ EOF
test_expect_success "$name" "git diff a expected"
-test_expect_failure 'exit if remote refs are ambigious' "
+test_expect_success 'exit if remote refs are ambigious' "
git config --add svn-remote.svn.fetch \
bar:refs/remotes/git-svn &&
- git-svn migrate
- "
+ ! git-svn migrate
+"
-test_expect_failure 'exit if init-ing a would clobber a URL' "
+test_expect_success 'exit if init-ing a would clobber a URL' "
svnadmin create ${PWD}/svnrepo2 &&
svn mkdir -m 'mkdir bar' ${svnrepo}2/bar &&
git config --unset svn-remote.svn.fetch \
'^bar:refs/remotes/git-svn$' &&
- git-svn init ${svnrepo}2/bar
+ ! git-svn init ${svnrepo}2/bar
"
test_expect_success \
diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh
index 79b7968eaf..f74ab1269e 100755
--- a/t/t9106-git-svn-commit-diff-clobber.sh
+++ b/t/t9106-git-svn-commit-diff-clobber.sh
@@ -24,11 +24,11 @@ test_expect_success 'commit change from svn side' "
rm -rf t.svn
"
-test_expect_failure 'commit conflicting change from git' "
+test_expect_success 'commit conflicting change from git' "
echo second line from git >> file &&
git commit -a -m 'second line from git' &&
- git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
- " || true
+ ! git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
+"
test_expect_success 'commit complementing change from git' "
git reset --hard HEAD~1 &&
@@ -39,7 +39,7 @@ test_expect_success 'commit complementing change from git' "
git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
"
-test_expect_failure 'dcommit fails to commit because of conflict' "
+test_expect_success 'dcommit fails to commit because of conflict' "
git-svn init $svnrepo &&
git-svn fetch &&
git reset --hard refs/remotes/git-svn &&
@@ -52,8 +52,8 @@ test_expect_failure 'dcommit fails to commit because of conflict' "
rm -rf t.svn &&
echo 'fourth line from git' >> file &&
git commit -a -m 'fourth line from git' &&
- git-svn dcommit
- " || true
+ ! git-svn dcommit
+ "
test_expect_success 'dcommit does the svn equivalent of an index merge' "
git reset --hard refs/remotes/git-svn &&
@@ -76,15 +76,15 @@ test_expect_success 'commit another change from svn side' "
rm -rf t.svn
"
-test_expect_failure 'multiple dcommit from git-svn will not clobber svn' "
+test_expect_success 'multiple dcommit from git-svn will not clobber svn' "
git reset --hard refs/remotes/git-svn &&
echo new file >> new-file &&
git update-index --add new-file &&
git commit -a -m 'new file' &&
echo clobber > file &&
git commit -a -m 'clobber' &&
- git svn dcommit
- " || true
+ ! git svn dcommit
+ "
test_expect_success 'check that rebase really failed' 'test -d .dotest'
diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh
index 745254665d..ca8a00ed0a 100755
--- a/t/t9106-git-svn-dcommit-clobber-series.sh
+++ b/t/t9106-git-svn-dcommit-clobber-series.sh
@@ -54,10 +54,10 @@ test_expect_success 'change file but in unrelated area' "
test x\"\`sed -n -e 61p < file\`\" = x6611
"
-test_expect_failure 'attempt to dcommit with a dirty index' '
+test_expect_success 'attempt to dcommit with a dirty index' '
echo foo >>file &&
git add file &&
- git svn dcommit
+ ! git svn dcommit
'
test_done
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 0595041af5..cceedbb2b7 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -165,9 +165,9 @@ from refs/heads/master
M 755 0000000000000000000000000000000000000001 zero1
INPUT_END
-test_expect_failure \
- 'B: fail on invalid blob sha1' \
- 'git-fast-import <input'
+test_expect_success 'B: fail on invalid blob sha1' '
+ ! git-fast-import <input
+'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
@@ -180,9 +180,9 @@ COMMIT
from refs/heads/master
INPUT_END
-test_expect_failure \
- 'B: fail on invalid branch name ".badbranchname"' \
- 'git-fast-import <input'
+test_expect_success 'B: fail on invalid branch name ".badbranchname"' '
+ ! git-fast-import <input
+'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
@@ -195,9 +195,9 @@ COMMIT
from refs/heads/master
INPUT_END
-test_expect_failure \
- 'B: fail on invalid branch name "bad[branch]name"' \
- 'git-fast-import <input'
+test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
+ ! git-fast-import <input
+'
rm -f .git/objects/pack_* .git/objects/index_*
cat >input <<INPUT_END
@@ -339,9 +339,9 @@ COMMIT
from refs/heads/branch^0
INPUT_END
-test_expect_failure \
- 'E: rfc2822 date, --date-format=raw' \
- 'git-fast-import --date-format=raw <input'
+test_expect_success 'E: rfc2822 date, --date-format=raw' '
+ ! git-fast-import --date-format=raw <input
+'
test_expect_success \
'E: rfc2822 date, --date-format=rfc2822' \
'git-fast-import --date-format=rfc2822 <input'
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 75d1ce433d..0a20971ebb 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -156,15 +156,19 @@ test_expect_success 'req_Root (strict paths)' \
'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
-test_expect_failure 'req_Root failure (strict-paths)' \
- 'cat request-anonymous | git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1'
+test_expect_success 'req_Root failure (strict-paths)' '
+ ! cat request-anonymous |
+ git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1
+'
test_expect_success 'req_Root (w/o strict-paths)' \
'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
-test_expect_failure 'req_Root failure (w/o strict-paths)' \
- 'cat request-anonymous | git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1'
+test_expect_success 'req_Root failure (w/o strict-paths)' '
+ ! cat request-anonymous |
+ git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1
+'
cat >request-base <<EOF
BEGIN AUTH REQUEST
@@ -179,8 +183,10 @@ test_expect_success 'req_Root (base-path)' \
'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
-test_expect_failure 'req_Root failure (base-path)' \
- 'cat request-anonymous | git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1'
+test_expect_success 'req_Root failure (base-path)' '
+ ! cat request-anonymous |
+ git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1
+'
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
@@ -188,9 +194,8 @@ test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
tail -n1 log | grep -q "^I LOVE YOU$"'
-test_expect_failure 'req_Root failure (export-all w/o whitelist)' \
- 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 ||
- false'
+test_expect_success 'req_Root failure (export-all w/o whitelist)' \
+ '! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root (everything together)' \
'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
@@ -290,15 +295,16 @@ test_expect_success 'cvs update (update existing file)' \
cd "$WORKDIR"
#TODO: cvsserver doesn't support update w/o -d
-test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \
- 'mkdir test &&
+test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
+ mkdir test &&
echo >test/empty &&
git add test &&
git commit -q -m "Single Subdirectory" &&
git push gitcvs.git >/dev/null &&
cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q update &&
- test ! -d test'
+ test ! -d test
+'
cd "$WORKDIR"
test_expect_success 'cvs update (subdirectories)' \
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 142540e1b1..da47bd7c9e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -139,6 +139,8 @@ fi
test_failure=0
test_count=0
+test_fixed=0
+test_broken=0
trap 'echo >&5 "FATAL: Unexpected exit with code $?"; exit 1' exit
@@ -171,6 +173,17 @@ test_failure_ () {
test "$immediate" = "" || { trap - exit; exit 1; }
}
+test_known_broken_ok_ () {
+ test_count=$(expr "$test_count" + 1)
+ test_fixed=$(($test_fixed+1))
+ say_color "" " FIXED $test_count: $@"
+}
+
+test_known_broken_failure_ () {
+ test_count=$(expr "$test_count" + 1)
+ test_broken=$(($test_broken+1))
+ say_color skip " still broken $test_count: $@"
+}
test_debug () {
test "$debug" = "" || eval "$1"
@@ -211,13 +224,13 @@ test_expect_failure () {
error "bug in the test script: not 2 parameters to test-expect-failure"
if ! test_skip "$@"
then
- say >&3 "expecting failure: $2"
+ say >&3 "checking known breakage: $2"
test_run_ "$2"
- if [ "$?" = 0 -a "$eval_ret" != 0 -a "$eval_ret" -lt 129 ]
+ if [ "$?" = 0 -a "$eval_ret" = 0 ]
then
- test_ok_ "$1"
+ test_known_broken_ok_ "$1"
else
- test_failure_ "$@"
+ test_known_broken_failure_ "$1"
fi
fi
echo >&3 ""
@@ -274,6 +287,18 @@ test_create_repo () {
test_done () {
trap - exit
+
+ if test "$test_fixed" != 0
+ then
+ say_color pass "fixed $test_fixed known breakage(s)"
+ fi
+ if test "$test_broken" != 0
+ then
+ say_color error "still have $test_broken known breakage(s)"
+ msg="remaining $(($test_count-$test_broken)) test(s)"
+ else
+ msg="$test_count test(s)"
+ fi
case "$test_failure" in
0)
# We could:
@@ -284,11 +309,11 @@ test_done () {
# The Makefile provided will clean this test area so
# we will leave things as they are.
- say_color pass "passed all $test_count test(s)"
+ say_color pass "passed all $msg"
exit 0 ;;
*)
- say_color error "failed $test_failure among $test_count test(s)"
+ say_color error "failed $test_failure among $msg"
exit 1 ;;
esac
diff --git a/transport.c b/transport.c
index babaa21398..497f853721 100644
--- a/transport.c
+++ b/transport.c
@@ -441,11 +441,12 @@ static struct ref *get_refs_via_curl(struct transport *transport)
struct ref *ref = NULL;
struct ref *last_ref = NULL;
+ if (!transport->data)
+ transport->data = get_http_walker(transport->url);
+
refs_url = xmalloc(strlen(transport->url) + 11);
sprintf(refs_url, "%s/info/refs", transport->url);
- http_init();
-
slot = get_active_slot();
slot->results = &results;
curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
@@ -473,8 +474,6 @@ static struct ref *get_refs_via_curl(struct transport *transport)
return NULL;
}
- http_cleanup();
-
data = buffer.buf;
start = NULL;
mid = data;