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

This commit is contained in:
Johannes Sixt
2008-12-17 09:13:13 +01:00
43 changed files with 540 additions and 162 deletions

View File

@@ -7,6 +7,9 @@
# Show GIT link as: <command>(<section>); if section is defined, else just show
# the command.
[macros]
(?su)[\\]?(?P<name>linkgit):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
[attributes]
asterisk=&#42;
plus=&#43;

View File

@@ -839,6 +839,57 @@ gui.blamehistoryctx::
Context` menu item is invoked from 'git gui blame'. If this
variable is set to zero, the whole history is shown.
guitool.<name>.cmd::
Specifies the shell command line to execute when the corresponding item
of the linkgit:git-gui[1] `Tools` menu is invoked. This option is
mandatory for every tool. The command is executed from the root of
the working directory, and in the environment it receives the name of
the tool as 'GIT_GUITOOL', the name of the currently selected file as
'FILENAME', and the name of the current branch as 'CUR_BRANCH' (if
the head is detached, 'CUR_BRANCH' is empty).
guitool.<name>.needsfile::
Run the tool only if a diff is selected in the GUI. It guarantees
that 'FILENAME' is not empty.
guitool.<name>.noconsole::
Run the command silently, without creating a window to display its
output.
guitool.<name>.norescan::
Don't rescan the working directory for changes after the tool
finishes execution.
guitool.<name>.confirm::
Show a confirmation dialog before actually running the tool.
guitool.<name>.argprompt::
Request a string argument from the user, and pass it to the tool
through the 'ARGS' environment variable. Since requesting an
argument implies confirmation, the 'confirm' option has no effect
if this is enabled. If the option is set to 'true', 'yes', or '1',
the dialog uses a built-in generic prompt; otherwise the exact
value of the variable is used.
guitool.<name>.revprompt::
Request a single valid revision from the user, and set the
'REVISION' environment variable. In other aspects this option
is similar to 'argprompt', and can be used together with it.
guitool.<name>.revunmerged::
Show only unmerged branches in the 'revprompt' subdialog.
This is useful for tools similar to merge or rebase, but not
for things like checkout or reset.
guitool.<name>.title::
Specifies the title to use for the prompt dialog. The default
is the tool name.
guitool.<name>.prompt::
Specifies the general prompt string to display at the top of
the dialog, before subsections for 'argprompt' and 'revprompt'.
The default value includes the actual command.
help.browser::
Specify the browser that will be used to display help in the
'web' format. See linkgit:git-help[1].

View File

@@ -279,7 +279,7 @@ If you want to know all the values for a multivar, do:
% git config --get-all core.gitproxy
------------
If you like to live dangerous, you can replace *all* core.gitproxy by a
If you like to live dangerously, you can replace *all* core.gitproxy by a
new one with
------------

View File

@@ -15,7 +15,7 @@ DESCRIPTION
This program dumps the given revisions in a form suitable to be piped
into 'git-fast-import'.
You can use it as a human readable bundle replacement (see
You can use it as a human-readable bundle replacement (see
linkgit:git-bundle[1]), or as a kind of an interactive
'git-filter-branch'.

View File

@@ -16,15 +16,15 @@ DESCRIPTION
'git-merge-base' finds best common ancestor(s) between two commits to use
in a three-way merge. One common ancestor is 'better' than another common
ancestor if the latter is an ancestor of the former. A common ancestor
that does not have any better common ancestor than it is a 'best common
that does not have any better common ancestor is a 'best common
ancestor', i.e. a 'merge base'. Note that there can be more than one
merge bases between two commits.
merge base for a pair of commits.
Among the two commits to compute their merge bases, one is specified by
Among the two commits to compute the merge base from, one is specified by
the first commit argument on the command line; the other commit is a
(possibly hypothetical) commit that is a merge across all the remaining
commits on the command line. As the most common special case, giving only
two commits from the command line means computing the merge base between
commits on the command line. As the most common special case, specifying only
two commits on the command line means computing the merge base between
the given two commits.
OPTIONS
@@ -47,7 +47,7 @@ For example, with this topology:
the merge base between 'A' and 'B' is '1'.
Given three commits 'A', 'B' and 'C', `git merge-base A B C` will compute the
merge base between 'A' and an hypothetical commit 'M', which is a merge
merge base between 'A' and a hypothetical commit 'M', which is a merge
between 'B' and 'C'. For example, with this topology:
o---o---o---o---C
@@ -71,8 +71,7 @@ common ancestor between 'A' and 'M', but '1' is a better common ancestor,
because '2' is an ancestor of '1'. Hence, '2' is not a merge base.
When the history involves criss-cross merges, there can be more than one
'best' common ancestors between two commits. For example, with this
topology:
'best' common ancestor for two commits. For example, with this topology:
---1---o---A
\ /
@@ -80,8 +79,8 @@ topology:
/ \
---2---o---o---B
both '1' and '2' are merge-base of A and B. Neither one is better than
the other (both are 'best' merge base). When `--all` option is not given,
both '1' and '2' are merge-bases of A and B. Neither one is better than
the other (both are 'best' merge bases). When the `--all` option is not given,
it is unspecified which best one is output.
Author

View File

@@ -15,17 +15,17 @@ SYNOPSIS
DESCRIPTION
-----------
'git-file-merge' incorporates all changes that lead from the `<base-file>`
'git-merge-file' incorporates all changes that lead from the `<base-file>`
to `<other-file>` into `<current-file>`. The result ordinarily goes into
`<current-file>`. 'git-merge-file' is useful for combining separate changes
to an original. Suppose `<base-file>` is the original, and both
`<current-file>` and `<other-file>` are modifications of `<base-file>`.
Then 'git-merge-file' combines both changes.
`<current-file>` and `<other-file>` are modifications of `<base-file>`,
then 'git-merge-file' combines both changes.
A conflict occurs if both `<current-file>` and `<other-file>` have changes
in a common segment of lines. If a conflict is found, 'git-merge-file'
normally outputs a warning and brackets the conflict with <<<<<<< and
>>>>>>> lines. A typical conflict will look like this:
normally outputs a warning and brackets the conflict with lines containing
<<<<<<< and >>>>>>> markers. A typical conflict will look like this:
<<<<<<< A
lines in file A
@@ -60,7 +60,7 @@ OPTIONS
`<current-file>`.
-q::
Quiet; do not warn about conflicts.
Quiet; do not warn about conflicts.
EXAMPLES

View File

@@ -29,11 +29,11 @@ OPTIONS
Instead of stopping at the first failed merge, do all of them
in one shot - continue with merging even when previous merges
returned errors, and only return the error code after all the
merges are over.
merges.
-q::
Do not complain about failed merge program (the merge program
failure usually indicates conflicts during merge). This is for
Do not complain about a failed merge program (a merge program
failure usually indicates conflicts during the merge). This is for
porcelains which might want to emit custom messages.
If 'git-merge-index' is called with multiple <file>s (or -a) then it

View File

@@ -14,14 +14,14 @@ DESCRIPTION
-----------
Reads three treeish, and output trivial merge results and
conflicting stages to the standard output. This is similar to
what three-way read-tree -m does, but instead of storing the
what three-way 'git read-tree -m' does, but instead of storing the
results in the index, the command outputs the entries to the
standard output.
This is meant to be used by higher level scripts to compute
merge results outside index, and stuff the results back into the
merge results outside of the index, and stuff the results back into the
index. For this reason, the output from the command omits
entries that match <branch1> tree.
entries that match the <branch1> tree.
Author
------

View File

@@ -69,20 +69,20 @@ Three kinds of merge can happen:
simplest case, called "Already up-to-date."
* `HEAD` is already contained in the merged commit. This is the
most common case especially when involved through 'git pull':
you are tracking an upstream repository, committed no local
most common case especially when invoked from 'git pull':
you are tracking an upstream repository, have committed no local
changes and now you want to update to a newer upstream revision.
Your `HEAD` (and the index) is updated to at point the merged
Your `HEAD` (and the index) is updated to point at the merged
commit, without creating an extra merge commit. This is
called "Fast-forward".
* Both the merged commit and `HEAD` are independent and must be
tied together by a merge commit that has them both as its parents.
tied together by a merge commit that has both of them as its parents.
The rest of this section describes this "True merge" case.
The chosen merge strategy merges the two commits into a single
new source tree.
When things cleanly merge, these things happen:
When things merge cleanly, this is what happens:
1. The results are updated both in the index file and in your
working tree;
@@ -91,16 +91,16 @@ When things cleanly merge, these things happen:
4. The `HEAD` pointer gets advanced.
Because of 2., we require that the original state of the index
file to match exactly the current `HEAD` commit; otherwise we
file matches exactly the current `HEAD` commit; otherwise we
will write out your local changes already registered in your
index file along with the merge result, which is not good.
Because 1. involves only the paths different between your
Because 1. involves only those paths differing between your
branch and the remote branch you are pulling from during the
merge (which is typically a fraction of the whole tree), you can
have local modifications in your working tree as long as they do
not overlap with what the merge updates.
When there are conflicts, these things happen:
When there are conflicts, the following happens:
1. `HEAD` stays the same.
@@ -111,8 +111,8 @@ When there are conflicts, these things happen:
versions; stage1 stores the version from the common ancestor,
stage2 from `HEAD`, and stage3 from the remote branch (you
can inspect the stages with `git ls-files -u`). The working
tree files have the result of "merge" program; i.e. 3-way
merge result with familiar conflict markers `<<< === >>>`.
tree files contain the result of the "merge" program; i.e. 3-way
merge results with familiar conflict markers `<<< === >>>`.
4. No other changes are done. In particular, the local
modifications you had before you started merge will stay the
@@ -145,13 +145,13 @@ Git makes conflict resolution easy.
And here is another line that is cleanly resolved or unmodified.
------------
The area a pair of conflicting changes happened is marked with markers
The area where a pair of conflicting changes happened is marked with markers
"`<<<<<<<`", "`=======`", and "`>>>>>>>`". The part before the "`=======`"
is typically your side, and the part after it is typically their side.
is typically your side, and the part afterwards is typically their side.
The default format does not show what the original said in the conflicted
area. You cannot tell how many lines are deleted and replaced with the
Barbie's remark by your side. The only thing you can tell is that your
The default format does not show what the original said in the conflicting
area. You cannot tell how many lines are deleted and replaced with
Barbie's remark on your side. The only thing you can tell is that your
side wants to say it is hard and you'd prefer to go shopping, while the
other side wants to claim it is easy.
@@ -186,14 +186,14 @@ HOW TO RESOLVE CONFLICTS
After seeing a conflict, you can do two things:
* Decide not to merge. The only clean-up you need are to reset
* Decide not to merge. The only clean-ups you need are to reset
the index file to the `HEAD` commit to reverse 2. and to clean
up working tree changes made by 2. and 3.; 'git-reset --hard' can
be used for this.
* Resolve the conflicts. Git will mark the conflicts in
the working tree. Edit the files into shape and
'git-add' to the index. 'git-commit' to seal the deal.
'git-add' them to the index. Use 'git-commit' to seal the deal.
You can work through the conflict with a number of tools:

View File

@@ -38,7 +38,7 @@ can configure the absolute path to kdiff3 by setting
`mergetool.kdiff3.path`. Otherwise, 'git-mergetool' assumes the
tool is available in PATH.
+
Instead of running one of the known merge tool programs
Instead of running one of the known merge tool programs,
'git-mergetool' can be customized to run an alternative program
by specifying the command line to invoke in a configuration
variable `mergetool.<tool>.cmd`.
@@ -55,7 +55,7 @@ of the file to which the merge tool should write the result of the
merge resolution.
+
If the custom merge tool correctly indicates the success of a
merge resolution with its exit code then the configuration
merge resolution with its exit code, then the configuration
variable `mergetool.<tool>.trustExitCode` can be set to `true`.
Otherwise, 'git-mergetool' will prompt the user to indicate the
success of the resolution after the custom tool has exited.

View File

@@ -46,7 +46,7 @@ The --cc option must be repeated for each user you want on the cc list.
Use $GIT_EDITOR, core.editor, $VISUAL, or $EDITOR to edit an
introductory message for the patch series.
+
When compose is in used, git send-email gets less interactive will use the
When '--compose' is used, git send-email gets less interactive will use the
values of the headers you set there. If the body of the email (what you type
after the headers and a blank line) only contains blank (or GIT: prefixed)
lines, the summary won't be sent, but git-send-email will still use the

View File

@@ -1,10 +1,10 @@
merge.conflictstyle::
Specify the style in which conflicted hunks are written out to
working tree files upon merge. The default is "merge", which
shows `<<<<<<<` conflict marker, change made by one side,
`=======` marker, change made by the other side, and then
`>>>>>>>` marker. An alternate style, "diff3", adds `|||||||`
marker and the original text before `=======` marker.
shows a `<<<<<<<` conflict marker, changes made by one side,
a `=======` marker, changes made by the other side, and then
a `>>>>>>>` marker. An alternate style, "diff3", adds a `|||||||`
marker and the original text before the `=======` marker.
merge.log::
Whether to include summaries of merged commits in newly created
@@ -32,10 +32,10 @@ merge.verbosity::
message if conflicts were detected. Level 1 outputs only
conflicts, 2 outputs conflicts and file changes. Level 5 and
above outputs debugging information. The default is level 2.
Can be overridden by 'GIT_MERGE_VERBOSITY' environment variable.
Can be overridden by the 'GIT_MERGE_VERBOSITY' environment variable.
merge.<driver>.name::
Defines a human readable name for a custom low-level
Defines a human-readable name for a custom low-level
merge driver. See linkgit:gitattributes[5] for details.
merge.<driver>.driver::

View File

@@ -12,7 +12,7 @@
-n::
--no-stat::
Do not show diffstat at the end of the merge.
Do not show a diffstat at the end of the merge.
--summary::
--no-summary::

View File

@@ -135,7 +135,7 @@ them, and give the same timestamp to the index file:
This will make all index entries racily clean. The linux-2.6
project, for example, there are over 20,000 files in the working
tree. On my Athron 64X2 3800+, after the above:
tree. On my Athlon 64 X2 3800+, after the above:
$ /usr/bin/time git diff-files
1.68user 0.54system 0:02.22elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k

View File

@@ -13,7 +13,7 @@ to build and test a particular version of a software project, search for
regressions, and so on.
People needing to do actual development will also want to read
<<Developing-with-git>> and <<sharing-development>>.
<<Developing-With-git>> and <<sharing-development>>.
Further chapters cover more specialized topics.
@@ -399,7 +399,7 @@ the order it uses to decide which to choose when there are multiple
references with the same shorthand name, see the "SPECIFYING
REVISIONS" section of linkgit:git-rev-parse[1].
[[Updating-a-repository-with-git-fetch]]
[[Updating-a-repository-With-git-fetch]]
Updating a repository with git-fetch
------------------------------------
@@ -955,7 +955,7 @@ echo "git diff --stat --summary -M v$last v$new > ../diffstat-$new"
and then he just cut-and-pastes the output commands after verifying that
they look OK.
[[Finding-comments-with-given-content]]
[[Finding-comments-With-given-Content]]
Finding commits referencing a file with given content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -972,7 +972,7 @@ Figuring out why this works is left as an exercise to the (advanced)
student. The linkgit:git-log[1], linkgit:git-diff-tree[1], and
linkgit:git-hash-object[1] man pages may prove helpful.
[[Developing-with-git]]
[[Developing-With-git]]
Developing with git
===================
@@ -1675,7 +1675,7 @@ dangling objects can arise in other situations.
Sharing development with others
===============================
[[getting-updates-with-git-pull]]
[[getting-updates-With-git-pull]]
Getting updates with git-pull
-----------------------------
@@ -1683,7 +1683,7 @@ After you clone a repository and make a few changes of your own, you
may wish to check the original repository for updates and merge them
into your own work.
We have already seen <<Updating-a-repository-with-git-fetch,how to
We have already seen <<Updating-a-repository-With-git-fetch,how to
keep remote tracking branches up to date>> with linkgit:git-fetch[1],
and how to merge two branches. So you can merge in changes from the
original repository's master branch with:
@@ -1794,7 +1794,7 @@ Public git repositories
Another way to submit changes to a project is to tell the maintainer
of that project to pull the changes from your repository using
linkgit:git-pull[1]. In the section "<<getting-updates-with-git-pull,
linkgit:git-pull[1]. In the section "<<getting-updates-With-git-pull,
Getting updates with git-pull>>" we described this as a way to get
updates from the "main" repository, but it works just as well in the
other direction.
@@ -2004,7 +2004,7 @@ $ git push ssh://yourserver.com/~you/proj.git +master
Normally whenever a branch head in a public repository is modified, it
is modified to point to a descendant of the commit that it pointed to
before. By forcing a push in this situation, you break that convention.
(See <<problems-with-rewriting-history>>.)
(See <<problems-With-rewriting-history>>.)
Nevertheless, this is a common practice for people that need a simple
way to publish a work-in-progress patch series, and it is an acceptable
@@ -2573,7 +2573,7 @@ There are numerous other tools, such as StGIT, which exist for the
purpose of maintaining a patch series. These are outside of the scope of
this manual.
[[problems-with-rewriting-history]]
[[problems-With-rewriting-history]]
Problems with rewriting history
-------------------------------

View File

@@ -23,7 +23,7 @@ static void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
int num_unmatched = 0, i;
/*
* Since we are walking the index as if we are warlking the directory,
* Since we are walking the index as if we were walking the directory,
* we have to mark the matched pathspec as seen; otherwise we will
* mistakenly think that the user gave a pathspec that did not match
* anything.

View File

@@ -165,7 +165,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
ret = 1;
} else {
struct strbuf buf = STRBUF_INIT;
printf("Deleted %sbranch %s.\n", remote, argv[i]);
printf("Deleted %sbranch %s (%s).\n", remote, argv[i],
find_unique_abbrev(sha1, DEFAULT_ABBREV));
strbuf_addf(&buf, "branch.%s", argv[i]);
if (git_config_rename_section(buf.buf, NULL) < 0)
warning("Update of config-file failed");

View File

@@ -228,7 +228,8 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
newfd = hold_locked_index(lock_file, 1);
read_cache();
if (read_cache() < 0)
return error("corrupt index file");
if (source_tree)
read_tree_some(source_tree, pathspec);
@@ -371,7 +372,9 @@ 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);
read_cache();
if (read_cache() < 0)
return error("corrupt index file");
if (opts->force) {
ret = reset_tree(new->commit->tree, opts, 1);

View File

@@ -932,11 +932,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
return git_status_config(k, v, cb);
}
static const char commit_utf8_warn[] =
"Warning: commit message does not conform to UTF-8.\n"
"You may want to amend it after fixing the message, or set the config\n"
"variable i18n.commitencoding to the encoding your project uses.\n";
int cmd_commit(int argc, const char **argv, const char *prefix)
{
struct strbuf sb = STRBUF_INIT;

View File

@@ -290,8 +290,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
/* Otherwise, we are doing the usual "git" diff */
rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
/* Default to let external be used */
/* Default to let external and textconv be used */
DIFF_OPT_SET(&rev.diffopt, ALLOW_EXTERNAL);
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
if (nongit)
die("Not a git repository");
@@ -303,7 +304,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
}
DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
/*
* If the user asked for our exit code then don't start a

View File

@@ -64,11 +64,11 @@ static int fsck_error_func(struct object *obj, int type, const char *err, ...)
return (type == FSCK_WARN) ? 0 : 1;
}
static struct object_array pending;
static int mark_object(struct object *obj, int type, void *data)
{
struct tree *tree = NULL;
struct object *parent = data;
int result;
if (!obj) {
printf("broken link from %7s %s\n",
@@ -96,6 +96,20 @@ static int mark_object(struct object *obj, int type, void *data)
return 1;
}
add_object_array(obj, (void *) parent, &pending);
return 0;
}
static void mark_object_reachable(struct object *obj)
{
mark_object(obj, OBJ_ANY, 0);
}
static int traverse_one_object(struct object *obj, struct object *parent)
{
int result;
struct tree *tree = NULL;
if (obj->type == OBJ_TREE) {
obj->parsed = 0;
tree = (struct tree *)obj;
@@ -107,15 +121,22 @@ static int mark_object(struct object *obj, int type, void *data)
free(tree->buffer);
tree->buffer = NULL;
}
if (result < 0)
result = 1;
return result;
}
static void mark_object_reachable(struct object *obj)
static int traverse_reachable(void)
{
mark_object(obj, OBJ_ANY, 0);
int result = 0;
while (pending.nr) {
struct object_array_entry *entry;
struct object *obj, *parent;
entry = pending.objects + --pending.nr;
obj = entry->item;
parent = (struct object *) entry->name;
result |= traverse_one_object(obj, parent);
}
return !!result;
}
static int mark_used(struct object *obj, int type, void *data)
@@ -237,6 +258,9 @@ static void check_connectivity(void)
{
int i, max;
/* Traverse the pending reachable objects */
traverse_reachable();
/* Look up all the requirements, warn about missing objects.. */
max = get_max_object_index();
if (verbose)

View File

@@ -37,6 +37,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
DIFF_OPT_SET(&rev->diffopt, RECURSIVE);
rev->show_root_diff = default_show_root;
rev->subject_prefix = fmt_patch_subject_prefix;
DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
if (default_date_mode)
rev->date_mode = parse_date_format(default_date_mode);
@@ -60,7 +61,6 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
} else
die("unrecognized argument: %s", arg);
}
DIFF_OPT_SET(&rev->diffopt, ALLOW_TEXTCONV);
}
/*
@@ -340,7 +340,13 @@ int cmd_show(int argc, const char **argv, const char *prefix)
t->tag,
diff_get_color_opt(&rev.diffopt, DIFF_RESET));
ret = show_object(o->sha1, 1, &rev);
objects[i].item = parse_object(t->tagged->sha1);
if (ret)
break;
o = parse_object(t->tagged->sha1);
if (!o)
ret = error("Could not read object %s",
sha1_to_hex(t->tagged->sha1));
objects[i].item = o;
i--;
break;
}

View File

@@ -535,6 +535,7 @@ static void write_pack_file(void)
snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
base_name, sha1_to_hex(sha1));
free_pack_by_name(tmpname);
if (adjust_perm(pack_tmp_name, mode))
die("unable to make temporary pack file readable: %s",
strerror(errno));

View File

@@ -820,6 +820,7 @@ extern int open_pack_index(struct packed_git *);
extern unsigned char* use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
extern void close_pack_windows(struct packed_git *);
extern void unuse_pack(struct pack_window **);
extern void free_pack_by_name(const char *);
extern struct packed_git *add_packed_git(const char *, int, int);
extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t);
extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t);

View File

@@ -636,10 +636,7 @@ int git_config(config_fn_t fn, void *data)
char *repo_config = NULL;
const char *home = NULL;
/* $GIT_CONFIG makes git read _only_ the given config file,
* $GIT_CONFIG_LOCAL will make it process it in addition to the
* global config file, the same way it would the per-repository
* config file otherwise. */
/* Setting $GIT_CONFIG makes git read _only_ the given config file. */
if (config_exclusive_filename)
return git_config_from_file(fn, config_exclusive_filename, data);
if (git_config_system() && !access(git_etc_gitconfig(), R_OK))

View File

@@ -1155,7 +1155,7 @@ _git_config ()
;;
color.*.*)
__gitcomp "
black red green yellow blue magenta cyan white
normal black red green yellow blue magenta cyan white
bold dim ul blink reverse
"
return
@@ -1179,7 +1179,7 @@ _git_config ()
branch.*.*)
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "remote merge" "$pfx" "$cur"
__gitcomp "remote merge mergeoptions" "$pfx" "$cur"
return
;;
branch.*)
@@ -1192,7 +1192,7 @@ _git_config ()
local pfx="${cur%.*}."
cur="${cur##*.}"
__gitcomp "
url fetch push skipDefaultUpdate
url proxy fetch push mirror skipDefaultUpdate
receivepack uploadpack tagopt
" "$pfx" "$cur"
return
@@ -1206,85 +1206,161 @@ _git_config ()
esac
__gitcomp "
apply.whitespace
core.fileMode
core.gitProxy
core.ignoreStat
core.preferSymlinkRefs
core.logAllRefUpdates
core.loosecompression
core.repositoryFormatVersion
core.sharedRepository
core.warnAmbiguousRefs
core.compression
core.packedGitWindowSize
core.packedGitLimit
branch.autosetupmerge
branch.autosetuprebase
clean.requireForce
color.branch
color.branch.current
color.branch.local
color.branch.remote
color.branch.plain
color.branch.remote
color.diff
color.diff.plain
color.diff.meta
color.diff.frag
color.diff.old
color.diff.new
color.diff.commit
color.diff.frag
color.diff.meta
color.diff.new
color.diff.old
color.diff.plain
color.diff.whitespace
color.interactive
color.interactive.header
color.interactive.help
color.interactive.prompt
color.pager
color.status
color.status.header
color.status.added
color.status.changed
color.status.header
color.status.nobranch
color.status.untracked
color.status.updated
color.ui
commit.template
core.autocrlf
core.bare
core.compression
core.deltaBaseCacheLimit
core.editor
core.excludesfile
core.fileMode
core.fsyncobjectfiles
core.gitProxy
core.ignoreCygwinFSTricks
core.ignoreStat
core.logAllRefUpdates
core.loosecompression
core.packedGitLimit
core.packedGitWindowSize
core.pager
core.preferSymlinkRefs
core.preloadindex
core.quotepath
core.repositoryFormatVersion
core.safecrlf
core.sharedRepository
core.symlinks
core.trustctime
core.warnAmbiguousRefs
core.whitespace
core.worktree
diff.autorefreshindex
diff.external
diff.mnemonicprefix
diff.renameLimit
diff.renameLimit.
diff.renames
fetch.unpackLimit
format.headers
format.subjectprefix
gitcvs.enabled
gitcvs.logfile
gitcvs.allbinary
gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dbpass
gitcvs.dbtablenameprefix
format.numbered
format.pretty
format.suffix
gc.aggressiveWindow
gc.auto
gc.autopacklimit
gc.packrefs
gc.pruneexpire
gc.reflogexpire
gc.reflogexpireunreachable
gc.rerereresolved
gc.rerereunresolved
http.sslVerify
http.sslCert
http.sslKey
http.sslCAInfo
http.sslCAPath
http.maxRequests
gitcvs.allbinary
gitcvs.dbTableNamePrefix
gitcvs.dbdriver
gitcvs.dbname
gitcvs.dbpass
gitcvs.dbuser
gitcvs.enabled
gitcvs.logfile
gitcvs.usecrlfattr
gui.blamehistoryctx
gui.commitmsgwidth
gui.copyblamethreshold
gui.diffcontext
gui.encoding
gui.fastcopyblame
gui.matchtrackingbranch
gui.newbranchtemplate
gui.pruneduringfetch
gui.spellingdictionary
gui.trustmtime
help.autocorrect
help.browser
help.format
http.lowSpeedLimit
http.lowSpeedTime
http.maxRequests
http.noEPSV
http.proxy
http.sslCAInfo
http.sslCAPath
http.sslCert
http.sslKey
http.sslVerify
i18n.commitEncoding
i18n.logOutputEncoding
instaweb.browser
instaweb.httpd
instaweb.local
instaweb.modulepath
instaweb.port
log.date
log.showroot
man.viewer
merge.conflictstyle
merge.log
merge.renameLimit
merge.stat
merge.tool
merge.summary
merge.verbosity
pack.window
pack.depth
pack.windowMemory
mergetool.keepBackup
pack.compression
pack.deltaCacheSize
pack.deltaCacheLimit
pack.deltaCacheSize
pack.depth
pack.indexVersion
pack.packSizeLimit
pack.threads
pack.window
pack.windowMemory
pull.octopus
pull.twohead
repack.useDeltaBaseOffset
receive.denyCurrentBranch
receive.denyDeletes
receive.denyNonFastForwards
receive.fsckObjects
receive.unpackLimit
repack.usedeltabaseoffset
rerere.autoupdate
rerere.enabled
showbranch.default
status.relativePaths
status.showUntrackedFiles
tar.umask
transfer.unpackLimit
receive.unpackLimit
receive.denyNonFastForwards
user.name
user.email
user.name
user.signingkey
web.browser
branch. remote.
"
}

View File

@@ -249,9 +249,16 @@ def p4Where(depotPath):
outputList = p4CmdList("where %s" % depotPath)
output = None
for entry in outputList:
if entry["depotFile"] == depotPath:
output = entry
break
if "depotFile" in entry:
if entry["depotFile"] == depotPath:
output = entry
break
elif "data" in entry:
data = entry.get("data")
space = data.find(" ")
if data[:space] == depotPath:
output = entry
break
if output == None:
return ""
if output["code"] == "error":

52
diff.c
View File

@@ -229,6 +229,8 @@ static void emit_rewrite_diff(const char *name_a,
const char *name_b,
struct diff_filespec *one,
struct diff_filespec *two,
const char *textconv_one,
const char *textconv_two,
struct diff_options *o)
{
int lc_a, lc_b;
@@ -241,6 +243,8 @@ static void emit_rewrite_diff(const char *name_a,
const char *reset = diff_get_color(color_diff, DIFF_RESET);
static struct strbuf a_name = STRBUF_INIT, b_name = STRBUF_INIT;
const char *a_prefix, *b_prefix;
const char *data_one, *data_two;
size_t size_one, size_two;
if (diff_mnemonic_prefix && DIFF_OPT_TST(o, REVERSE_DIFF)) {
a_prefix = o->b_prefix;
@@ -262,8 +266,27 @@ static void emit_rewrite_diff(const char *name_a,
diff_populate_filespec(one, 0);
diff_populate_filespec(two, 0);
lc_a = count_lines(one->data, one->size);
lc_b = count_lines(two->data, two->size);
if (textconv_one) {
data_one = run_textconv(textconv_one, one, &size_one);
if (!data_one)
die("unable to read files to diff");
}
else {
data_one = one->data;
size_one = one->size;
}
if (textconv_two) {
data_two = run_textconv(textconv_two, two, &size_two);
if (!data_two)
die("unable to read files to diff");
}
else {
data_two = two->data;
size_two = two->size;
}
lc_a = count_lines(data_one, size_one);
lc_b = count_lines(data_two, size_two);
fprintf(o->file,
"%s--- %s%s%s\n%s+++ %s%s%s\n%s@@ -",
metainfo, a_name.buf, name_a_tab, reset,
@@ -273,9 +296,9 @@ static void emit_rewrite_diff(const char *name_a,
print_line_count(o->file, lc_b);
fprintf(o->file, " @@%s\n", reset);
if (lc_a)
copy_file_with_prefix(o->file, '-', one->data, one->size, old, reset);
copy_file_with_prefix(o->file, '-', data_one, size_one, old, reset);
if (lc_b)
copy_file_with_prefix(o->file, '+', two->data, two->size, new, reset);
copy_file_with_prefix(o->file, '+', data_two, size_two, new, reset);
}
static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one)
@@ -1334,6 +1357,11 @@ static void builtin_diff(const char *name_a,
const char *a_prefix, *b_prefix;
const char *textconv_one = NULL, *textconv_two = NULL;
if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
textconv_one = get_textconv(one);
textconv_two = get_textconv(two);
}
diff_set_mnemonic_prefix(o, "a/", "b/");
if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
a_prefix = o->b_prefix;
@@ -1376,8 +1404,11 @@ static void builtin_diff(const char *name_a,
*/
if ((one->mode ^ two->mode) & S_IFMT)
goto free_ab_and_return;
if (complete_rewrite) {
emit_rewrite_diff(name_a, name_b, one, two, o);
if (complete_rewrite &&
(textconv_one || !diff_filespec_is_binary(one)) &&
(textconv_two || !diff_filespec_is_binary(two))) {
emit_rewrite_diff(name_a, name_b, one, two,
textconv_one, textconv_two, o);
o->found_changes = 1;
goto free_ab_and_return;
}
@@ -1386,11 +1417,6 @@ static void builtin_diff(const char *name_a,
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
textconv_one = get_textconv(one);
textconv_two = get_textconv(two);
}
if (!DIFF_OPT_TST(o, TEXT) &&
( (diff_filespec_is_binary(one) && !textconv_one) ||
(diff_filespec_is_binary(two) && !textconv_two) )) {
@@ -2477,6 +2503,10 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
DIFF_OPT_SET(options, ALLOW_EXTERNAL);
else if (!strcmp(arg, "--no-ext-diff"))
DIFF_OPT_CLR(options, ALLOW_EXTERNAL);
else if (!strcmp(arg, "--textconv"))
DIFF_OPT_SET(options, ALLOW_TEXTCONV);
else if (!strcmp(arg, "--no-textconv"))
DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
else if (!strcmp(arg, "--ignore-submodules"))
DIFF_OPT_SET(options, IGNORE_SUBMODULES);

View File

@@ -554,6 +554,10 @@ static void *pool_alloc(size_t len)
struct mem_pool *p;
void *r;
/* round up to a 'uintmax_t' alignment */
if (len & (sizeof(uintmax_t) - 1))
len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1));
for (p = mem_pool; p; p = p->next_pool)
if ((p->end - p->next_free >= len))
break;
@@ -572,9 +576,6 @@ static void *pool_alloc(size_t len)
}
r = p->next_free;
/* round out to a 'uintmax_t' alignment */
if (len & (sizeof(uintmax_t) - 1))
len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1));
p->next_free += len;
return r;
}
@@ -982,8 +983,10 @@ static void end_packfile(void)
pack_id++;
}
else
else {
close(old_p->pack_fd);
unlink(old_p->pack_name);
}
free(old_p);
/* We can't carry a delta across packfiles. */

View File

@@ -332,11 +332,14 @@ else
fi
# The tree must be really really clean.
git update-index --ignore-submodules --refresh || exit
if ! git update-index --ignore-submodules --refresh; then
echo >&2 "cannot rebase: you have unstaged changes"
exit 1
fi
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
case "$diff" in
?*) echo "cannot rebase: your index is not up-to-date"
echo "$diff"
?*) echo >&2 "cannot rebase: your index contains uncommitted changes"
echo >&2 "$diff"
exit 1
;;
esac

View File

@@ -2403,12 +2403,20 @@ sub find_parent_branch {
$gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1);
}
my ($r0, $parent) = $gs->find_rev_before($r, 1);
if (!defined $r0 || !defined $parent) {
my ($base, $head) = parse_revision_argument(0, $r);
if ($base <= $r) {
{
my ($base, $head);
if (!defined $r0 || !defined $parent) {
($base, $head) = parse_revision_argument(0, $r);
} else {
if ($r0 < $r) {
$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,
0, 1, sub { $base = $_[1] - 1 });
}
}
if (defined $base && $base <= $r) {
$gs->fetch($base, $r);
}
($r0, $parent) = $gs->last_rev_commit;
($r0, $parent) = $gs->find_rev_before($r, 1);
}
if (defined $r0 && defined $parent) {
print STDERR "Found branch parent: ($self->{ref_id}) $parent\n";
@@ -5007,8 +5015,7 @@ sub minimize_connections {
}
}
if (@emptied) {
my $file = $ENV{GIT_CONFIG} || $ENV{GIT_CONFIG_LOCAL} ||
"$ENV{GIT_DIR}/config";
my $file = $ENV{GIT_CONFIG} || "$ENV{GIT_DIR}/config";
print STDERR <<EOF;
The following [svn-remote] sections in your config file ($file) are empty
and can be safely removed:

View File

@@ -2764,7 +2764,7 @@ sub insert_file {
my $filename = shift;
open my $fd, '<', $filename;
print map(to_utf8, <$fd>);
print map { to_utf8($_) } <$fd>;
close $fd;
}

View File

@@ -70,7 +70,8 @@ void setup_pager(void)
/* original process continues, but writes to the pipe */
dup2(pager_process.in, 1);
dup2(pager_process.in, 2);
if (isatty(2))
dup2(pager_process.in, 2);
close(pager_process.in);
/* this makes sure that the parent terminates after the pager */

View File

@@ -1527,7 +1527,7 @@ int write_index(const struct index_state *istate, int newfd)
/*
* Read the index file that is potentially unmerged into given
* index_state, dropping any unmerged entries. Returns true is
* index_state, dropping any unmerged entries. Returns true if
* the index is unmerged. Callers who want to refuse to work
* from an unmerged state can call this and check its return value,
* instead of calling read_cache().

View File

@@ -672,6 +672,37 @@ void unuse_pack(struct pack_window **w_cursor)
}
}
/*
* This is used by git-repack in case a newly created pack happens to
* contain the same set of objects as an existing one. In that case
* the resulting file might be different even if its name would be the
* same. It is best to close any reference to the old pack before it is
* replaced on disk. Of course no index pointers nor windows for given pack
* must subsist at this point. If ever objects from this pack are requested
* again, the new version of the pack will be reinitialized through
* reprepare_packed_git().
*/
void free_pack_by_name(const char *pack_name)
{
struct packed_git *p, **pp = &packed_git;
while (*pp) {
p = *pp;
if (strcmp(pack_name, p->pack_name) == 0) {
close_pack_windows(p);
if (p->pack_fd != -1)
close(p->pack_fd);
if (p->index_data)
munmap((void *)p->index_data, p->index_size);
free(p->bad_object_sha1);
*pp = p->next;
free(p);
return;
}
pp = &p->next;
}
}
/*
* Do not call this directly as this leaks p->pack_fd on error return;
* call open_packed_git() instead.

View File

@@ -196,7 +196,8 @@ test_expect_success 'test deleting branch deletes branch config' \
test_expect_success 'test deleting branch without config' \
'git branch my7 s &&
test "$(git branch -d my7 2>&1)" = "Deleted branch my7."'
sha1=$(git rev-parse my7 | cut -c 1-7) &&
test "$(git branch -d my7 2>&1)" = "Deleted branch my7 ($sha1)."'
test_expect_success 'test --track without .fetch entries' \
'git branch --track my8 &&

67
t/t4031-diff-rewrite-binary.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/bin/sh
test_description='rewrite diff on binary file'
. ./test-lib.sh
# We must be large enough to meet the MINIMUM_BREAK_SIZE
# requirement.
make_file() {
# common first line to help identify rewrite versus regular diff
printf "=\n" >file
for i in 1 2 3 4 5 6 7 8 9 10
do
for j in 1 2 3 4 5 6 7 8 9
do
for k in 1 2 3 4 5
do
printf "$1\n"
done
done
done >>file
}
test_expect_success 'create binary file with changes' '
make_file "\\0" &&
git add file &&
make_file "\\01"
'
test_expect_success 'vanilla diff is binary' '
git diff >diff &&
grep "Binary files a/file and b/file differ" diff
'
test_expect_success 'rewrite diff is binary' '
git diff -B >diff &&
grep "dissimilarity index" diff &&
grep "Binary files a/file and b/file differ" diff
'
test_expect_success 'rewrite diff can show binary patch' '
git diff -B --binary >diff &&
grep "dissimilarity index" diff &&
grep "GIT binary patch" diff
'
{
echo "#!$SHELL_PATH"
cat <<'EOF'
perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
EOF
} >dump
chmod +x dump
test_expect_success 'setup textconv' '
echo file diff=foo >.gitattributes &&
git config diff.foo.textconv "$PWD"/dump
'
test_expect_success 'rewrite diff respects textconv' '
git diff -B >diff &&
grep "dissimilarity index" diff &&
grep "^-61" diff &&
grep "^-0" diff
'
test_done

View File

@@ -99,7 +99,7 @@ test_expect_success \
! test -f victim/.git/refs/heads/extra
'
unset GIT_CONFIG GIT_CONFIG_LOCAL
unset GIT_CONFIG
HOME=`pwd`/no-such-directory
export HOME ;# this way we force the victim/.git/config to be used.

20
t/t7007-show.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
test_description='git show'
. ./test-lib.sh
test_expect_success setup '
echo hello world >foo &&
H=$(git hash-object -w foo) &&
git tag -a foo-tag -m "Tags $H" $H &&
HH=$(expr "$H" : "\(..\)") &&
H38=$(expr "$H" : "..\(.*\)") &&
rm -f .git/objects/$HH/$H38
'
test_expect_success 'showing a tag that point at a missing object' '
test_must_fail git --no-pager show foo-tag
'
test_done

View File

@@ -149,6 +149,48 @@ test_expect_success "track initial change if it was only made to parent" '
"`git rev-parse r9270-d~1`"
'
test_expect_success "follow-parent is atomic" '
(
cd wc &&
svn up &&
svn mkdir stunk &&
echo "trunk stunk" > stunk/readme &&
svn add stunk/readme &&
svn ci -m "trunk stunk" &&
echo "stunk like junk" >> stunk/readme &&
svn ci -m "really stunk" &&
echo "stink stank stunk" >> stunk/readme &&
svn ci -m "even the grinch agrees"
) &&
svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
{ svn cp -m "early stunk flunked too" \
"$svnrepo"/stunk@17 "$svnrepo"/flunked ||
svn cp -m "early stunk flunked too" \
-r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
git svn fetch -i stunk &&
git update-ref refs/remotes/flunk@18 refs/remotes/stunk~2 &&
git update-ref -d refs/remotes/stunk &&
git config --unset svn-remote.svn.fetch stunk &&
mkdir -p "$GIT_DIR"/svn/flunk@18 &&
rev_map=$(cd "$GIT_DIR"/svn/stunk && ls .rev_map*) &&
dd if="$GIT_DIR"/svn/stunk/$rev_map \
of="$GIT_DIR"/svn/flunk@18/$rev_map bs=24 count=1 &&
rm -rf "$GIT_DIR"/svn/stunk &&
git svn init --minimize-url -i flunk "$svnrepo"/flunk &&
git svn fetch -i flunk &&
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
git svn fetch -i stunk &&
git svn init --minimize-url -i flunked "$svnrepo"/flunked &&
git svn fetch -i flunked
test "`git rev-parse --verify refs/remotes/flunk@18`" \
= "`git rev-parse --verify refs/remotes/stunk`" &&
test "`git rev-parse --verify refs/remotes/flunk~1`" \
= "`git rev-parse --verify refs/remotes/stunk`" &&
test "`git rev-parse --verify refs/remotes/flunked~1`" \
= "`git rev-parse --verify refs/remotes/stunk~1`"
'
test_expect_success "track multi-parent paths" '
svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
git svn multi-fetch &&

View File

@@ -673,4 +673,14 @@ test_expect_success \
gitweb_run "p=.git;a=tree"'
test_debug 'cat gitweb.log'
# ----------------------------------------------------------------------
# non-ASCII in README.html
test_expect_success \
'README.html with non-ASCII characters (utf-8)' \
'echo "<b>UTF-8 example:</b><br />" > .git/README.html &&
cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html &&
gitweb_run "p=.git;a=summary"'
test_debug 'cat gitweb.log'
test_done

View File

@@ -471,7 +471,6 @@ PATH=$TEST_DIRECTORY/..:$PATH
GIT_EXEC_PATH=$(pwd)/..
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
unset GIT_CONFIG
unset GIT_CONFIG_LOCAL
GIT_CONFIG_NOSYSTEM=1
GIT_CONFIG_NOGLOBAL=1
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL

View File

@@ -279,11 +279,11 @@ static void wt_status_print_verbose(struct wt_status *s)
struct rev_info rev;
init_revisions(&rev, NULL);
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
setup_revisions(0, NULL, &rev,
s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.diffopt.detect_rename = 1;
DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
rev.diffopt.file = s->fp;
rev.diffopt.close_file = 0;
/*