Merge branch 'master' of git://repo.or.cz/alt-git

This commit is contained in:
Johannes Sixt
2009-04-27 08:21:23 +02:00
70 changed files with 402 additions and 216 deletions

View File

@@ -7,9 +7,17 @@ Fixes since v1.6.2.3
* The configuration parser had a buffer overflow while parsing an overlong
value.
* pruning reflog entries that are unreachable from the tip of the ref
during "git reflog prune" (hence "git gc") was very inefficient.
* "git-add -p" lacked a way to say "q"uit to refuse staging any hunks for
the remaining paths. You had to say "d" and then ^C.
* "git-checkout <tree-ish> <submodule>" did not update the index entry at
the named path; it now does.
* "git-fast-export" choked when seeing a tag that does not point at commit.
* "git init" segfaulted when given an overlong template location via
the --template= option.
@@ -27,5 +35,5 @@ Many small documentation updates are included as well.
---
exec >/var/tmp/1
echo O=$(git describe maint)
O=v1.6.2.3-21-ga51609a
O=v1.6.2.3-38-g318b847
git shortlog --no-merges $O..maint

View File

@@ -42,9 +42,6 @@ Updates since v1.6.2
* many uses of lstat(2) in the codepath for "git checkout" have been
optimized out.
* pruning reflog entries that are unreachable from the tip of the ref
during "git reflog prune" (hence "git gc") was very inefficient.
(usability, bells and whistles)
* Boolean configuration variable yes/no can be written as on/off.
@@ -72,16 +69,10 @@ Updates since v1.6.2
with the 'edit' action in git-add -i/-p, you can abort the editor to
tell git not to apply it.
* The number of commits shown in "you are ahead/behind your upstream"
messages given by "git checkout" and "git status" used to count merge
commits; now it doesn't.
* @{-1} is a new way to refer to the last branch you were on introduced in
1.6.2, but the initial implementation did not teach this to a few
commands. Now the syntax works with "branch -m @{-1} newname".
* "git-add -p" now supports "q"uit action.
* git-archive learned --output=<file> option.
* git-archive takes attributes from the tree being archived; strictly
@@ -109,8 +100,6 @@ Updates since v1.6.2
* git-difftool is now part of the officially supported command, primarily
maintained by David Aguilar.
* git-fast-export choked when seeing a tag that does not point at commit.
* git-for-each-ref learned a new "upstream" token.
* git-format-patch can be told to use attachment with a new configuration,
@@ -163,6 +152,10 @@ Updates since v1.6.2
knobs you can tweak to work around issues with various versions of the
docbook-xsl package. See comments in Documentation/Makefile for details.
* Support for building and testing a subset of git on a system without a
working perl has been improved.
Fixes since v1.6.2
------------------
@@ -184,6 +177,6 @@ v1.6.2.X series.
---
exec >/var/tmp/1
O=v1.6.3-rc0-74-g9824a38
O=v1.6.3-rc2
echo O=$(git describe master)
git shortlog --no-merges $O..master ^maint

View File

@@ -2,15 +2,15 @@ CONFIGURATION FILE
------------------
The git configuration file contains a number of variables that affect
the git command's behavior. `.git/config` file for each repository
is used to store the information for that repository, and
`$HOME/.gitconfig` is used to store per user information to give
fallback values for `.git/config` file. The file `/etc/gitconfig`
can be used to store system-wide defaults.
the git command's behavior. The `.git/config` file in each repository
is used to store the configuration for that repository, and
`$HOME/.gitconfig` is used to store a per-user configuration as
fallback values for the `.git/config` file. The file `/etc/gitconfig`
can be used to store a system-wide default configuration.
They can be used by both the git plumbing
and the porcelains. The variables are divided into sections, where
in the fully qualified variable name the variable itself is the last
The configuration variables are used by both the git plumbing
and the porcelains. The variables are divided into sections, wherein
the fully qualified variable name of the variable itself is the last
dot-separated segment and the section name is everything before the last
dot. The variable names are case-insensitive and only alphanumeric
characters are allowed. Some variables may appear multiple times.
@@ -26,28 +26,28 @@ The file consists of sections and variables. A section begins with
the name of the section in square brackets and continues until the next
section begins. Section names are not case sensitive. Only alphanumeric
characters, `-` and `.` are allowed in section names. Each variable
must belong to some section, which means that there must be section
header before first setting of a variable.
must belong to some section, which means that there must be a section
header before the first setting of a variable.
Sections can be further divided into subsections. To begin a subsection
put its name in double quotes, separated by space from the section name,
in the section header, like in example below:
in the section header, like in the example below:
--------
[section "subsection"]
--------
Subsection names can contain any characters except newline (doublequote
`"` and backslash have to be escaped as `\"` and `\\`,
respectively) and are case sensitive. Section header cannot span multiple
Subsection names are case sensitive and can contain any characters except
newline (doublequote `"` and backslash have to be escaped as `\"` and `\\`,
respectively). Section headers cannot span multiple
lines. Variables may belong directly to a section or to a given subsection.
You can have `[section]` if you have `[section "subsection"]`, but you
don't need to.
There is also (case insensitive) alternative `[section.subsection]` syntax.
In this syntax subsection names follow the same restrictions as for section
name.
There is also a case insensitive alternative `[section.subsection]` syntax.
In this syntax, subsection names follow the same restrictions as for section
names.
All the other lines are recognized as setting variables, in the form
'name = value'. If there is no equal sign on the line, the entire line
@@ -66,10 +66,10 @@ converting value to the canonical form using '--bool' type specifier;
'git-config' will ensure that the output is "true" or "false".
String values may be entirely or partially enclosed in double quotes.
You need to enclose variable value in double quotes if you want to
preserve leading or trailing whitespace, or if variable value contains
beginning of comment characters (if it contains '#' or ';').
Double quote `"` and backslash `\` characters in variable value must
You need to enclose variable values in double quotes if you want to
preserve leading or trailing whitespace, or if the variable value contains
comment characters (i.e. it contains '#' or ';').
Double quote `"` and backslash `\` characters in variable values must
be escaped: use `\"` for `"` and `\\` for `\`.
The following escape sequences (beside `\"` and `\\`) are recognized:
@@ -77,10 +77,10 @@ The following escape sequences (beside `\"` and `\\`) are recognized:
and `\b` for backspace (BS). No other char escape sequence, nor octal
char sequences are valid.
Variable value ending in a `\` is continued on the next line in the
Variable values ending in a `\` are continued on the next line in the
customary UNIX fashion.
Some variables may require special value format.
Some variables may require a special value format.
Example
~~~~~~~
@@ -295,8 +295,10 @@ core.sharedRepository::
group-shareable. When 'umask' (or 'false'), git will use permissions
reported by umask(2). When '0xxx', where '0xxx' is an octal number,
files in the repository will have this mode value. '0xxx' will override
user's umask value, and thus, users with a safe umask (0077) can use
this option. Examples: '0660' is equivalent to 'group'. '0640' is a
user's umask value (whereas the other options will only override
requested parts of the user's umask value). Examples: '0660' will make
the repo read/write-able for the owner and group, but inaccessible to
others (equivalent to 'group' unless umask is e.g. '0022'). '0640' is a
repository that is group-readable but not group-writable.
See linkgit:git-init[1]. False by default.
@@ -427,6 +429,11 @@ relatively high IO latencies. With this set to 'true', git will do the
index comparison to the filesystem data in parallel, allowing
overlapping IO's.
core.unreliableHardlinks::
Some filesystem drivers cannot properly handle hardlinking a file
and deleting the source right away. In such a case, you need to
set this config variable to 'true'.
alias.*::
Command aliases for the linkgit:git[1] command wrapper - e.g.
after defining "alias.last = cat-file commit HEAD", the invocation
@@ -705,6 +712,13 @@ fetch.unpackLimit::
especially on slow filesystems. If not set, the value of
`transfer.unpackLimit` is used instead.
format.attach::
Enable multipart/mixed attachments as the default for
'format-patch'. The value can also be a double quoted string
which will enable attachments as the default and set the
value as the boundary. See the --attach option in
linkgit:git-format-patch[1].
format.numbered::
A boolean which can enable or disable sequence numbers in patch
subjects. It defaults to "auto" which enables it only if there
@@ -716,6 +730,14 @@ format.headers::
Additional email headers to include in a patch to be submitted
by mail. See linkgit:git-format-patch[1].
format.cc::
Additional "Cc:" headers to include in a patch to be submitted
by mail. See the --cc option in linkgit:git-format-patch[1].
format.subjectprefix::
The default for format-patch is to output files with the '[PATCH]'
subject prefix. Use this variable to change that prefix.
format.suffix::
The default for format-patch is to output files with the suffix
`.patch`. Use this variable to change that suffix (make sure to
@@ -728,11 +750,11 @@ format.pretty::
format.thread::
The default threading style for 'git-format-patch'. Can be
either a boolean value, `shallow` or `deep`. 'Shallow'
either a boolean value, `shallow` or `deep`. `shallow`
threading makes every mail a reply to the head of the series,
where the head is chosen from the cover letter, the
`\--in-reply-to`, and the first patch mail, in this order.
'Deep' threading makes every mail a reply to the previous one.
`deep` threading makes every mail a reply to the previous one.
A true boolean value is the same as `shallow`, and a false
value disables threading.

View File

@@ -12,14 +12,17 @@ SYNOPSIS
DESCRIPTION
-----------
Removes files unknown to git. This allows to clean the working tree
from files that are not under version control. If the '-x' option is
specified, ignored files are also removed, allowing to remove all
build products.
This allows cleaning the working tree by removing files that are not
under version control.
Normally, only files unknown to git are removed, but if the '-x'
option is specified, ignored files are also removed. This can, for
example, be useful to remove all build products.
If any optional `<path>...` arguments are given, only those paths
are affected.
OPTIONS
-------
-d::

View File

@@ -196,7 +196,7 @@ Problems related to tags:
If you suspect that any of these issues may apply to the repository you
want to import consider using these alternative tools which proved to be
more stable in practise:
more stable in practice:
* cvs2git (part of cvs2svn), `http://cvs2svn.tigris.org`
* parsecvs, `http://cgit.freedesktop.org/~keithp/parsecvs`

View File

@@ -9,10 +9,10 @@ git-format-patch - Prepare patches for e-mail submission
SYNOPSIS
--------
[verse]
'git format-patch' [-k] [-o <dir> | --stdout] [--thread]
[--attach[=<boundary>] | --inline[=<boundary>] |
[--no-attach]]
[-s | --signoff] [<common diff options>]
'git format-patch' [-k] [(-o|--output-directory) <dir> | --stdout]
[--thread[=<style>]]
[(--attach|--inline)[=<boundary>] | --no-attach]
[-s | --signoff]
[-n | --numbered | -N | --no-numbered]
[--start-number <n>] [--numbered-files]
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
@@ -20,6 +20,7 @@ SYNOPSIS
[--subject-prefix=Subject-Prefix]
[--cc=<email>]
[--cover-letter]
[<common diff options>]
[ <since> | <revision range> ]
DESCRIPTION
@@ -128,9 +129,9 @@ include::diff-options.txt[]
the Message-Id header to reference.
+
The optional <style> argument can be either `shallow` or `deep`.
'Shallow' threading makes every mail a reply to the head of the
'shallow' threading makes every mail a reply to the head of the
series, where the head is chosen from the cover letter, the
`\--in-reply-to`, and the first patch mail, in this order. 'Deep'
`\--in-reply-to`, and the first patch mail, in this order. 'deep'
threading makes every mail a reply to the previous one. If not
specified, defaults to the 'format.thread' configuration, or `shallow`
if that is not set.
@@ -170,18 +171,17 @@ if that is not set.
--suffix=.<sfx>::
Instead of using `.patch` as the suffix for generated
filenames, use specified suffix. A common alternative is
`--suffix=.txt`.
`--suffix=.txt`. Leaving this empty will remove the `.patch`
suffix.
+
Note that you would need to include the leading dot `.` if you
want a filename like `0001-description-of-my-change.patch`, and
the first letter does not have to be a dot. Leaving it empty would
not add any suffix.
Note that the leading character does not have to be a dot; for example,
you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
--no-binary::
Don't output contents of changes in binary files, just take note
that they differ. Note that this disable the patch to be properly
applied. By default the contents of changes in those files are
encoded in the patch.
Do not output contents of changes in binary files, instead
display a notice that those files changed. Patches generated
using this option cannot be applied properly, but they are
still useful for code review.
--root::
Treat the revision argument as a <revision range>, even if it
@@ -192,10 +192,10 @@ not add any suffix.
CONFIGURATION
-------------
You can specify extra mail header lines to be added to each message
in the repository configuration, new defaults for the subject prefix
and file suffix, control attachements, and number patches when outputting
more than one.
You can specify extra mail header lines to be added to each message,
defaults for the subject prefix and file suffix, number patches when
outputting more than one patch, add "Cc:" headers, configure attachments,
and sign off patches with configuration variables.
------------
[format]
@@ -243,8 +243,8 @@ $ git format-patch -M -B origin
+
Additionally, it detects and handles renames and complete rewrites
intelligently to produce a renaming patch. A renaming patch reduces
the amount of text output, and generally makes it easier to review it.
Note that the "patch" program does not understand renaming patches, so
the amount of text output, and generally makes it easier to review.
Note that non-git "patch" programs won't understand renaming patches, so
use it only when you know the recipient uses git to apply your patch.
* Extract three topmost commits from the current branch and format them

View File

@@ -54,15 +54,21 @@ is given:
- 'group' (or 'true'): Make the repository group-writable, (and g+sx, since
the git group may be not the primary group of all users).
This is used to loosen the permissions of an otherwise safe umask(2) value.
Note that the umask still applies to the other permission bits (e.g. if
umask is '0022', using 'group' will not remove read privileges from other
(non-group) users). See '0xxx' for how to exactly specify the repository
permissions.
- 'all' (or 'world' or 'everybody'): Same as 'group', but make the repository
readable by all users.
- '0xxx': '0xxx' is an octal number and each file will have mode '0xxx'
Any option except 'umask' can be set using this option. '0xxx' will
override users umask(2) value, and thus, users with a safe umask (0077)
can use this option. '0640' will create a repository which is group-readable
but not writable. '0660' is equivalent to 'group'.
- '0xxx': '0xxx' is an octal number and each file will have mode '0xxx'.
'0xxx' will override users' umask(2) value (and not only loosen permissions
as 'group' and 'all' does). '0640' will create a repository which is
group-readable, but not group-writable or accessible to others. '0660' will
create a repo that is readable and writable to the current user and group,
but inaccessible to others.
By default, the configuration flag receive.denyNonFastForwards is enabled
in shared repositories, so that you cannot force a non fast-forwarding push

View File

@@ -262,7 +262,7 @@ sendemail.aliasesfile::
sendemail.aliasfiletype::
Format of the file(s) specified in sendemail.aliasesfile. Must be
one of 'mutt', 'mailrc', 'pine', or 'gnus'.
one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.
sendemail.multiedit::
If true (default), a single editor instance will be spawned to edit

View File

@@ -148,9 +148,10 @@ $ git show-branch master fixes mhf
------------------------------------------------
These three branches all forked from a common commit, [master],
whose commit message is "Add 'git show-branch'. "fixes" branch
adds one commit 'Introduce "reset type"'. "mhf" branch has many
other commits. The current branch is "master".
whose commit message is "Add \'git show-branch\'". The "fixes"
branch adds one commit "Introduce "reset type" flag to "git reset"".
The "mhf" branch adds many other commits. The current branch
is "master".
EXAMPLE

View File

@@ -693,9 +693,9 @@ listed below are allowed:
tags = tags/*/project-a:refs/remotes/project-a/tags/*
------------------------------------------------------------------------
Keep in mind that the '*' (asterisk) wildcard of the local ref
Keep in mind that the '\*' (asterisk) wildcard of the local ref
(right of the ':') *must* be the farthest right path component;
however the remote wildcard may be anywhere as long as it's own
however the remote wildcard may be anywhere as long as it's an
independent path component (surrounded by '/' or EOL). This
type of configuration is not automatically created by 'init' and
should be manually entered with a text-editor or using 'git-config'.

View File

@@ -39,12 +39,6 @@ what they are for:
* info/refs
BUGS
----
When you remove an existing ref, the command fails to update
info/refs file unless `--force` flag is given.
Author
------
Written by Junio C Hamano <gitster@pobox.com>

View File

@@ -118,7 +118,7 @@ Importing a CVS archive
First, install version 2.1 or higher of cvsps from
link:http://www.cobite.com/cvsps/[http://www.cobite.com/cvsps/] and make
sure it is in your path. Then cd to a checked out CVS working directory
of the project you are interested in and run 'git-cvsimport':
of the project you are interested in and run linkgit:git-cvsimport[1]:
-------------------------------------------
$ git cvsimport -C <destination> <module>

View File

@@ -167,6 +167,14 @@ all::
# Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
# your external grep (e.g., if your system lacks grep, if its grep is
# broken, or spawning external process is slower than built-in grep git has).
#
# Define UNRELIABLE_FSTAT if your system's fstat does not return the same
# information on a not yet closed file that lstat would return for the same
# file after it was closed.
#
# Define UNRELIABLE_HARDLINKS if your operating systems has problems when
# hardlinking a file to another name and unlinking the original file right
# away (some NTFS drivers seem to zero the contents in that scenario).
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -320,7 +328,6 @@ EXTRA_PROGRAMS =
# ... and all the rest that could be moved out of bindir to gitexecdir
PROGRAMS += $(EXTRA_PROGRAMS)
PROGRAMS += git-fast-import$X
PROGRAMS += git-fetch-pack$X
PROGRAMS += git-hash-object$X
PROGRAMS += git-index-pack$X
PROGRAMS += git-merge-index$X
@@ -329,7 +336,6 @@ PROGRAMS += git-mktag$X
PROGRAMS += git-mktree$X
PROGRAMS += git-pack-redundant$X
PROGRAMS += git-patch-id$X
PROGRAMS += git-send-pack$X
PROGRAMS += git-shell$X
PROGRAMS += git-show-index$X
PROGRAMS += git-unpack-file$X
@@ -806,6 +812,7 @@ ifeq ($(uname_S),HP-UX)
endif
ifneq (,$(findstring CYGWIN,$(uname_S)))
COMPAT_OBJS += compat/cygwin.o
UNRELIABLE_FSTAT = UnfortunatelyYes
endif
ifneq (,$(findstring MINGW,$(uname_S)))
pathsep = ;
@@ -833,6 +840,8 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
NO_NSEC = YesPlease
USE_WIN32_MMAP = YesPlease
UNRELIABLE_FSTAT = UnfortunatelyYes
UNRELIABLE_HARDLINKS = UnfortunatelySometimes
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
@@ -1016,6 +1025,9 @@ else
COMPAT_OBJS += compat/win32mmap.o
endif
endif
ifdef UNRELIABLE_HARDLINKS
COMPAT_CFLAGS += -DUNRELIABLE_HARDLINKS=1
endif
ifdef NO_PREAD
COMPAT_CFLAGS += -DNO_PREAD
COMPAT_OBJS += compat/pread.o
@@ -1111,6 +1123,9 @@ endif
ifdef NO_EXTERNAL_GREP
BASIC_CFLAGS += -DNO_EXTERNAL_GREP
endif
ifdef UNRELIABLE_FSTAT
BASIC_CFLAGS += -DUNRELIABLE_FSTAT
endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
@@ -1524,7 +1539,9 @@ install: all
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
ifndef NO_PERL
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
endif
ifndef NO_TCLTK
$(MAKE) -C gitk-git install
$(MAKE) -C git-gui gitexecdir='$(gitexec_instdir_SQ)' install

View File

@@ -5,6 +5,7 @@
#include "commit.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
#include "unpack-trees.h"
#include "dir.h"
#include "run-command.h"
@@ -178,7 +179,7 @@ static int checkout_merged(int pos, struct checkout *state)
/*
* NEEDSWORK:
* There is absolutely no reason to write this as a blob object
* and create a phoney cache entry just to leak. This hack is
* and create a phony cache entry just to leak. This hack is
* primarily to get to the write_entry() machinery that massages
* the contents to work-tree format and writes out which only
* allows it for a cache entry. The code in write_entry() needs
@@ -364,14 +365,17 @@ static int merge_working_tree(struct checkout_opts *opts,
int ret;
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
int newfd = hold_locked_index(lock_file, 1);
int reprime_cache_tree = 0;
if (read_cache() < 0)
return error("corrupt index file");
cache_tree_free(&active_cache_tree);
if (opts->force) {
ret = reset_tree(new->commit->tree, opts, 1);
if (ret)
return ret;
reprime_cache_tree = 1;
} else {
struct tree_desc trees[2];
struct tree *tree;
@@ -407,7 +411,9 @@ static int merge_working_tree(struct checkout_opts *opts,
init_tree_desc(&trees[1], tree->buffer, tree->size);
ret = unpack_trees(2, trees, &topts);
if (ret == -1) {
if (ret != -1) {
reprime_cache_tree = 1;
} else {
/*
* Unpack couldn't do a trivial merge; either
* give up or do a real merge, depending on
@@ -451,6 +457,8 @@ static int merge_working_tree(struct checkout_opts *opts,
}
}
if (reprime_cache_tree)
prime_cache_tree(&active_cache_tree, new->commit->tree);
if (write_cache(newfd, active_cache, active_nr) ||
commit_locked_index(lock_file))
die("unable to write new index file");

View File

@@ -26,16 +26,13 @@ static int grep_config(const char *var, const char *value, void *cb)
{
struct grep_opt *opt = cb;
if (!strcmp(var, "grep.color") || !strcmp(var, "color.grep")) {
if (!strcmp(var, "color.grep")) {
opt->color = git_config_colorbool(var, value, -1);
return 0;
}
if (!strcmp(var, "grep.color.external") ||
!strcmp(var, "color.grep.external")) {
if (!strcmp(var, "color.grep.external"))
return git_config_string(&(opt->color_external), var, value);
}
if (!strcmp(var, "grep.color.match") ||
!strcmp(var, "color.grep.match")) {
if (!strcmp(var, "color.grep.match")) {
if (!value)
return config_error_nonbool(var);
color_parse(value, var, opt->color_match);

View File

@@ -236,7 +236,7 @@ static int add_man_viewer_info(const char *var, const char *value)
const char *subkey = strrchr(name, '.');
if (!subkey)
return error("Config with no key for man viewer: %s", name);
return 0;
if (!strcmp(subkey, ".path")) {
if (!value)
@@ -249,7 +249,6 @@ static int add_man_viewer_info(const char *var, const char *value)
return add_man_viewer_cmd(name, subkey - name, value);
}
warning("'%s': unsupported man viewer sub key.", subkey);
return 0;
}

View File

@@ -512,7 +512,7 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
pathspec = get_pathspec(prefix, argv);
/* be nice with submodule patsh ending in a slash */
/* be nice with submodule paths ending in a slash */
read_cache();
if (pathspec)
strip_trailing_slash_from_submodules();

View File

@@ -293,7 +293,7 @@ static unsigned long write_object(struct sha1file *f,
die("unable to read %s", sha1_to_hex(entry->idx.sha1));
/*
* make sure no cached delta data remains from a
* previous attempt before a pack split occured.
* previous attempt before a pack split occurred.
*/
free(entry->delta_data);
entry->delta_data = NULL;

View File

@@ -29,41 +29,6 @@ static int list_tree(unsigned char *sha1)
return 0;
}
static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
int cnt;
hashcpy(it->sha1, tree->object.sha1);
init_tree_desc(&desc, tree->buffer, tree->size);
cnt = 0;
while (tree_entry(&desc, &entry)) {
if (!S_ISDIR(entry.mode))
cnt++;
else {
struct cache_tree_sub *sub;
struct tree *subtree = lookup_tree(entry.sha1);
if (!subtree->object.parsed)
parse_tree(subtree);
sub = cache_tree_sub(it, entry.path);
sub->cache_tree = cache_tree();
prime_cache_tree_rec(sub->cache_tree, subtree);
cnt += sub->cache_tree->entry_count;
}
}
it->entry_count = cnt;
}
static void prime_cache_tree(void)
{
if (!nr_trees)
return;
active_cache_tree = cache_tree();
prime_cache_tree_rec(active_cache_tree, trees[0]);
}
static const char read_tree_usage[] = "git read-tree (<sha> | [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--index-output=<file>] <sha1> [<sha2> [<sha3>]])";
static struct lock_file lock_file;
@@ -211,7 +176,6 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
case 3:
default:
opts.fn = threeway_merge;
cache_tree_free(&active_cache_tree);
break;
}
@@ -221,6 +185,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
opts.head_idx = 1;
}
cache_tree_free(&active_cache_tree);
for (i = 0; i < nr_trees; i++) {
struct tree *tree = trees[i];
parse_tree(tree);
@@ -234,11 +199,14 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
* "-m ent" or "--reset ent" form), we can obtain a fully
* valid cache-tree because the index must match exactly
* what came from the tree.
*
* The same holds true if we are switching between two trees
* using read-tree -m A B. The index must match B after that.
*/
if (nr_trees && !opts.prefix && (!opts.merge || (stage == 2))) {
cache_tree_free(&active_cache_tree);
prime_cache_tree();
}
if (nr_trees == 1 && !opts.prefix)
prime_cache_tree(&active_cache_tree, trees[0]);
else if (nr_trees == 2 && opts.merge)
prime_cache_tree(&active_cache_tree, trees[1]);
if (write_cache(newfd, active_cache, active_nr) ||
commit_locked_index(&lock_file))

View File

@@ -240,10 +240,10 @@ static int unreachable(struct expire_reflog_cb *cb, struct commit *commit, unsig
static void mark_reachable(struct commit *commit, unsigned long expire_limit)
{
/*
* We need to compute if commit on either side of an reflog
* We need to compute whether the commit on either side of a reflog
* entry is reachable from the tip of the ref for all entries.
* Mark commits that are reachable from the tip down to the
* time threashold first; we know a commit marked thusly is
* time threshold first; we know a commit marked thusly is
* reachable from the tip without running in_merge_bases()
* at all.
*/

View File

@@ -1216,7 +1216,7 @@ static int update(int argc, const char **argv)
struct option options[] = {
OPT_GROUP("update specific options"),
OPT_BOOLEAN('p', "prune", &prune,
"prune remotes after fecthing"),
"prune remotes after fetching"),
OPT_END()
};

View File

@@ -228,7 +228,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
}
/*
* Otherwise, argv[i] could be either <rev> or <paths> and
* has to be unambigous.
* has to be unambiguous.
*/
else if (!get_sha1(argv[i], sha1)) {
/*

View File

@@ -1,5 +1,6 @@
#include "cache.h"
#include "tree.h"
#include "tree-walk.h"
#include "cache-tree.h"
#ifndef DEBUG
@@ -591,3 +592,36 @@ int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix)
return 0;
}
static void prime_cache_tree_rec(struct cache_tree *it, struct tree *tree)
{
struct tree_desc desc;
struct name_entry entry;
int cnt;
hashcpy(it->sha1, tree->object.sha1);
init_tree_desc(&desc, tree->buffer, tree->size);
cnt = 0;
while (tree_entry(&desc, &entry)) {
if (!S_ISDIR(entry.mode))
cnt++;
else {
struct cache_tree_sub *sub;
struct tree *subtree = lookup_tree(entry.sha1);
if (!subtree->object.parsed)
parse_tree(subtree);
sub = cache_tree_sub(it, entry.path);
sub->cache_tree = cache_tree();
prime_cache_tree_rec(sub->cache_tree, subtree);
cnt += sub->cache_tree->entry_count;
}
}
it->entry_count = cnt;
}
void prime_cache_tree(struct cache_tree **it, struct tree *tree)
{
cache_tree_free(it);
*it = cache_tree();
prime_cache_tree_rec(*it, tree);
}

View File

@@ -1,6 +1,8 @@
#ifndef CACHE_TREE_H
#define CACHE_TREE_H
#include "tree.h"
struct cache_tree;
struct cache_tree_sub {
struct cache_tree *cache_tree;
@@ -33,4 +35,6 @@ int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int)
#define WRITE_TREE_PREFIX_ERROR (-3)
int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix);
void prime_cache_tree(struct cache_tree **, struct tree *);
#endif

View File

@@ -554,6 +554,8 @@ extern enum branch_track git_branch_track;
extern enum rebase_setup_type autorebase;
extern enum push_default_type push_default;
extern int unreliable_hardlinks;
#define GIT_REPO_VERSION 0
extern int repository_format_version;
extern int check_repository_format(void);

View File

@@ -89,10 +89,10 @@ static int cygwin_stat(const char *path, struct stat *buf)
/*
* At start up, we are trying to determine whether Win32 API or cygwin stat
* functions should be used. The choice is determined by core.ignorecygwinfstricks.
* Reading this option is not always possible immediately as git_dir may be
* Reading this option is not always possible immediately as git_dir may
* not be set yet. So until it is set, use cygwin lstat/stat functions.
* However, if core.filemode is set, we must use the Cygwin posix
* stat/lstat as the Windows stat fuctions do not determine posix filemode.
* stat/lstat as the Windows stat functions do not determine posix filemode.
*
* Note that git_cygwin_config() does NOT call git_default_config() and this
* is deliberate. Many commands read from config to establish initial

View File

@@ -39,7 +39,7 @@
# include <stdlib.h>
#endif
/* For platform which support the ISO C amendement 1 functionality we
/* For platforms which support the ISO C amendment 1 functionality we
support user defined character classes. */
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
@@ -90,7 +90,7 @@
# if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
/* The GNU C library provides support for user-defined character classes
and the functions from ISO C amendement 1. */
and the functions from ISO C amendment 1. */
# ifdef CHARCLASS_NAME_MAX
# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
# else

View File

@@ -396,7 +396,7 @@ repeat:
* its own input data to become available. But since
* the process (pack-objects) is itself CPU intensive,
* it will happily pick up the time slice that we are
* relinguishing here.
* relinquishing here.
*/
Sleep(0);
goto repeat;
@@ -934,7 +934,9 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz)
#undef rename
int mingw_rename(const char *pold, const char *pnew)
{
DWORD attrs;
DWORD attrs, gle;
int tries = 0;
static const int delay[] = { 0, 1, 10, 20, 40 };
/*
* Try native rename() first to get errno right.
@@ -944,10 +946,12 @@ int mingw_rename(const char *pold, const char *pnew)
return 0;
if (errno != EEXIST)
return -1;
repeat:
if (MoveFileEx(pold, pnew, MOVEFILE_REPLACE_EXISTING))
return 0;
/* TODO: translate more errors */
if (GetLastError() == ERROR_ACCESS_DENIED &&
gle = GetLastError();
if (gle == ERROR_ACCESS_DENIED &&
(attrs = GetFileAttributes(pnew)) != INVALID_FILE_ATTRIBUTES) {
if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
errno = EISDIR;
@@ -957,10 +961,23 @@ int mingw_rename(const char *pold, const char *pnew)
SetFileAttributes(pnew, attrs & ~FILE_ATTRIBUTE_READONLY)) {
if (MoveFileEx(pold, pnew, MOVEFILE_REPLACE_EXISTING))
return 0;
gle = GetLastError();
/* revert file attributes on failure */
SetFileAttributes(pnew, attrs);
}
}
if (tries < ARRAY_SIZE(delay) && gle == ERROR_ACCESS_DENIED) {
/*
* We assume that some other process had the source or
* destination file open at the wrong moment and retry.
* In order to give the other process a higher chance to
* complete its operation, we give up our time slice now.
* If we have to retry again, we do sleep a bit.
*/
Sleep(delay[tries]);
tries++;
goto repeat;
}
errno = EACCES;
return -1;
}

View File

@@ -1043,7 +1043,7 @@ regex_compile (pattern, size, syntax, bufp)
they can be reliably used as array indices. */
register unsigned char c, c1;
/* A random tempory spot in PATTERN. */
/* A random temporary spot in PATTERN. */
const char *p1;
/* Points to the end of the buffer, where we should append. */
@@ -1796,7 +1796,7 @@ regex_compile (pattern, size, syntax, bufp)
we're all done, the pattern will look like:
set_number_at <jump count> <upper bound>
set_number_at <succeed_n count> <lower bound>
succeed_n <after jump addr> <succed_n count>
succeed_n <after jump addr> <succeed_n count>
<body of loop>
jump_n <succeed_n addr> <jump count>
(The upper bound and `jump_n' are omitted if

View File

@@ -495,6 +495,11 @@ static int git_default_core_config(const char *var, const char *value)
return 0;
}
if (!strcmp(var, "core.unreliablehardlinks")) {
unreliable_hardlinks = git_config_bool(var, value);
return 0;
}
/* Add other config variables here and to Documentation/config.txt. */
return 0;
}

View File

@@ -177,18 +177,11 @@ static enum protocol get_protocol(const char *name)
static const char *ai_name(const struct addrinfo *ai)
{
static char addr[INET_ADDRSTRLEN];
if ( AF_INET == ai->ai_family ) {
struct sockaddr_in *in;
in = (struct sockaddr_in *)ai->ai_addr;
inet_ntop(ai->ai_family, &in->sin_addr, addr, sizeof(addr));
} else if ( AF_INET6 == ai->ai_family ) {
struct sockaddr_in6 *in;
in = (struct sockaddr_in6 *)ai->ai_addr;
inet_ntop(ai->ai_family, &in->sin6_addr, addr, sizeof(addr));
} else {
static char addr[NI_MAXHOST];
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, addr, sizeof(addr), NULL, 0,
NI_NUMERICHOST) != 0)
strcpy(addr, "(unknown)");
}
return addr;
}

View File

@@ -1,12 +1,12 @@
appp.sh is a script that is supposed to be used together with ExternalEditor
for Mozilla Thundebird. It will let you include patches inline in e-mails
for Mozilla Thunderbird. It will let you include patches inline in e-mails
in an easy way.
Usage:
- Generate the patch with git format-patch.
- Start writing a new e-mail in Thunderbird.
- Press the external editor button (or Ctrl-E) to run appp.sh
- Select the previosly generated patch file.
- Select the previously generated patch file.
- Finish editing the e-mail.
Any text that is entered into the message editor before appp.sh is called

View File

@@ -267,7 +267,7 @@ static int find_identical_files(struct file_similarity *src,
int score;
struct diff_filespec *source = p->filespec;
/* False hash collission? */
/* False hash collision? */
if (hashcmp(source->sha1, target->sha1))
continue;
/* Non-regular files? If so, the modes must match! */

View File

@@ -147,7 +147,8 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
wrote = write_in_full(fd, new, size);
/* use fstat() only when path == ce->name */
if (state->refresh_cache && !to_tempfile && !state->base_dir_len) {
if (fstat_is_reliable() &&
state->refresh_cache && !to_tempfile && !state->base_dir_len) {
fstat(fd, &st);
fstat_done = 1;
}

View File

@@ -43,6 +43,10 @@ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
#ifndef UNRELIABLE_HARDLINKS
#define UNRELIABLE_HARDLINKS 0
#endif
int unreliable_hardlinks = UNRELIABLE_HARDLINKS;
/* Parallel index stat data preload? */
int core_preload_index = 0;

View File

@@ -76,7 +76,7 @@ Format of STDIN stream:
delim lf;
# note: declen indicates the length of binary_data in bytes.
# declen does not include the lf preceeding the binary data.
# declen does not include the lf preceding the binary data.
#
exact_data ::= 'data' sp declen lf
binary_data;
@@ -133,8 +133,8 @@ Format of STDIN stream:
# always escapes the related input from comment processing.
#
# In case it is not clear, the '#' that starts the comment
# must be the first character on that the line (an lf have
# preceeded it).
# must be the first character on that line (an lf
# preceded it).
#
comment ::= '#' not_lf* lf;
not_lf ::= # Any byte that is not ASCII newline (LF);
@@ -953,7 +953,7 @@ static void end_packfile(void)
close(pack_data->pack_fd);
idx_name = keep_pack(create_index());
/* Register the packfile with core git's machinary. */
/* Register the packfile with core git's machinery. */
new_p = add_packed_git(idx_name, strlen(idx_name), 1);
if (!new_p)
die("core git rejected index %s", idx_name);

2
fsck.h
View File

@@ -23,7 +23,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...);
* the return value is:
* -1 error in processing the object
* <0 return value of the callback, which lead to an abort
* >0 return value of the first sigaled error >0 (in the case of no other errors)
* >0 return value of the first signaled error >0 (in the case of no other errors)
* 0 everything OK
*/
int fsck_walk(struct object *obj, fsck_walk_func walk, void *data);

View File

@@ -1049,7 +1049,7 @@ sub patch_update_file {
}
print colored $prompt_color, 'Stage ',
($hunk[$ix]{TYPE} eq 'mode' ? 'mode change' : 'this hunk'),
" [y,n,a,d,/$other,?]? ";
" [y,n,q,a,d,/$other,?]? ";
my $line = prompt_single_character;
if ($line) {
if ($line =~ /^y/i) {

View File

@@ -571,7 +571,7 @@ do
GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
export GIT_COMMITTER_DATE
fi &&
git commit-tree $tree ${parent:+-p $parent} <"$dotest/final-commit"
git commit-tree $tree ${parent:+-p} $parent <"$dotest/final-commit"
) &&
git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent ||
stop_here $this

View File

@@ -408,4 +408,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
#endif
#endif
#ifdef UNRELIABLE_FSTAT
#define fstat_is_reliable() 0
#else
#define fstat_is_reliable() 1
#endif
#endif

View File

@@ -82,4 +82,11 @@ sub generate_command
}
setup_environment();
exec(generate_command());
# ActiveState Perl for Win32 does not implement POSIX semantics of
# exec* system call. It just spawns the given executable and finishes
# the starting program, exiting with code 0.
# system will at least catch the errors returned by git diff,
# allowing the caller of git difftool better handling of failures.
my $rc = system(generate_command());
exit($rc | ($rc >> 8));

View File

@@ -430,7 +430,7 @@ if [ "$filter_tag_name" ]; then
if [ "$type" = "tag" ]; then
# Dereference to a commit
sha1t="$sha1"
sha1="$(git rev-parse "$sha1"^{commit} 2>/dev/null)" || continue
sha1="$(git rev-parse -q "$sha1"^{commit})" || continue
fi
[ -f "../map/$sha1" ] || continue

View File

@@ -37,10 +37,10 @@ then
exit 2
fi
git update-index --refresh 2>/dev/null
git update-index -q --refresh
git read-tree -u -m --aggressive $bases $head $remotes || exit 2
echo "Trying simple merge."
if result_tree=$(git write-tree 2>/dev/null)
if result_tree=$(git write-tree 2>/dev/null)
then
exit 0
else

View File

@@ -2,7 +2,7 @@
# git-ls-remote could be called from outside a git managed repository;
# this would fail in that case and would issue an error message.
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) || :;
GIT_DIR=$(git rev-parse -q --git-dir) || :;
get_data_source () {
case "$1" in

View File

@@ -147,7 +147,7 @@ then
echo >&2 "Warning: fetch updated the current branch head."
echo >&2 "Warning: fast forwarding your working tree from"
echo >&2 "Warning: commit $orig_head."
git update-index --refresh 2>/dev/null
git update-index -q --refresh
git read-tree -u -m "$orig_head" "$curr_head" ||
die 'Cannot fast-forward your working tree.
After making sure that you saved anything precious from

View File

@@ -418,6 +418,14 @@ my %parse_alias = (
$x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;
$aliases{$1} = [ split_addrs($2) ];
}},
elm => sub { my $fh = shift;
while (<$fh>) {
if (/^(\S+)\s+=\s+[^=]+=\s(\S+)/) {
my ($alias, $addr) = ($1, $2);
$aliases{$alias} = [ split_addrs($addr) ];
}
} },
gnus => sub { my $fh = shift; while (<$fh>) {
if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
$aliases{$1} = [ $2 ];

View File

@@ -204,8 +204,15 @@ cmd_add()
else
module_clone "$path" "$realrepo" || exit
(unset GIT_DIR; cd "$path" && git checkout -f -q ${branch:+-b "$branch" "origin/$branch"}) ||
die "Unable to checkout submodule '$path'"
(
unset GIT_DIR
cd "$path" &&
# ash fails to wordsplit ${branch:+-b "$branch"...}
case "$branch" in
'') git checkout -f -q ;;
?*) git checkout -f -q -b "$branch" "origin/$branch" ;;
esac
) || die "Unable to checkout submodule '$path'"
fi
git add "$path" ||

2
git.c
View File

@@ -497,7 +497,7 @@ int main(int argc, const char **argv)
/*
* We use PATH to find git commands, but we prepend some higher
* precidence paths: the "--exec-path" option, the GIT_EXEC_PATH
* precedence paths: the "--exec-path" option, the GIT_EXEC_PATH
* environment, and the $(gitexecdir) from the Makefile at build
* time.
*/

View File

@@ -206,7 +206,7 @@ not include variables usually directly set during build):
* $fallback_encoding
Gitweb assumes this charset if line contains non-UTF-8 characters.
Fallback decoding is used without error checking, so it can be even
'utf-8'. Value mist be valid encodig; see Encoding::Supported(3pm) man
'utf-8'. Value must be valid encoding; see Encoding::Supported(3pm) man
page for a list. By default 'latin1', aka. 'iso-8859-1'.
* @diff_opts
Rename detection options for git-diff and git-diff-tree. By default

View File

@@ -688,10 +688,10 @@ sub evaluate_path_info {
# extensions. Allowed extensions are both the defined suffix
# (which includes the initial dot already) and the snapshot
# format key itself, with a prepended dot
while (my ($fmt, %opt) = each %known_snapshot_formats) {
while (my ($fmt, $opt) = each %known_snapshot_formats) {
my $hash = $refname;
my $sfx;
$hash =~ s/(\Q$opt{'suffix'}\E|\Q.$fmt\E)$//;
$hash =~ s/(\Q$opt->{'suffix'}\E|\Q.$fmt\E)$//;
next unless $sfx = $1;
# a valid suffix was found, so set the snapshot format
# and reset the hash parameter

View File

@@ -35,7 +35,7 @@ static void graph_padding_line(struct git_graph *graph, struct strbuf *sb);
* newline. A new graph line will not be printed after the final newline.
* If the strbuf is empty, no output will be printed.
*
* Since the first line will not include the graph ouput, the caller is
* Since the first line will not include the graph output, the caller is
* responsible for printing this line's graph (perhaps via
* graph_show_commit() or graph_show_oneline()) before calling
* graph_show_strbuf().
@@ -727,8 +727,8 @@ static void graph_output_pre_commit_line(struct git_graph *graph,
if (col->commit == graph->commit) {
seen_this = 1;
strbuf_write_column(sb, col, '|');
strbuf_addf(sb, " %*s", graph->expansion_row, "");
chars_written += 2 + graph->expansion_row;
strbuf_addf(sb, "%*s", graph->expansion_row, "");
chars_written += 1 + graph->expansion_row;
} else if (seen_this && (graph->expansion_row == 0)) {
/*
* This is the first line of the pre-commit output.
@@ -852,7 +852,7 @@ static void graph_output_commit_line(struct git_graph *graph, struct strbuf *sb)
graph_output_commit_char(graph, sb);
chars_written++;
if (graph->num_parents > 3)
if (graph->num_parents > 2)
chars_written += graph_draw_octopus_merge(graph,
sb);
} else if (seen_this && (graph->num_parents > 2)) {

View File

@@ -27,7 +27,7 @@
*
* It does so by calculating the costs of the path ending in characters
* i (in string1) and j (in string2), respectively, given that the last
* operation is a substition, a swap, a deletion, or an insertion.
* operation is a substitution, a swap, a deletion, or an insertion.
*
* This implementation allows the costs to be weighted:
*

View File

@@ -52,7 +52,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
*
* `argh`::
* token to explain the kind of argument this option wants. Keep it
* homogenous across the repository.
* homogeneous across the repository.
*
* `help`::
* the short help associated to what the option does.
@@ -61,7 +61,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
*
* `flags`::
* mask of parse_opt_option_flags.
* PARSE_OPT_OPTARG: says that the argument is optionnal (not for BOOLEANs)
* PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
* PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
* PARSE_OPT_NONEG: says that this option cannot be negated
* PARSE_OPT_HIDDEN this option is skipped in the default usage, showed in
@@ -105,7 +105,7 @@ struct option {
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) }
/* parse_options() will filter out the processed options and leave the
* non-option argments in argv[].
* non-option arguments in argv[].
* Returns the number of arguments left in argv[].
*/
extern int parse_options(int argc, const char **argv,
@@ -115,7 +115,7 @@ extern int parse_options(int argc, const char **argv,
extern NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);
/*----- incremantal advanced APIs -----*/
/*----- incremental advanced APIs -----*/
enum {
PARSE_OPT_HELP = -1,

View File

@@ -121,13 +121,13 @@ static void throughput_string(struct throughput *tp, off_t total,
(int)(total >> 30),
(int)(total & ((1 << 30) - 1)) / 10737419);
} else if (total > 1 << 20) {
int x = total + 5243; /* for rounding */
l -= snprintf(tp->display, l, ", %u.%2.2u MiB",
(int)(total >> 20),
((int)(total & ((1 << 20) - 1)) * 100) >> 20);
x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
} else if (total > 1 << 10) {
int x = total + 5; /* for rounding */
l -= snprintf(tp->display, l, ", %u.%2.2u KiB",
(int)(total >> 10),
((int)(total & ((1 << 10) - 1)) * 100) >> 10);
x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
} else {
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
}

View File

@@ -366,7 +366,7 @@ static int handle_config(const char *key, const char *value, void *cb)
}
subkey = strrchr(name, '.');
if (!subkey)
return error("Config with no key for remote %s", name);
return 0;
remote = make_remote(name, subkey - name);
remote->origin = REMOTE_CONFIG;
if (!strcmp(subkey, ".mirror"))
@@ -1413,10 +1413,9 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
if (theirs == ours)
return 0;
/* Run "rev-list --no-merges --left-right ours...theirs" internally... */
/* Run "rev-list --left-right ours...theirs" internally... */
rev_argc = 0;
rev_argv[rev_argc++] = NULL;
rev_argv[rev_argc++] = "--no-merges";
rev_argv[rev_argc++] = "--left-right";
rev_argv[rev_argc++] = symmetric;
rev_argv[rev_argc++] = "--";

View File

@@ -209,7 +209,7 @@ static struct commit *handle_commit(struct rev_info *revs, struct object *object
}
/*
* Tree object? Either mark it uniniteresting, or add it
* Tree object? Either mark it uninteresting, or add it
* to the list of objects to look at later..
*/
if (object->type == OBJ_TREE) {

View File

@@ -2225,7 +2225,9 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
{
int ret = 0;
if (link(tmpfile, filename))
if (unreliable_hardlinks)
goto try_rename;
else if (link(tmpfile, filename))
ret = errno;
/*
@@ -2240,6 +2242,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
* left to unlink.
*/
if (ret && ret != EEXIST) {
try_rename:
if (!rename(tmpfile, filename))
goto out;
ret = errno;

View File

@@ -11,7 +11,7 @@
* build complex strings/buffers whose final size isn't easily known.
*
* It is NOT legal to copy the ->buf pointer away.
* `strbuf_detach' is the operation that detachs a buffer from its shell
* `strbuf_detach' is the operation that detaches a buffer from its shell
* while keeping the shell valid wrt its invariants.
*
* 2. the ->buf member is a byte array that has at least ->len + 1 bytes

View File

@@ -15,14 +15,17 @@ create_file() {
test_expect_success 'setup' '
create_file file1 "File1 contents" &&
create_file file2 "File2 contents" &&
git add file1 file2 &&
create_file file3 "File3 contents" &&
git add file1 file2 file3 &&
git commit -m 1
'
test_expect_success 'criss-cross rename' '
mv file1 tmp &&
mv file2 file1 &&
mv tmp file2
mv tmp file2 &&
cp file1 file1-swapped &&
cp file2 file2-swapped
'
test_expect_success 'diff -M -B' '
@@ -32,7 +35,32 @@ test_expect_success 'diff -M -B' '
'
test_expect_success 'apply' '
git apply diff
git apply diff &&
test_cmp file1 file1-swapped &&
test_cmp file2 file2-swapped
'
test_expect_success 'criss-cross rename' '
git reset --hard &&
mv file1 tmp &&
mv file2 file1 &&
mv file3 file2
mv tmp file3 &&
cp file1 file1-swapped &&
cp file2 file2-swapped &&
cp file3 file3-swapped
'
test_expect_success 'diff -M -B' '
git diff -M -B > diff &&
git reset --hard
'
test_expect_success 'apply' '
git apply diff &&
test_cmp file1 file1-swapped &&
test_cmp file2 file2-swapped &&
test_cmp file3 file3-swapped
'
test_done

View File

@@ -284,10 +284,36 @@ test_expect_success 'set up more tangled history' '
git merge master~3 &&
git merge side~1 &&
git checkout master &&
git merge tangle
git merge tangle &&
git checkout -b reach &&
test_commit reach &&
git checkout master &&
git checkout -b octopus-a &&
test_commit octopus-a &&
git checkout master &&
git checkout -b octopus-b &&
test_commit octopus-b &&
git checkout master &&
test_commit seventh &&
git merge octopus-a octopus-b
git merge reach
'
cat > expect <<\EOF
* Merge branch 'reach'
|\
| \
| \
*-. \ Merge branches 'octopus-a' and 'octopus-b'
|\ \ \
* | | | seventh
| | * | octopus-b
| |/ /
|/| |
| * | octopus-a
|/ /
| * reach
|/
* Merge branch 'tangle'
|\
| * Merge branch 'side' (early part) into tangle
@@ -316,7 +342,7 @@ cat > expect <<\EOF
* initial
EOF
test_expect_success 'log --graph with merge' '
test_expect_sucess 'log --graph with merge' '
git log --graph --date-order --pretty=tformat:%s |
sed "s/ *$//" >actual &&
test_cmp expect actual

View File

@@ -132,4 +132,14 @@ test_expect_success 'clone empty repository' '
test $actual = $expected)
'
test_expect_success 'clone empty repository, and then push should not segfault.' '
cd "$D" &&
rm -fr empty/ empty-clone/ &&
mkdir empty &&
(cd empty && git init) &&
git clone empty empty-clone &&
cd empty-clone &&
test_must_fail git push
'
test_done

View File

@@ -64,6 +64,16 @@ test_expect_success 'submodule add' '
)
'
test_expect_success 'submodule add --branch' '
(
cd addtest &&
git submodule add -b initial "$submodurl" submod-branch &&
git submodule init &&
cd submod-branch &&
git branch | grep initial
)
'
test_expect_success 'submodule add with ./ in path' '
(
cd addtest &&

View File

@@ -69,7 +69,7 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is
done
'
test_expect_failure 'packed obs in alt ODB are repacked when local repo has packs' '
test_expect_success 'packed obs in alt ODB are repacked when local repo has packs' '
rm -f .git/objects/pack/* &&
echo new_content >> file1 &&
git add file1 &&

View File

@@ -10,6 +10,11 @@ Testing basic diff tool invocation
. ./test-lib.sh
if ! test_have_prereq PERL; then
say 'skipping difftool tests, perl not available'
test_done
fi
remove_config_vars()
{
# Unset all config variables used by git-difftool

View File

@@ -616,7 +616,7 @@ test_expect_success 'in-reply-to but no threading' '
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--in-reply-to="<in-reply-id@example.com>" \
--no-thread \
--nothread \
$patches |
grep "In-Reply-To: <in-reply-id@example.com>"
'

View File

@@ -491,7 +491,7 @@ test_create_repo () {
repo="$1"
mkdir -p "$repo"
cd "$repo" || error "Cannot setup test environment"
"$GIT_EXEC_PATH/git-init" "--template=$owd/../templates/blt/" >&3 2>&4 ||
"$GIT_EXEC_PATH/git-init" "--template=$TEST_DIRECTORY/../templates/blt/" >&3 2>&4 ||
error "cannot run git init -- have you built things yet?"
mv .git/hooks .git/hooks-disabled
cd "$owd"

View File

@@ -13,7 +13,7 @@ int main(int argc, char *argv[])
unsigned char *c;
if (argc < 2 || argc > 3) {
fprintf( stderr, "Usage: %s <seed_string> [<size>]", argv[0]);
fprintf(stderr, "Usage: %s <seed_string> [<size>]\n", argv[0]);
return 1;
}

View File

@@ -374,7 +374,7 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
}
/*
* Then, discard all the non-relevane file pairs...
* Then, discard all the non-relevant file pairs...
*/
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];

1
tree.c
View File

@@ -62,6 +62,7 @@ static int match_tree_entry(const char *base, int baselen, const char *path, uns
continue;
/* pathspecs match only at the directory boundaries */
if (!matchlen ||
baselen == matchlen ||
base[matchlen] == '/' ||
match[matchlen - 1] == '/')
return 1;

View File

@@ -456,7 +456,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
/*
* Record the end-of-group position in case we are matched
* with a group of changes in the other file (that is, the
* change record before the enf-of-group index in the other
* change record before the end-of-group index in the other
* file is set).
*/
ixref = rchgo[ixo - 1] ? ix: nrec;