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

This commit is contained in:
Johannes Sixt
2009-06-23 08:31:19 +02:00
76 changed files with 1141 additions and 810 deletions

2
.gitattributes vendored
View File

@@ -1,2 +1,2 @@
* whitespace=!indent,trail,space
*.[ch] whitespace
*.[ch] whitespace=indent,trail,space

View File

@@ -0,0 +1,38 @@
GIT v1.6.3.3 Release Notes
==========================
Fixes since v1.6.3.2
--------------------
* "git archive" running on Cygwin can get stuck in an infinite loop.
* "git daemon" did not correctly parse the initial line that carries
virtual host request information.
* "git diff --textconv" leaked memory badly when the textconv filter
errored out.
* The built-in regular expressions to pick function names to put on
hunk header lines for java and objc were very inefficiently written.
* in certain error situations git-fetch (and git-clone) on Windows didn't
detect connection abort and ended up waiting indefinitely.
* import-tars script (in contrib) did not import symbolic links correctly.
* http.c used CURLOPT_SSLKEY even on libcURL version 7.9.2, even though
it was only available starting 7.9.3.
* low-level filelevel merge driver used return value from strdup()
without checking if we ran out of memory.
* "git rebase -i" left stray closing parenthesis in its reflog message.
* "git remote show" did not show all the URLs associated with the named
remote, even though "git remote -v" did. Made them consistent by
making the former show all URLs.
* "whitespace" attribute that is set was meant to detect all errors known
to git, but it told git to ignore trailing carriage-returns.
Includes other documentation fixes.

View File

@@ -1319,6 +1319,9 @@ remote.<name>.url::
The URL of a remote repository. See linkgit:git-fetch[1] or
linkgit:git-push[1].
remote.<name>.pushurl::
The push URL of a remote repository. See linkgit:git-push[1].
remote.<name>.proxy::
For remotes that require curl (http, https and ftp), the URL to
the proxy to use for that remote. Set to the empty string to

View File

@@ -63,6 +63,10 @@ OPTIONS
-u::
Update affected files from CVS repository before attempting export.
-k::
Reverse CVS keyword expansion (e.g. $Revision: 1.2.3.4$
becomes $Revision$) in working CVS checkout before applying patch.
-w::
Specify the location of the CVS checkout to use for the export. This
option does not require GIT_DIR to be set before execution if the

View File

@@ -17,26 +17,6 @@ routines to parse files under $GIT_DIR/remotes/ and
$GIT_DIR/branches/ and configuration variables that are related
to fetching, pulling and pushing.
The primary entry points are:
get_remote_refs_for_fetch::
Given the list of user-supplied `<repo> <refspec>...`,
return the list of refs to fetch after canonicalizing
them into `$GIT_DIR` relative paths
(e.g. `refs/heads/foo`). When `<refspec>...` is empty
the returned list of refs consists of the defaults
for the given `<repo>`, if specified in
`$GIT_DIR/remotes/`, `$GIT_DIR/branches/`, or `remote.*.fetch`
configuration.
get_remote_refs_for_push::
Given the list of user-supplied `<repo> <refspec>...`,
return the list of refs to push in a form suitable to be
fed to the 'git-send-pack' command. When `<refspec>...`
is empty the returned list of refs consists of the
defaults for the given `<repo>`, if specified in
`$GIT_DIR/remotes/`.
Author
------
Written by Junio C Hamano.

View File

@@ -193,12 +193,12 @@ Automating
- 'self' will avoid including the sender
- 'cc' will avoid including anyone mentioned in Cc lines in the patch header
except for self (use 'self' for that).
- 'ccbody' will avoid including anyone mentioned in Cc lines in the
- 'bodycc' will avoid including anyone mentioned in Cc lines in the
patch body (commit message) except for self (use 'self' for that).
- 'sob' will avoid including anyone mentioned in Signed-off-by lines except
for self (use 'self' for that).
- 'cccmd' will avoid running the --cc-cmd.
- 'body' is equivalent to 'sob' + 'ccbody'
- 'body' is equivalent to 'sob' + 'bodycc'
- 'all' will suppress all auto cc values.
--
+

View File

@@ -24,7 +24,7 @@ The --exclude-existing form is a filter that does the inverse, it shows the
refs from stdin that don't exist in the local repository.
Use of this utility is encouraged in favor of directly accessing files under
in the `.git` directory.
the `.git` directory.
OPTIONS
-------
@@ -50,7 +50,7 @@ OPTIONS
-s::
--hash::
Only show the SHA1 hash, not the reference name. When also using
Only show the SHA1 hash, not the reference name. When combined with
--dereference the dereferenced tag will still be shown after the SHA1.
--verify::

View File

@@ -115,8 +115,9 @@ init::
update::
Update the registered submodules, i.e. clone missing submodules and
checkout the commit specified in the index of the containing repository.
This will make the submodules HEAD be detached unless '--rebase' is
specified or the key `submodule.$name.update` is set to `rebase`.
This will make the submodules HEAD be detached unless '--rebase' or
'--merge' is specified or the key `submodule.$name.update` is set to
`rebase` or `merge`.
+
If the submodule is not yet initialized, and you just want to use the
setting as stored in .gitmodules, you can automatically initialize the
@@ -180,6 +181,16 @@ OPTIONS
This option is only valid for the update command.
Don't fetch new objects from the remote site.
--merge::
This option is only valid for the update command.
Merge the commit recorded in the superproject into the current branch
of the submodule. If this option is given, the submodule's HEAD will
not be detached. If a merge failure prevents this process, you will
have to resolve the resulting conflicts within the submodule with the
usual conflict resolution tools.
If the key `submodule.$name.update` is set to `merge`, this option is
implicit.
--rebase::
This option is only valid for the update command.
Rebase the current branch onto the commit recorded in the

View File

@@ -623,7 +623,7 @@ pulled or merged from. This is because the author favored
If you use `git svn set-tree A..B` to commit several diffs and you do
not have the latest remotes/git-svn merged into my-branch, you should
use `git svn rebase` to update your work branch instead of `git pull` or
`git merge`. `pull`/`merge' can cause non-linear history to be flattened
`git merge`. `pull`/`merge` can cause non-linear history to be flattened
when committing into SVN, which can lead to merge commits reversing
previous commits in SVN.

View File

@@ -43,9 +43,10 @@ unreleased) version of git, that is available from 'master'
branch of the `git.git` repository.
Documentation for older releases are available here:
* link:v1.6.3.2/git.html[documentation for release 1.6.3.2]
* link:v1.6.3.3/git.html[documentation for release 1.6.3.3]
* release notes for
link:RelNotes-1.6.3.3.txt[1.6.3.3],
link:RelNotes-1.6.3.2.txt[1.6.3.2],
link:RelNotes-1.6.3.1.txt[1.6.3.1],
link:RelNotes-1.6.3.txt[1.6.3].

View File

@@ -35,9 +35,11 @@ submodule.<name>.update::
If 'checkout' (the default), the new commit specified in the
superproject will be checked out in the submodule on a detached HEAD.
If 'rebase', the current branch of the submodule will be rebased onto
the commit specified in the superproject.
the commit specified in the superproject. If 'merge', the commit
specified in the superproject will be merged into the current branch
in the submodule.
This config option is overridden if 'git submodule update' is given
the '--rebase' option.
the '--merge' or '--rebase' options.
EXAMPLES

View File

@@ -18,6 +18,10 @@ struct remote
An array of all of the url_nr URLs configured for the remote
`pushurl`::
An array of all of the pushurl_nr push URLs configured for the remote
`push`::
An array of refspecs configured for pushing, with

View File

@@ -27,10 +27,13 @@ config file would appear like this:
------------
[remote "<name>"]
url = <url>
pushurl = <pushurl>
push = <refspec>
fetch = <refspec>
------------
The `<pushurl>` is used for pushes only. It is optional and defaults
to `<url>`.
Named file in `$GIT_DIR/remotes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3
attr.c
View File

@@ -35,8 +35,7 @@ static struct git_attr *(git_attr_hash[HASHSIZE]);
static unsigned hash_name(const char *name, int namelen)
{
unsigned val = 0;
unsigned char c;
unsigned val = 0, c;
while (namelen--) {
c = *name++;

View File

@@ -91,7 +91,7 @@ void encode_85(char *buf, const unsigned char *data, int bytes)
unsigned acc = 0;
int cnt;
for (cnt = 24; cnt >= 0; cnt -= 8) {
int ch = *data++;
unsigned ch = *data++;
acc |= ch << cnt;
if (--bytes == 0)
break;

View File

@@ -454,7 +454,7 @@ static int read_bisect_refs(void)
return for_each_ref_in("refs/bisect/", register_ref, NULL);
}
void read_bisect_paths(struct argv_array *array)
static void read_bisect_paths(struct argv_array *array)
{
struct strbuf str = STRBUF_INIT;
const char *filename = git_path("BISECT_NAMES");
@@ -780,7 +780,7 @@ static void handle_bad_merge_base(void)
exit(1);
}
void handle_skipped_merge_base(const unsigned char *mb)
static void handle_skipped_merge_base(const unsigned char *mb)
{
char *mb_hex = sha1_to_hex(mb);
char *bad_hex = sha1_to_hex(current_bad_sha1);

View File

@@ -189,7 +189,7 @@ int interactive_add(int argc, const char **argv, const char *prefix)
return status;
}
int edit_patch(int argc, const char **argv, const char *prefix)
static int edit_patch(int argc, const char **argv, const char *prefix)
{
char *file = xstrdup(git_path("ADD_EDIT.patch"));
const char *apply_argv[] = { "apply", "--recount", "--cached",
@@ -298,6 +298,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
int add_new_files;
int require_pathspec;
git_config(add_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_add_options,
builtin_add_usage, PARSE_OPT_KEEP_ARGV0);
if (patch_interactive)
@@ -305,8 +307,6 @@ int cmd_add(int argc, const char **argv, const char *prefix)
if (add_interactive)
exit(interactive_add(argc - 1, argv + 1, prefix));
git_config(add_config, NULL);
if (edit_interactive)
return(edit_patch(argc, argv, prefix));
argc--;

View File

@@ -2614,7 +2614,7 @@ static int get_current_sha1(const char *path, unsigned char *sha1)
static void build_fake_ancestor(struct patch *list, const char *filename)
{
struct patch *patch;
struct index_state result = { 0 };
struct index_state result = { NULL };
int fd;
/* Once we start supporting the reverse patch, it may be
@@ -3277,9 +3277,11 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
OPT_BOOLEAN(0, "stat", &diffstat,
"instead of applying the patch, output diffstat for the input"),
{ OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary,
NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
NULL, "old option, now no-op",
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
{ OPTION_BOOLEAN, 0, "binary", &binary,
NULL, "old option, now no-op", PARSE_OPT_HIDDEN },
NULL, "old option, now no-op",
PARSE_OPT_HIDDEN | PARSE_OPT_NOARG },
OPT_BOOLEAN(0, "numstat", &numstat,
"shows number of added and deleted lines in decimal notation"),
OPT_BOOLEAN(0, "summary", &summary,

View File

@@ -141,7 +141,7 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare)
if (is_bare) {
struct strbuf result = STRBUF_INIT;
strbuf_addf(&result, "%.*s.git", (int)(end - start), start);
dir = strbuf_detach(&result, 0);
dir = strbuf_detach(&result, NULL);
} else
dir = xstrndup(start, end - start);
/*

View File

@@ -561,14 +561,6 @@ static void populate_value(struct refinfo *ref)
ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt);
buf = get_obj(ref->objectname, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
sha1_to_hex(ref->objectname), ref->refname);
if (!obj)
die("parse_object_buffer failed on %s for %s",
sha1_to_hex(ref->objectname), ref->refname);
/* Fill in specials first */
for (i = 0; i < used_atom_cnt; i++) {
const char *name = used_atom[i];
@@ -621,6 +613,22 @@ static void populate_value(struct refinfo *ref)
}
}
for (i = 0; i < used_atom_cnt; i++) {
struct atom_value *v = &ref->value[i];
if (v->s == NULL)
goto need_obj;
}
return;
need_obj:
buf = get_obj(ref->objectname, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
sha1_to_hex(ref->objectname), ref->refname);
if (!obj)
die("parse_object_buffer failed on %s for %s",
sha1_to_hex(ref->objectname), ref->refname);
grab_values(ref->value, 0, obj, buf, size);
if (!eaten)
free(buf);
@@ -926,7 +934,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
memset(&cbdata, 0, sizeof(cbdata));
cbdata.grab_pattern = argv;
for_each_ref(grab_single_ref, &cbdata);
for_each_rawref(grab_single_ref, &cbdata);
refs = cbdata.grab_array;
num_refs = cbdata.grab_cnt;

View File

@@ -104,7 +104,7 @@ static int mark_object(struct object *obj, int type, void *data)
static void mark_object_reachable(struct object *obj)
{
mark_object(obj, OBJ_ANY, 0);
mark_object(obj, OBJ_ANY, NULL);
}
static int traverse_one_object(struct object *obj, struct object *parent)
@@ -292,7 +292,7 @@ static int fsck_sha1(const unsigned char *sha1)
fprintf(stderr, "Checking %s %s\n",
typename(obj->type), sha1_to_hex(obj->sha1));
if (fsck_walk(obj, mark_used, 0))
if (fsck_walk(obj, mark_used, NULL))
objerror(obj, "broken links");
if (fsck_object(obj, check_strict, fsck_error_func))
return -1;

View File

@@ -394,7 +394,7 @@ static void get_html_page_path(struct strbuf *page_path, const char *page)
* HTML.
*/
#ifndef open_html
void open_html(const char *path)
static void open_html(const char *path)
{
execl_git_cmd("web--browse", "-c", "help.browser", path, NULL);
}

View File

@@ -94,7 +94,7 @@ static void show_early_header(struct rev_info *rev, const char *stage, int nr)
printf("Final output: %d %s\n", nr, stage);
}
struct itimerval early_output_timer;
static struct itimerval early_output_timer;
static void log_show_early(struct rev_info *revs, struct commit_list *list)
{
@@ -977,7 +977,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
strbuf_addch(&buf, '\n');
}
rev.extra_headers = strbuf_detach(&buf, 0);
rev.extra_headers = strbuf_detach(&buf, NULL);
if (start_number < 0)
start_number = 1;

View File

@@ -370,7 +370,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
strbuf_addstr(&buf, "refs/heads/");
strbuf_addstr(&buf, remote);
resolve_ref(buf.buf, branch_head, 0, 0);
resolve_ref(buf.buf, branch_head, 0, NULL);
if (!hashcmp(remote_head->sha1, branch_head)) {
strbuf_addf(msg, "%s\t\tbranch '%s' of .\n",
@@ -409,7 +409,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
strbuf_addstr(&truname, "refs/heads/");
strbuf_addstr(&truname, remote);
strbuf_setlen(&truname, truname.len - len);
if (resolve_ref(truname.buf, buf_sha, 0, 0)) {
if (resolve_ref(truname.buf, buf_sha, 0, NULL)) {
strbuf_addf(msg,
"%s\t\tbranch '%s'%s of .\n",
sha1_to_hex(remote_head->sha1),

View File

@@ -653,8 +653,7 @@ static void rehash_objects(void)
static unsigned name_hash(const char *name)
{
unsigned char c;
unsigned hash = 0;
unsigned c, hash = 0;
if (!name)
return 0;

View File

@@ -117,6 +117,8 @@ static int do_push(const char *repo, int flags)
{
int i, errs;
struct remote *remote = remote_get(repo);
const char **url;
int url_nr;
if (!remote) {
if (repo)
@@ -152,9 +154,16 @@ static int do_push(const char *repo, int flags)
setup_default_push_refspecs();
}
errs = 0;
for (i = 0; i < remote->url_nr; i++) {
if (remote->pushurl_nr) {
url = remote->pushurl;
url_nr = remote->pushurl_nr;
} else {
url = remote->url;
url_nr = remote->url_nr;
}
for (i = 0; i < url_nr; i++) {
struct transport *transport =
transport_get(remote, remote->url[i]);
transport_get(remote, url[i]);
int err;
if (receivepack)
transport_set_option(transport,
@@ -163,14 +172,14 @@ static int do_push(const char *repo, int flags)
transport_set_option(transport, TRANS_OPT_THIN, "yes");
if (flags & TRANSPORT_PUSH_VERBOSE)
fprintf(stderr, "Pushing to %s\n", remote->url[i]);
fprintf(stderr, "Pushing to %s\n", url[i]);
err = transport_push(transport, refspec_nr, refspec, flags);
err |= transport_disconnect(transport);
if (!err)
continue;
error("failed to push some refs to '%s'", remote->url[i]);
error("failed to push some refs to '%s'", url[i]);
errs++;
}
return !!errs;

View File

@@ -740,7 +740,7 @@ static int rm(int argc, const char **argv)
return result;
}
void clear_push_info(void *util, const char *string)
static void clear_push_info(void *util, const char *string)
{
struct push_info *info = util;
free(info->dest);
@@ -815,7 +815,7 @@ struct show_info {
int any_rebase;
};
int add_remote_to_show_info(struct string_list_item *item, void *cb_data)
static int add_remote_to_show_info(struct string_list_item *item, void *cb_data)
{
struct show_info *info = cb_data;
int n = strlen(item->string);
@@ -825,7 +825,7 @@ int add_remote_to_show_info(struct string_list_item *item, void *cb_data)
return 0;
}
int show_remote_info_item(struct string_list_item *item, void *cb_data)
static int show_remote_info_item(struct string_list_item *item, void *cb_data)
{
struct show_info *info = cb_data;
struct ref_states *states = info->states;
@@ -852,7 +852,7 @@ int show_remote_info_item(struct string_list_item *item, void *cb_data)
return 0;
}
int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data)
static int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data)
{
struct show_info *show_info = cb_data;
struct ref_states *states = show_info->states;
@@ -874,7 +874,7 @@ int add_local_to_show_info(struct string_list_item *branch_item, void *cb_data)
return 0;
}
int show_local_info_item(struct string_list_item *item, void *cb_data)
static int show_local_info_item(struct string_list_item *item, void *cb_data)
{
struct show_info *show_info = cb_data;
struct branch_info *branch_info = item->util;
@@ -906,7 +906,7 @@ int show_local_info_item(struct string_list_item *item, void *cb_data)
return 0;
}
int add_push_to_show_info(struct string_list_item *push_item, void *cb_data)
static int add_push_to_show_info(struct string_list_item *push_item, void *cb_data)
{
struct show_info *show_info = cb_data;
struct push_info *push_info = push_item->util;
@@ -935,7 +935,7 @@ static int cmp_string_with_push(const void *va, const void *vb)
return cmp ? cmp : strcmp(a_push->dest, b_push->dest);
}
int show_push_info_item(struct string_list_item *item, void *cb_data)
static int show_push_info_item(struct string_list_item *item, void *cb_data)
{
struct show_info *show_info = cb_data;
struct push_info *push_info = item->util;
@@ -999,15 +999,25 @@ static int show(int argc, const char **argv)
info.list = &info_list;
for (; argc; argc--, argv++) {
int i;
const char **url;
int url_nr;
get_remote_ref_states(*argv, &states, query_flag);
printf("* remote %s\n", *argv);
if (states.remote->url_nr) {
for (i=0; i < states.remote->url_nr; i++)
printf(" URL: %s\n", states.remote->url[i]);
} else
printf(" URL: %s\n", "(no URL)");
printf(" Fetch URL: %s\n", states.remote->url_nr > 0 ?
states.remote->url[0] : "(no URL)");
if (states.remote->pushurl_nr) {
url = states.remote->pushurl;
url_nr = states.remote->pushurl_nr;
} else {
url = states.remote->url;
url_nr = states.remote->url_nr;
}
for (i=0; i < url_nr; i++)
printf(" Push URL: %s\n", url[i]);
if (!i)
printf(" Push URL: %s\n", "(no URL)");
if (no_query)
printf(" HEAD branch: (not queried)\n");
else if (!states.heads.nr)
@@ -1187,7 +1197,7 @@ static int get_one_remote_for_update(struct remote *remote, void *priv)
return 0;
}
struct remote_group {
static struct remote_group {
const char *name;
struct string_list *list;
} remote_group;
@@ -1266,14 +1276,31 @@ static int update(int argc, const char **argv)
static int get_one_entry(struct remote *remote, void *priv)
{
struct string_list *list = priv;
const char **url;
int i, url_nr;
void **utilp;
if (remote->url_nr > 0) {
int i;
for (i = 0; i < remote->url_nr; i++)
string_list_append(remote->name, list)->util = (void *)remote->url[i];
utilp = &(string_list_append(remote->name, list)->util);
*utilp = xmalloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
strcpy((char *) *utilp, remote->url[0]);
strcat((char *) *utilp, " (fetch)");
} else
string_list_append(remote->name, list)->util = NULL;
if (remote->pushurl_nr) {
url = remote->pushurl;
url_nr = remote->pushurl_nr;
} else {
url = remote->url;
url_nr = remote->url_nr;
}
for (i = 0; i < url_nr; i++)
{
utilp = &(string_list_append(remote->name, list)->util);
*utilp = xmalloc(strlen(url[i])+strlen(" (push)")+1);
strcpy((char *) *utilp, url[i]);
strcat((char *) *utilp, " (push)");
}
return 0;
}
@@ -1281,7 +1308,10 @@ static int get_one_entry(struct remote *remote, void *priv)
static int show_all(void)
{
struct string_list list = { NULL, 0, 0 };
int result = for_each_remote(get_one_entry, &list);
int result;
list.strdup_strings = 1;
result = for_each_remote(get_one_entry, &list);
if (!result) {
int i;
@@ -1299,6 +1329,7 @@ static int show_all(void)
}
}
}
string_list_clear(&list, 1);
return result;
}

View File

@@ -376,8 +376,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
struct commit_list *with_commit = NULL;
struct option options[] = {
OPT_BOOLEAN('l', NULL, &list, "list tag names"),
{ OPTION_INTEGER, 'n', NULL, &lines, NULL,
"print n lines of each tag message",
{ OPTION_INTEGER, 'n', NULL, &lines, "n",
"print <n> lines of each tag message",
PARSE_OPT_OPTARG, NULL, 1 },
OPT_BOOLEAN('d', NULL, &delete, "delete tags"),
OPT_BOOLEAN('v', NULL, &verify, "verify tags"),

View File

@@ -158,7 +158,7 @@ struct obj_info {
#define FLAG_WRITTEN (1u<<21)
static struct obj_info *obj_list;
unsigned nr_objects;
static unsigned nr_objects;
/*
* Called only from check_object() after it verified this object
@@ -200,7 +200,7 @@ static int check_object(struct object *obj, int type, void *data)
if (fsck_object(obj, 1, fsck_error_function))
die("Error in object");
if (!fsck_walk(obj, check_object, 0))
if (!fsck_walk(obj, check_object, NULL))
die("Error on reachable objects of %s", sha1_to_hex(obj->sha1));
write_cached_object(obj);
return 1;
@@ -210,7 +210,7 @@ static void write_rest(void)
{
unsigned i;
for (i = 0; i < nr_objects; i++)
check_object(obj_list[i].obj, OBJ_ANY, 0);
check_object(obj_list[i].obj, OBJ_ANY, NULL);
}
static void added_object(unsigned nr, enum object_type type,
@@ -422,8 +422,8 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
static void unpack_one(unsigned nr)
{
unsigned shift;
unsigned char *pack, c;
unsigned long size;
unsigned char *pack;
unsigned long size, c;
enum object_type type;
obj_list[nr].offset = consumed_bytes;

View File

@@ -80,16 +80,17 @@ static void error_clnt(const char *fmt, ...)
die("sent error to the client: %s", buf);
}
static void process_input(int child_fd, int band)
static ssize_t process_input(int child_fd, int band)
{
char buf[16384];
ssize_t sz = read(child_fd, buf, sizeof(buf));
if (sz < 0) {
if (errno != EAGAIN && errno != EINTR)
error_clnt("read error: %s\n", strerror(errno));
return;
return sz;
}
send_sideband(1, band, buf, sz, LARGE_PACKET_MAX);
return sz;
}
int cmd_upload_archive(int argc, const char **argv, const char *prefix)
@@ -131,6 +132,7 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
while (1) {
struct pollfd pfd[2];
ssize_t processed[2] = { 0, 0 };
int status;
pfd[0].fd = fd1[0];
@@ -147,12 +149,12 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
}
if (pfd[0].revents & POLLIN)
/* Data stream ready */
process_input(pfd[0].fd, 1);
processed[0] = process_input(pfd[0].fd, 1);
if (pfd[1].revents & POLLIN)
/* Status stream ready */
process_input(pfd[1].fd, 2);
processed[1] = process_input(pfd[1].fd, 2);
/* Always finish to read data when available */
if ((pfd[0].revents | pfd[1].revents) & POLLIN)
if (processed[0] || processed[1])
continue;
if (waitpid(writer, &status, 0) < 0)

View File

@@ -13,7 +13,7 @@ static const char write_tree_usage[] =
int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
{
int missing_ok = 0, ret;
int flags = 0, ret;
const char *prefix = NULL;
unsigned char sha1[20];
const char *me = "git-write-tree";
@@ -22,9 +22,15 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--missing-ok"))
missing_ok = 1;
flags |= WRITE_TREE_MISSING_OK;
else if (!prefixcmp(arg, "--prefix="))
prefix = arg + 9;
else if (!prefixcmp(arg, "--ignore-cache-tree"))
/*
* This is only useful for debugging, so I
* do not bother documenting it.
*/
flags |= WRITE_TREE_IGNORE_CACHE_TREE;
else
usage(write_tree_usage);
argc--; argv++;
@@ -33,7 +39,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
if (argc > 2)
die("too many options");
ret = write_cache_as_tree(sha1, missing_ok, prefix);
ret = write_cache_as_tree(sha1, flags, prefix);
switch (ret) {
case 0:
printf("%s\n", sha1_to_hex(sha1));

View File

@@ -514,6 +514,8 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size)
static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *path)
{
if (!it)
return NULL;
while (*path) {
const char *slash;
struct cache_tree_sub *sub;
@@ -538,28 +540,32 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
return it;
}
int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix)
int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix)
{
int entries, was_valid, newfd;
struct lock_file *lock_file;
/*
* We can't free this memory, it becomes part of a linked list
* parsed atexit()
*/
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
lock_file = xcalloc(1, sizeof(struct lock_file));
newfd = hold_locked_index(lock_file, 1);
entries = read_cache();
if (entries < 0)
return WRITE_TREE_UNREADABLE_INDEX;
if (flags & WRITE_TREE_IGNORE_CACHE_TREE)
cache_tree_free(&(active_cache_tree));
if (!active_cache_tree)
active_cache_tree = cache_tree();
was_valid = cache_tree_fully_valid(active_cache_tree);
if (!was_valid) {
int missing_ok = flags & WRITE_TREE_MISSING_OK;
if (cache_tree_update(active_cache_tree,
active_cache, active_nr,
missing_ok, 0) < 0)
@@ -625,3 +631,35 @@ void prime_cache_tree(struct cache_tree **it, struct tree *tree)
*it = cache_tree();
prime_cache_tree_rec(*it, tree);
}
/*
* find the cache_tree that corresponds to the current level without
* exploding the full path into textual form. The root of the
* cache tree is given as "root", and our current level is "info".
* (1) When at root level, info->prev is NULL, so it is "root" itself.
* (2) Otherwise, find the cache_tree that corresponds to one level
* above us, and find ourselves in there.
*/
static struct cache_tree *find_cache_tree_from_traversal(struct cache_tree *root,
struct traverse_info *info)
{
struct cache_tree *our_parent;
if (!info->prev)
return root;
our_parent = find_cache_tree_from_traversal(root, info->prev);
return cache_tree_find(our_parent, info->name.path);
}
int cache_tree_matches_traversal(struct cache_tree *root,
struct name_entry *ent,
struct traverse_info *info)
{
struct cache_tree *it;
it = find_cache_tree_from_traversal(root, info);
it = cache_tree_find(it, ent->path);
if (it && it->entry_count > 0 && !hashcmp(ent->sha1, it->sha1))
return it->entry_count;
return 0;
}

View File

@@ -2,6 +2,7 @@
#define CACHE_TREE_H
#include "tree.h"
#include "tree-walk.h"
struct cache_tree;
struct cache_tree_sub {
@@ -30,11 +31,18 @@ struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
int cache_tree_fully_valid(struct cache_tree *);
int cache_tree_update(struct cache_tree *, struct cache_entry **, int, int, int);
/* bitmasks to write_cache_as_tree flags */
#define WRITE_TREE_MISSING_OK 1
#define WRITE_TREE_IGNORE_CACHE_TREE 2
/* error return codes */
#define WRITE_TREE_UNREADABLE_INDEX (-1)
#define WRITE_TREE_UNMERGED_INDEX (-2)
#define WRITE_TREE_PREFIX_ERROR (-3)
int write_cache_as_tree(unsigned char *sha1, int missing_ok, const char *prefix);
int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
void prime_cache_tree(struct cache_tree **, struct tree *);
extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
#endif

View File

@@ -385,6 +385,8 @@ AC_SUBST(NO_EXPAT)
# some Solaris installations).
# Define NO_ICONV if neither libc nor libiconv support iconv.
if test -z "$NO_ICONV"; then
GIT_STASH_FLAGS($ICONVDIR)
AC_DEFUN([ICONVTEST_SRC], [
@@ -431,6 +433,12 @@ GIT_UNSTASH_FLAGS($ICONVDIR)
AC_SUBST(NEEDS_LIBICONV)
AC_SUBST(NO_ICONV)
if test -n "$NO_ICONV"; then
NEEDS_LIBICONV=
fi
fi
#
# Define NO_DEFLATE_BOUND if deflateBound is missing from zlib.

View File

@@ -464,7 +464,7 @@ static void git_proxy_connect(int fd[2], char *host)
#define MAX_CMD_LEN 1024
char *get_port(char *host)
static char *get_port(char *host)
{
char *end;
char *p = strchr(host, ':');

View File

@@ -1299,7 +1299,7 @@ _git_rebase ()
}
__git_send_email_confirm_options="always never auto cc compose"
__git_send_email_suppresscc_options="author self cc ccbody sob cccmd body all"
__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all"
_git_send_email ()
{

View File

@@ -82,10 +82,16 @@ foreach my $tar_file (@ARGV)
$mtime = oct $mtime;
next if $typeflag == 5; # directory
print FI "blob\n", "mark :$next_mark\n", "data $size\n";
while ($size > 0 && read(I, $_, 512) == 512) {
print FI substr($_, 0, $size);
$size -= 512;
print FI "blob\n", "mark :$next_mark\n";
if ($typeflag == 2) { # symbolic link
print FI "data ", length($linkname), "\n", $linkname;
$mode = 0120000;
} else {
print FI "data $size\n";
while ($size > 0 && read(I, $_, 512) == 512) {
print FI substr($_, 0, $size);
$size -= 512;
}
}
print FI "\n";
@@ -118,7 +124,8 @@ EOF
{
my ($mark, $mode) = @{$files{$path}};
$path =~ s,^([^/]+)/,, if $have_top_dir;
printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path;
$mode = $mode & 0111 ? 0755 : 0644 unless $mode == 0120000;
printf FI "M %o :%i %s\n", $mode, $mark, $path;
}
print FI "\n";

View File

@@ -453,7 +453,7 @@ static void parse_host_arg(char *extra_args, int buflen)
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
gai = getaddrinfo(hostname, 0, &hints, &ai);
gai = getaddrinfo(hostname, NULL, &hints, &ai);
if (!gai) {
struct sockaddr_in *sin_addr = (void *)ai->ai_addr;

View File

@@ -90,12 +90,11 @@ static inline unsigned long get_delta_hdr_size(const unsigned char **datap,
const unsigned char *top)
{
const unsigned char *data = *datap;
unsigned char cmd;
unsigned long size = 0;
unsigned long cmd, size = 0;
int i = 0;
do {
cmd = *data++;
size |= (cmd & ~0x80) << i;
size |= (cmd & 0x7f) << i;
i += 7;
} while (cmd & 0x80 && data < top);
*datap = data;

View File

@@ -446,6 +446,8 @@ int run_diff_index(struct rev_info *revs, int cached)
memset(&opts, 0, sizeof(opts));
opts.head_idx = 1;
opts.index_only = cached;
opts.diff_index_cached = (cached &&
!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER));
opts.merge = 1;
opts.fn = oneway_diff;
opts.unpack_data = revs;
@@ -502,6 +504,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
memset(&opts, 0, sizeof(opts));
opts.head_idx = 1;
opts.index_only = 1;
opts.diff_index_cached = !DIFF_OPT_TST(opt, FIND_COPIES_HARDER);
opts.merge = 1;
opts.fn = oneway_diff;
opts.unpack_data = &revs;

View File

@@ -8,9 +8,9 @@ use File::Basename qw(basename dirname);
use File::Spec;
use Git;
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W);
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w, $opt_W, $opt_k);
getopts('uhPpvcfam:d:w:W');
getopts('uhPpvcfkam:d:w:W');
$opt_h && usage();
@@ -287,7 +287,26 @@ foreach my $f (@files) {
$dirty = 1;
warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
}
# Depending on how your GIT tree got imported from CVS you may
# have a conflict between expanded keywords in your CVS tree and
# unexpanded keywords in the patch about to be applied.
if ($opt_k) {
my $orig_file ="$f.orig";
rename $f, $orig_file;
open(FILTER_IN, "<$orig_file") or die "Cannot open $orig_file\n";
open(FILTER_OUT, ">$f") or die "Cannot open $f\n";
while (<FILTER_IN>)
{
my $line = $_;
$line =~ s/\$([A-Z][a-z]+):[^\$]+\$/\$\1\$/g;
print FILTER_OUT $line;
}
close FILTER_IN;
close FILTER_OUT;
}
}
if ($dirty) {
if ($opt_f) { warn "The tree is not clean -- forced merge\n";
$dirty = 0;
@@ -391,7 +410,7 @@ sleep(1);
sub usage {
print STDERR <<END;
Usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
Usage: GIT_DIR=/path/to/.git git cvsexportcommit [-h] [-p] [-v] [-c] [-f] [-u] [-k] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
END
exit(1);
}

View File

@@ -60,205 +60,36 @@ get_default_remote () {
echo ${origin:-origin}
}
get_remote_default_refs_for_push () {
data_source=$(get_data_source "$1")
case "$data_source" in
'' | branches | self)
;; # no default push mapping, just send matching refs.
config)
git config --get-all "remote.$1.push" ;;
remotes)
sed -ne '/^Push: */{
s///p
}' "$GIT_DIR/remotes/$1" ;;
*)
die "internal error: get-remote-default-ref-for-push $1" ;;
esac
}
# Called from canon_refs_list_for_fetch -d "$remote", which
# is called from get_remote_default_refs_for_fetch to grok
# refspecs that are retrieved from the configuration, but not
# from get_remote_refs_for_fetch when it deals with refspecs
# supplied on the command line. $ls_remote_result has the list
# of refs available at remote.
#
# The first token returned is either "explicit" or "glob"; this
# is to help prevent randomly "globbed" ref from being chosen as
# a merge candidate
expand_refs_wildcard () {
echo "$ls_remote_result" |
git fetch--tool expand-refs-wildcard "-" "$@"
}
# Subroutine to canonicalize remote:local notation.
canon_refs_list_for_fetch () {
# If called from get_remote_default_refs_for_fetch
# leave the branches in branch.${curr_branch}.merge alone,
# or the first one otherwise; add prefix . to the rest
# to prevent the secondary branches to be merged by default.
merge_branches=
curr_branch=
if test "$1" = "-d"
then
shift ; remote="$1" ; shift
set $(expand_refs_wildcard "$remote" "$@")
is_explicit="$1"
shift
if test "$remote" = "$(get_default_remote)"
then
curr_branch=$(git symbolic-ref -q HEAD | \
sed -e 's|^refs/heads/||')
merge_branches=$(git config \
--get-all "branch.${curr_branch}.merge")
fi
if test -z "$merge_branches" && test $is_explicit != explicit
then
merge_branches=..this.will.never.match.any.ref..
fi
fi
for ref
do
force=
case "$ref" in
+*)
ref=$(expr "z$ref" : 'z+\(.*\)')
force=+
;;
esac
expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:"
remote=$(expr "z$ref" : 'z\([^:]*\):')
local=$(expr "z$ref" : 'z[^:]*:\(.*\)')
dot_prefix=.
if test -z "$merge_branches"
then
merge_branches=$remote
dot_prefix=
else
for merge_branch in $merge_branches
do
[ "$remote" = "$merge_branch" ] &&
dot_prefix= && break
done
fi
case "$remote" in
'' | HEAD ) remote=HEAD ;;
refs/*) ;;
heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
*) remote="refs/heads/$remote" ;;
esac
case "$local" in
'') local= ;;
refs/*) ;;
heads/* | tags/* | remotes/* ) local="refs/$local" ;;
*) local="refs/heads/$local" ;;
esac
if local_ref_name=$(expr "z$local" : 'zrefs/\(.*\)')
then
git check-ref-format "$local_ref_name" ||
die "* refusing to create funny ref '$local_ref_name' locally"
fi
echo "${dot_prefix}${force}${remote}:${local}"
done
}
# Returns list of src: (no store), or src:dst (store)
get_remote_default_refs_for_fetch () {
data_source=$(get_data_source "$1")
case "$data_source" in
'')
echo "HEAD:" ;;
self)
canon_refs_list_for_fetch -d "$1" \
$(git for-each-ref --format='%(refname):')
;;
config)
canon_refs_list_for_fetch -d "$1" \
$(git config --get-all "remote.$1.fetch") ;;
branches)
remote_branch=$(sed -ne '/#/s/.*#//p' "$GIT_DIR/branches/$1")
case "$remote_branch" in '') remote_branch=master ;; esac
echo "refs/heads/${remote_branch}:refs/heads/$1"
;;
remotes)
canon_refs_list_for_fetch -d "$1" $(sed -ne '/^Pull: */{
s///p
}' "$GIT_DIR/remotes/$1")
;;
*)
die "internal error: get-remote-default-ref-for-fetch $1" ;;
esac
}
get_remote_refs_for_push () {
get_remote_merge_branch () {
case "$#" in
0) die "internal error: get-remote-refs-for-push." ;;
1) get_remote_default_refs_for_push "$@" ;;
*) shift; echo "$@" ;;
esac
}
get_remote_refs_for_fetch () {
case "$#" in
0)
die "internal error: get-remote-refs-for-fetch." ;;
1)
get_remote_default_refs_for_fetch "$@" ;;
*)
shift
tag_just_seen=
for ref
do
if test "$tag_just_seen"
then
echo "refs/tags/${ref}:refs/tags/${ref}"
tag_just_seen=
continue
else
case "$ref" in
tag)
tag_just_seen=yes
continue
;;
esac
fi
canon_refs_list_for_fetch "$ref"
done
0|1)
origin="$1"
default=$(get_default_remote)
test -z "$origin" && origin=$default
curr_branch=$(git symbolic-ref -q HEAD)
[ "$origin" = "$default" ] &&
echo $(git for-each-ref --format='%(upstream)' $curr_branch)
;;
esac
}
resolve_alternates () {
# original URL (xxx.git)
top_=`expr "z$1" : 'z\([^:]*:/*[^/]*\)/'`
while read path
do
case "$path" in
\#* | '')
continue ;;
/*)
echo "$top_$path/" ;;
../*)
# relative -- ugly but seems to work.
echo "$1/objects/$path/" ;;
*)
# exit code may not be caught by the reader.
echo "bad alternate: $path"
exit 1 ;;
esac
done
}
get_uploadpack () {
data_source=$(get_data_source "$1")
case "$data_source" in
config)
uplp=$(git config --get "remote.$1.uploadpack")
echo ${uplp:-git-upload-pack}
;;
*)
echo "git-upload-pack"
repo=$1
shift
ref=$1
# FIXME: It should return the tracking branch
# Currently only works with the default mapping
case "$ref" in
+*)
ref=$(expr "z$ref" : 'z+\(.*\)')
;;
esac
expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:"
remote=$(expr "z$ref" : 'z\([^:]*\):')
case "$remote" in
'' | HEAD ) remote=HEAD ;;
heads/*) remote=${remote#heads/} ;;
refs/heads/*) remote=${remote#refs/heads/} ;;
refs/* | tags/* | remotes/* ) remote=
esac
[ -n "$remote" ] && echo "refs/remotes/$repo/$remote"
esac
}

View File

@@ -125,12 +125,9 @@ test true = "$rebase" && {
die "refusing to pull with rebase: your working tree is not up-to-date"
. git-parse-remote &&
origin="$1"
test -z "$origin" && origin=$(get_default_remote)
reflist="$(get_remote_refs_for_fetch "$@" 2>/dev/null |
sed "s|refs/heads/\(.*\):|\1|")" &&
reflist="$(get_remote_merge_branch "$@" 2>/dev/null)" &&
oldremoteref="$(git rev-parse -q --verify \
"refs/remotes/$origin/$reflist")"
"$reflist")"
}
orig_head=$(git rev-parse -q --verify HEAD)
git fetch $verbosity --update-head-ok "$@" || exit 1
@@ -176,13 +173,11 @@ case "$merge_head" in
?*' '?*)
if test -z "$orig_head"
then
echo >&2 "Cannot merge multiple branches into empty head"
exit 1
die "Cannot merge multiple branches into empty head"
fi
if test true = "$rebase"
then
echo >&2 "Cannot rebase onto multiple branches"
exit 1
die "Cannot rebase onto multiple branches"
fi
;;
esac

View File

@@ -168,10 +168,8 @@ run_pre_rebase_hook () {
if test -z "$OK_TO_SKIP_PRE_REBASE" &&
test -x "$GIT_DIR/hooks/pre-rebase"
then
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || {
echo >&2 "The pre-rebase hook refused to rebase."
exit 1
}
"$GIT_DIR/hooks/pre-rebase" ${1+"$@"} ||
die "The pre-rebase hook refused to rebase."
fi
}
@@ -359,8 +357,7 @@ fi
# The tree must be really really clean.
if ! git update-index --ignore-submodules --refresh; then
echo >&2 "cannot rebase: you have unstaged changes"
exit 1
die "cannot rebase: you have unstaged changes"
fi
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
case "$diff" in

View File

@@ -334,7 +334,7 @@ if (@suppress_cc) {
}
if ($suppress_cc{'all'}) {
foreach my $entry (qw (ccmd cc author self sob body bodycc)) {
foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
$suppress_cc{$entry} = 1;
}
delete $suppress_cc{'all'};
@@ -1104,7 +1104,7 @@ foreach my $t (@files) {
close F;
if (defined $cc_cmd && !$suppress_cc{'cccmd'}) {
open(F, "$cc_cmd $t |")
open(F, "$cc_cmd \Q$t\E |")
or die "(cc-cmd) Could not execute '$cc_cmd'";
while(<F>) {
my $c = $_;

View File

@@ -5,7 +5,7 @@
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch]|summary [-n|--summary-limit <n>] [<commit>]] \
[add [-b branch] <repo> <path>]|[status|init|update [-i|--init] [-N|--no-fetch] [--rebase|--merge]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
OPTIONS_SPEC=
. git-sh-setup
@@ -356,6 +356,10 @@ cmd_update()
reference="$1"
shift
;;
-m|--merge)
shift
update="merge"
;;
--)
shift
break
@@ -426,6 +430,11 @@ cmd_update()
action="rebase"
msg="rebased onto"
;;
merge)
command="git merge"
action="merge"
msg="merged in"
;;
*)
command="git checkout $force -q"
action="checkout"

View File

@@ -187,7 +187,8 @@ proc parseviewargs {n arglist} {
"--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" -
"--author=*" - "--committer=*" - "--grep=*" - "-[iE]" -
"--remove-empty" - "--first-parent" - "--cherry-pick" -
"-S*" - "--pickaxe-all" - "--pickaxe-regex" {
"-S*" - "--pickaxe-all" - "--pickaxe-regex" -
"--simplify-by-decoration" {
# These mean that we get a subset of the commits
set filtered 1
lappend glflags $arg
@@ -2145,7 +2146,7 @@ proc makewindow {} {
label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
-from 1 -increment 1 -to 10000000 \
-from 0 -increment 1 -to 10000000 \
-validate all -validatecommand "diffcontextvalidate %P" \
-textvariable diffcontextstring
.bleft.mid.diffcontext set $diffcontext
@@ -3672,17 +3673,36 @@ proc newview {ishighlight} {
}
set known_view_options {
{perm b . {} {mc "Remember this view"}}
{args t50= + {} {mc "Commits to include (arguments to git log):"}}
{all b * "--all" {mc "Use all refs"}}
{dorder b . {"--date-order" "-d"} {mc "Strictly sort by date"}}
{lright b . "--left-right" {mc "Mark branch sides"}}
{since t15 + {"--since=*" "--after=*"} {mc "Since date:"}}
{until t15 . {"--until=*" "--before=*"} {mc "Until date:"}}
{limit t10 + "--max-count=*" {mc "Max count:"}}
{skip t10 . "--skip=*" {mc "Skip:"}}
{first b . "--first-parent" {mc "Limit to first parent"}}
{cmd t50= + {} {mc "Command to generate more commits to include:"}}
{perm b . {} {mc "Remember this view"}}
{reflabel l + {} {mc "References (space separated list):"}}
{refs t15 .. {} {mc "Branches & tags:"}}
{allrefs b *. "--all" {mc "All refs"}}
{branches b . "--branches" {mc "All (local) branches"}}
{tags b . "--tags" {mc "All tags"}}
{remotes b . "--remotes" {mc "All remote-tracking branches"}}
{commitlbl l + {} {mc "Commit Info (regular expressions):"}}
{author t15 .. "--author=*" {mc "Author:"}}
{committer t15 . "--committer=*" {mc "Committer:"}}
{loginfo t15 .. "--grep=*" {mc "Commit Message:"}}
{allmatch b .. "--all-match" {mc "Matches all Commit Info criteria"}}
{changes_l l + {} {mc "Changes to Files:"}}
{pickaxe_s r0 . {} {mc "Fixed String"}}
{pickaxe_t r1 . "--pickaxe-regex" {mc "Regular Expression"}}
{pickaxe t15 .. "-S*" {mc "Search string:"}}
{datelabel l + {} {mc "Commit Dates (\"2 weeks ago\", \"2009-03-17 15:27:38\", \"March 17, 2009 15:27:38\"):"}}
{since t15 .. {"--since=*" "--after=*"} {mc "Since:"}}
{until t15 . {"--until=*" "--before=*"} {mc "Until:"}}
{limit_lbl l + {} {mc "Limit and/or skip a number of revisions (positive integer):"}}
{limit t10 *. "--max-count=*" {mc "Number to show:"}}
{skip t10 . "--skip=*" {mc "Number to skip:"}}
{misc_lbl l + {} {mc "Miscellaneous options:"}}
{dorder b *. {"--date-order" "-d"} {mc "Strictly sort by date"}}
{lright b . "--left-right" {mc "Mark branch sides"}}
{first b . "--first-parent" {mc "Limit to first parent"}}
{smplhst b . "--simplify-by-decoration" {mc "Simple history"}}
{args t50 *. {} {mc "Additional arguments to git log:"}}
{allpaths path + {} {mc "Enter files and directories to include, one per line:"}}
{cmd t50= + {} {mc "Command to generate more commits to include:"}}
}
proc encode_view_opts {n} {
@@ -3694,13 +3714,19 @@ proc encode_view_opts {n} {
if {$patterns eq {}} continue
set pattern [lindex $patterns 0]
set val $newviewopts($n,[lindex $opt 0])
if {[lindex $opt 1] eq "b"} {
set val $newviewopts($n,[lindex $opt 0])
if {$val} {
lappend rargs $pattern
}
} elseif {[regexp {^r(\d+)$} [lindex $opt 1] type value]} {
regexp {^(.*_)} [lindex $opt 0] uselessvar button_id
set val $newviewopts($n,$button_id)
if {$val eq $value} {
lappend rargs $pattern
}
} else {
set val $newviewopts($n,[lindex $opt 0])
set val [string trim $val]
if {$val ne {}} {
set pfix [string range $pattern 0 end-1]
@@ -3708,6 +3734,7 @@ proc encode_view_opts {n} {
}
}
}
set rargs [concat $rargs [shellsplit $newviewopts($n,refs)]]
return [concat $rargs [shellsplit $newviewopts($n,args)]]
}
@@ -3715,14 +3742,22 @@ proc decode_view_opts {n view_args} {
global known_view_options newviewopts
foreach opt $known_view_options {
set id [lindex $opt 0]
if {[lindex $opt 1] eq "b"} {
# Checkboxes
set val 0
} elseif {[regexp {^r(\d+)$} [lindex $opt 1]]} {
# Radiobuttons
regexp {^(.*_)} $id uselessvar id
set val 0
} else {
# Text fields
set val {}
}
set newviewopts($n,[lindex $opt 0]) $val
set newviewopts($n,$id) $val
}
set oargs [list]
set refargs [list]
foreach arg $view_args {
if {[regexp -- {^-([0-9]+)$} $arg arg cnt]
&& ![info exists found(limit)]} {
@@ -3736,11 +3771,17 @@ proc decode_view_opts {n view_args} {
if {[info exists found($id)]} continue
foreach pattern [lindex $opt 3] {
if {![string match $pattern $arg]} continue
if {[lindex $opt 1] ne "b"} {
if {[lindex $opt 1] eq "b"} {
# Check buttons
set val 1
} elseif {[regexp {^r(\d+)$} [lindex $opt 1] match num]} {
# Radio buttons
regexp {^(.*_)} $id uselessvar id
set val $num
} else {
# Text input fields
set size [string length $pattern]
set val [string range $arg [expr {$size-1}] end]
} else {
set val 1
}
set newviewopts($n,$id) $val
set found($id) 1
@@ -3749,8 +3790,13 @@ proc decode_view_opts {n view_args} {
if {[info exists val]} break
}
if {[info exists val]} continue
lappend oargs $arg
if {[regexp {^-} $arg]} {
lappend oargs $arg
} else {
lappend refargs $arg
}
}
set newviewopts($n,refs) [shellarglist $refargs]
set newviewopts($n,args) [shellarglist $oargs]
}
@@ -3786,16 +3832,16 @@ proc vieweditor {top n title} {
global known_view_options
toplevel $top
wm title $top $title
wm title $top [concat $title [mc "-- criteria for selecting revisions"]]
make_transient $top .
# View name
frame $top.nfr
label $top.nl -text [mc "Name"]
label $top.nl -text [mc "View Name:"]
entry $top.name -width 20 -textvariable newviewname($n)
pack $top.nfr -in $top -fill x -pady 5 -padx 3
pack $top.nl -in $top.nfr -side left -padx {0 30}
pack $top.name -in $top.nfr -side left
pack $top.nl -in $top.nfr -side left -padx {0 5}
pack $top.name -in $top.nfr -side left -padx {0 25}
# View options
set cframe $top.nfr
@@ -3814,14 +3860,28 @@ proc vieweditor {top n title} {
frame $cframe
pack $cframe -in $top -fill x -pady 3 -padx 3
set cexpand [expr {$flags eq "*"}]
} elseif {$flags eq ".." || $flags eq "*."} {
set cframe $top.fr$cnt
incr cnt
frame $cframe
pack $cframe -in $top -fill x -pady 3 -padx [list 15 3]
set cexpand [expr {$flags eq "*."}]
} else {
set lxpad 5
}
if {$type eq "b"} {
if {$type eq "l"} {
label $cframe.l_$id -text $title
pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w
} elseif {$type eq "b"} {
checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)
pack $cframe.c_$id -in $cframe -side left \
-padx [list $lxpad 0] -expand $cexpand -anchor w
} elseif {[regexp {^r(\d+)$} $type type sz]} {
regexp {^(.*_)} $id uselessvar button_id
radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz
pack $cframe.c_$id -in $cframe -side left \
-padx [list $lxpad 0] -expand $cexpand -anchor w
} elseif {[regexp {^t(\d+)$} $type type sz]} {
message $cframe.l_$id -aspect 1500 -text $title
entry $cframe.e_$id -width $sz -background $bgcolor \
@@ -3834,23 +3894,22 @@ proc vieweditor {top n title} {
-textvariable newviewopts($n,$id)
pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w
pack $cframe.e_$id -in $cframe -side top -fill x
} elseif {$type eq "path"} {
message $top.l -aspect 1500 -text $title
pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3
text $top.t -width 40 -height 5 -background $bgcolor -font uifont
if {[info exists viewfiles($n)]} {
foreach f $viewfiles($n) {
$top.t insert end $f
$top.t insert end "\n"
}
$top.t delete {end - 1c} end
$top.t mark set insert 0.0
}
pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3
}
}
# Path list
message $top.l -aspect 1500 \
-text [mc "Enter files and directories to include, one per line:"]
pack $top.l -in $top -side top -pady [list 7 0] -anchor w -padx 3
text $top.t -width 40 -height 5 -background $bgcolor -font uifont
if {[info exists viewfiles($n)]} {
foreach f $viewfiles($n) {
$top.t insert end $f
$top.t insert end "\n"
}
$top.t delete {end - 1c} end
$top.t mark set insert 0.0
}
pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3
frame $top.buts
button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1]
@@ -7250,7 +7309,7 @@ proc diffcontextchange {n1 n2 op} {
global diffcontextstring diffcontext
if {[string is integer -strict $diffcontextstring]} {
if {$diffcontextstring > 0} {
if {$diffcontextstring >= 0} {
set diffcontext $diffcontextstring
reselectline
}
@@ -7268,8 +7327,13 @@ proc getblobdiffs {ids} {
global ignorespace
global limitdiffs vfilelimit curview
global diffencoding targetline diffnparents
global git_version
set cmd [diffcmd $ids "-p -C --cc --no-commit-id -U$diffcontext"]
set textconv {}
if {[package vcompare $git_version "1.6.1"] >= 0} {
set textconv "--textconv"
}
set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"]
if {$ignorespace} {
append cmd " -w"
}
@@ -11091,6 +11155,7 @@ set nullid2 "0000000000000000000000000000000000000001"
set nullfile "/dev/null"
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
set runq {}
set history {}

File diff suppressed because it is too large Load Diff

View File

@@ -1750,7 +1750,7 @@ static int delete_remote_branch(char *pattern, int force)
return 0;
}
void run_request_queue(void)
static void run_request_queue(void)
{
#ifdef USE_CURL_MULTI
is_running_queue = 1;

8
http.c
View File

@@ -20,7 +20,7 @@ char curl_errorstr[CURL_ERROR_SIZE];
static int curl_ssl_verify = -1;
static const char *ssl_cert;
#if LIBCURL_VERSION_NUM >= 0x070902
#if LIBCURL_VERSION_NUM >= 0x070903
static const char *ssl_key;
#endif
#if LIBCURL_VERSION_NUM >= 0x070908
@@ -126,7 +126,7 @@ static int http_options(const char *var, const char *value, void *cb)
}
if (!strcmp("http.sslcert", var))
return git_config_string(&ssl_cert, var, value);
#if LIBCURL_VERSION_NUM >= 0x070902
#if LIBCURL_VERSION_NUM >= 0x070903
if (!strcmp("http.sslkey", var))
return git_config_string(&ssl_key, var, value);
#endif
@@ -196,7 +196,7 @@ static CURL *get_curl_handle(void)
if (ssl_cert != NULL)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
#if LIBCURL_VERSION_NUM >= 0x070902
#if LIBCURL_VERSION_NUM >= 0x070903
if (ssl_key != NULL)
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
#endif
@@ -313,7 +313,7 @@ void http_init(struct remote *remote)
curl_ssl_verify = 0;
set_from_env(&ssl_cert, "GIT_SSL_CERT");
#if LIBCURL_VERSION_NUM >= 0x070902
#if LIBCURL_VERSION_NUM >= 0x070903
set_from_env(&ssl_key, "GIT_SSL_KEY");
#endif
#if LIBCURL_VERSION_NUM >= 0x070908

View File

@@ -238,7 +238,7 @@ static const char *Flags[] = {
#ifndef NO_OPENSSL
static void ssl_socket_perror(const char *func)
{
fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), 0));
fprintf(stderr, "%s: %s\n", func, ERR_error_string(ERR_get_error(), NULL));
}
#endif

View File

@@ -293,8 +293,8 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size)
static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_base)
{
unsigned char *p, c;
unsigned long size;
unsigned char *p;
unsigned long size, c;
off_t base_offset;
unsigned shift;
void *data;
@@ -312,7 +312,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_
p = fill(1);
c = *p;
use(1);
size += (c & 0x7fUL) << shift;
size += (c & 0x7f) << shift;
shift += 7;
}
obj->size = size;
@@ -469,7 +469,7 @@ static void sha1_object(const void *data, unsigned long size,
die("invalid %s", typename(type));
if (fsck_object(obj, 1, fsck_error_function))
die("Error in object");
if (fsck_walk(obj, mark_link, 0))
if (fsck_walk(obj, mark_link, NULL))
die("Not all child objects of %s are reachable", sha1_to_hex(obj->sha1));
if (obj->type == OBJ_TREE) {

View File

@@ -231,7 +231,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "merge.default")) {
if (value)
default_ll_merge = strdup(value);
default_ll_merge = xstrdup(value);
return 0;
}
@@ -265,7 +265,7 @@ static int read_merge_config(const char *var, const char *value, void *cb)
if (!strcmp("name", ep)) {
if (!value)
return error("%s: lacks value", var);
fn->description = strdup(value);
fn->description = xstrdup(value);
return 0;
}
@@ -288,14 +288,14 @@ static int read_merge_config(const char *var, const char *value, void *cb)
* file named by %A, and signal that it has done with zero exit
* status.
*/
fn->cmdline = strdup(value);
fn->cmdline = xstrdup(value);
return 0;
}
if (!strcmp("recursive", ep)) {
if (!value)
return error("%s: lacks value", var);
fn->recursive = strdup(value);
fn->recursive = xstrdup(value);
return 0;
}

View File

@@ -103,7 +103,7 @@ static char *parse_name_and_email(char *buffer, char **name,
char **email, int allow_empty_email)
{
char *left, *right, *nstart, *nend;
*name = *email = 0;
*name = *email = NULL;
if ((left = strchr(buffer, '<')) == NULL)
return NULL;
@@ -136,7 +136,7 @@ static int read_single_mailmap(struct string_list *map, const char *filename, ch
if (f == NULL)
return 1;
while (fgets(buffer, sizeof(buffer), f) != NULL) {
char *name1 = 0, *email1 = 0, *name2 = 0, *email2 = 0;
char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL;
if (buffer[0] == '#') {
static const char abbrev[] = "# repo-abbrev:";
int abblen = sizeof(abbrev) - 1;
@@ -200,7 +200,7 @@ int map_user(struct string_list *map,
if (!p) {
/* email passed in might not be wrapped in <>, but end with a \0 */
p = memchr(email, '\0', maxlen_email);
if (p == 0)
if (!p)
return 0;
}
if (p - email + 1 < sizeof(buf))

View File

@@ -38,7 +38,7 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two)
* A virtual commit has (const char *)commit->util set to the name.
*/
struct commit *make_virtual_commit(struct tree *tree, const char *comment)
static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
{
struct commit *commit = xcalloc(1, sizeof(struct commit));
commit->tree = tree;

View File

@@ -464,7 +464,7 @@ int parse_options(int argc, const char **argv, const char *prefix,
static int usage_argh(const struct option *opts)
{
const char *s;
int literal = opts->flags & PARSE_OPT_LITERAL_ARGHELP;
int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) || !opts->argh;
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
s = literal ? "[=%s]" : "[=<%s>]";
@@ -472,13 +472,13 @@ static int usage_argh(const struct option *opts)
s = literal ? "[%s]" : "[<%s>]";
else
s = literal ? " %s" : " <%s>";
return fprintf(stderr, s, opts->argh);
return fprintf(stderr, s, opts->argh ? opts->argh : "...");
}
#define USAGE_OPTS_WIDTH 24
#define USAGE_GAP 2
int usage_with_options_internal(const char * const *usagestr,
static int usage_with_options_internal(const char * const *usagestr,
const struct option *opts, int full)
{
if (!usagestr)
@@ -524,40 +524,8 @@ int usage_with_options_internal(const char * const *usagestr,
if (opts->type == OPTION_NUMBER)
pos += fprintf(stderr, "-NUM");
switch (opts->type) {
case OPTION_ARGUMENT:
break;
case OPTION_INTEGER:
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
pos += fprintf(stderr, "[=<n>]");
else
pos += fprintf(stderr, "[<n>]");
else
pos += fprintf(stderr, " <n>");
break;
case OPTION_CALLBACK:
if (opts->flags & PARSE_OPT_NOARG)
break;
/* FALLTHROUGH */
case OPTION_FILENAME:
/* FALLTHROUGH */
case OPTION_STRING:
if (opts->argh)
pos += usage_argh(opts);
else {
if (opts->flags & PARSE_OPT_OPTARG)
if (opts->long_name)
pos += fprintf(stderr, "[=...]");
else
pos += fprintf(stderr, "[...]");
else
pos += fprintf(stderr, " ...");
}
break;
default: /* OPTION_{BIT,BOOLEAN,NUMBER,SET_INT,SET_PTR} */
break;
}
if (!(opts->flags & PARSE_OPT_NOARG))
pos += usage_argh(opts);
if (pos <= USAGE_OPTS_WIDTH)
pad = USAGE_OPTS_WIDTH - pos;

View File

@@ -67,7 +67,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 optional (not for BOOLEANs)
* PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
* PARSE_OPT_NOARG: says that this option takes no argument
* PARSE_OPT_NONEG: says that this option cannot be negated
* PARSE_OPT_HIDDEN: this option is skipped in the default usage, and
* shown only in the full usage.
@@ -104,14 +104,20 @@ struct option {
};
#define OPT_END() { OPTION_END }
#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) }
#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, \
(h), PARSE_OPT_NOARG}
#define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
#define OPT_BIT(s, l, v, h, b) { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
#define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, (h), 0, NULL, (b) }
#define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
#define OPT_BIT(s, l, v, h, b) { OPTION_BIT, (s), (l), (v), NULL, (h), \
PARSE_OPT_NOARG, NULL, (b) }
#define OPT_NEGBIT(s, l, v, h, b) { OPTION_NEGBIT, (s), (l), (v), NULL, \
(h), PARSE_OPT_NOARG, NULL, (b) }
#define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, \
(h), PARSE_OPT_NOARG }
#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, \
(h), PARSE_OPT_NOARG, NULL, (i) }
#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, \
(h), PARSE_OPT_NOARG, NULL, (p) }
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) }
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
#define OPT_DATE(s, l, v, h) \
{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \

View File

@@ -44,7 +44,7 @@ void *patch_delta(const void *src_buf, unsigned long src_size,
if (cmd & 0x01) cp_off = *data++;
if (cmd & 0x02) cp_off |= (*data++ << 8);
if (cmd & 0x04) cp_off |= (*data++ << 16);
if (cmd & 0x08) cp_off |= (*data++ << 24);
if (cmd & 0x08) cp_off |= ((unsigned) *data++ << 24);
if (cmd & 0x10) cp_size = *data++;
if (cmd & 0x20) cp_size |= (*data++ << 8);
if (cmd & 0x40) cp_size |= (*data++ << 16);

View File

@@ -272,8 +272,8 @@ void write_name_quoted(const char *name, FILE *fp, int terminator)
fputc(terminator, fp);
}
extern void write_name_quotedpfx(const char *pfx, size_t pfxlen,
const char *name, FILE *fp, int terminator)
void write_name_quotedpfx(const char *pfx, size_t pfxlen,
const char *name, FILE *fp, int terminator)
{
int needquote = 0;

View File

@@ -106,6 +106,12 @@ static void add_url_alias(struct remote *remote, const char *url)
add_url(remote, alias_url(url));
}
static void add_pushurl(struct remote *remote, const char *pushurl)
{
ALLOC_GROW(remote->pushurl, remote->pushurl_nr + 1, remote->pushurl_alloc);
remote->pushurl[remote->pushurl_nr++] = pushurl;
}
static struct remote *make_remote(const char *name, int len)
{
struct remote *ret;
@@ -301,7 +307,7 @@ static void read_branches_file(struct remote *remote)
strbuf_addstr(&branch, "HEAD:");
}
add_url_alias(remote, p);
add_fetch_refspec(remote, strbuf_detach(&branch, 0));
add_fetch_refspec(remote, strbuf_detach(&branch, NULL));
/*
* Cogito compatible push: push current HEAD to remote #branch
* (master if missing)
@@ -312,7 +318,7 @@ static void read_branches_file(struct remote *remote)
strbuf_addf(&branch, ":refs/heads/%s", frag);
else
strbuf_addstr(&branch, ":refs/heads/master");
add_push_refspec(remote, strbuf_detach(&branch, 0));
add_push_refspec(remote, strbuf_detach(&branch, NULL));
remote->fetch_tags = 1; /* always auto-follow */
}
@@ -379,6 +385,11 @@ static int handle_config(const char *key, const char *value, void *cb)
if (git_config_string(&v, key, value))
return -1;
add_url(remote, v);
} else if (!strcmp(subkey, ".pushurl")) {
const char *v;
if (git_config_string(&v, key, value))
return -1;
add_pushurl(remote, v);
} else if (!strcmp(subkey, ".push")) {
const char *v;
if (git_config_string(&v, key, value))
@@ -424,6 +435,9 @@ static void alias_all_urls(void)
for (j = 0; j < remotes[i]->url_nr; j++) {
remotes[i]->url[j] = alias_url(remotes[i]->url[j]);
}
for (j = 0; j < remotes[i]->pushurl_nr; j++) {
remotes[i]->pushurl[j] = alias_url(remotes[i]->pushurl[j]);
}
}
}
@@ -1105,7 +1119,7 @@ int match_refs(struct ref *src, struct ref **dst,
int send_all = flags & MATCH_REFS_ALL;
int send_mirror = flags & MATCH_REFS_MIRROR;
int errs;
static const char *default_refspec[] = { ":", 0 };
static const char *default_refspec[] = { ":", NULL };
struct ref **dst_tail = tail_ref(dst);
if (!nr_refspec) {

View File

@@ -15,6 +15,10 @@ struct remote {
int url_nr;
int url_alloc;
const char **pushurl;
int pushurl_nr;
int pushurl_alloc;
const char **push_refspec;
struct refspec *push;
int push_refspec_nr;

View File

@@ -1162,8 +1162,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf,
unsigned long len, enum object_type *type, unsigned long *sizep)
{
unsigned shift;
unsigned char c;
unsigned long size;
unsigned long size, c;
unsigned long used = 0;
c = buf[used++];

View File

@@ -17,11 +17,11 @@ test_expect_success setup '
'
test_expect_code 1 'cherry-pick an empty commit' '
git checkout master &&
git cherry-pick empty-branch
test_expect_success 'cherry-pick an empty commit' '
git checkout master && {
git cherry-pick empty-branch
test "$?" = 1
}
'
test_expect_success 'index lockfile was removed' '

View File

@@ -221,6 +221,19 @@ test_expect_success POSIXPERM 'git add (add.ignore-errors = false)' '
test_must_fail git add --verbose . &&
! ( git ls-files foo1 | grep foo1 )
'
rm -f foo2
test_expect_success POSIXPERM '--no-ignore-errors overrides config' '
git config add.ignore-errors 1 &&
git reset --hard &&
date >foo1 &&
date >foo2 &&
chmod 0 foo2 &&
test_must_fail git add --verbose --no-ignore-errors . &&
! ( git ls-files foo1 | grep foo1 ) &&
git config add.ignore-errors 0
'
rm -f foo2
test_expect_success BSLASHPSPEC "git add 'fo\\[ou\\]bar' ignores foobar" '
git reset --hard &&

View File

@@ -9,32 +9,36 @@ test_description='Rename interaction with pathspec.
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
test_expect_success \
'prepare reference tree' \
'mkdir path0 path1 &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git update-index --add path0/COPYING &&
tree=$(git write-tree) &&
echo $tree'
test_expect_success 'prepare reference tree' '
mkdir path0 path1 &&
cp "$TEST_DIRECTORY"/../COPYING path0/COPYING &&
git update-index --add path0/COPYING &&
tree=$(git write-tree) &&
echo $tree
'
test_expect_success \
'prepare work tree' \
'cp path0/COPYING path1/COPYING &&
git update-index --add --remove path0/COPYING path1/COPYING'
test_expect_success 'prepare work tree' '
cp path0/COPYING path1/COPYING &&
git update-index --add --remove path0/COPYING path1/COPYING
'
# In the tree, there is only path0/COPYING. In the cache, path0 and
# path1 both have COPYING and the latter is a copy of path0/COPYING.
# Comparing the full tree with cache should tell us so.
git diff-index -C --find-copies-harder $tree >current
cat >expected <<\EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING
EOF
test_expect_success \
'validate the result (#1)' \
'compare_diff_raw current expected'
test_expect_success 'copy detection' '
git diff-index -C --find-copies-harder $tree >current &&
compare_diff_raw current expected
'
test_expect_success 'copy detection, cached' '
git diff-index -C --find-copies-harder --cached $tree >current &&
compare_diff_raw current expected
'
# In the tree, there is only path0/COPYING. In the cache, path0 and
# path1 both have COPYING and the latter is a copy of path0/COPYING.
@@ -42,49 +46,45 @@ test_expect_success \
# path1/COPYING suddenly appearing from nowhere, not detected as
# a copy from path0/COPYING.
git diff-index -C $tree path1 >current
cat >expected <<\EOF
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
EOF
test_expect_success \
'validate the result (#2)' \
'compare_diff_raw current expected'
test_expect_success \
'tweak work tree' \
'rm -f path0/COPYING &&
git update-index --remove path0/COPYING'
test_expect_success 'copy, limited to a subtree' '
git diff-index -C --find-copies-harder $tree path1 >current &&
compare_diff_raw current expected
'
test_expect_success 'tweak work tree' '
rm -f path0/COPYING &&
git update-index --remove path0/COPYING
'
# In the tree, there is only path0/COPYING. In the cache, path0 does
# not have COPYING anymore and path1 has COPYING which is a copy of
# path0/COPYING. Showing the full tree with cache should tell us about
# the rename.
git diff-index -C $tree >current
cat >expected <<\EOF
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING
EOF
test_expect_success \
'validate the result (#3)' \
'compare_diff_raw current expected'
test_expect_success 'rename detection' '
git diff-index -C --find-copies-harder $tree >current &&
compare_diff_raw current expected
'
# In the tree, there is only path0/COPYING. In the cache, path0 does
# not have COPYING anymore and path1 has COPYING which is a copy of
# path0/COPYING. When we say we care only about path1, we should just
# see path1/COPYING appearing from nowhere.
git diff-index -C $tree path1 >current
cat >expected <<\EOF
:000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING
EOF
test_expect_success \
'validate the result (#4)' \
'compare_diff_raw current expected'
test_expect_success 'rename, limited to a subtree' '
git diff-index -C --find-copies-harder $tree path1 >current &&
compare_diff_raw current expected
'
test_done

View File

@@ -135,7 +135,8 @@ EOF
cat > test/expect << EOF
* remote origin
URL: $(pwd)/one
Fetch URL: $(pwd)/one
Push URL: $(pwd)/one
HEAD branch: master
Remote branches:
master new (next fetch will store in remotes/origin)
@@ -151,7 +152,8 @@ cat > test/expect << EOF
master pushes to master (local out of date)
master pushes to upstream (create)
* remote two
URL: ../two
Fetch URL: ../two
Push URL: ../three
HEAD branch (remote HEAD is ambiguous, may be one of the following):
another
master
@@ -173,6 +175,7 @@ test_expect_success 'show' '
git branch --track rebase origin/master &&
git branch -d -r origin/master &&
git config --add remote.two.url ../two &&
git config --add remote.two.pushurl ../three &&
git config branch.rebase.rebase true &&
git config branch.octopus.merge "topic-a topic-b topic-c" &&
(cd ../one &&
@@ -191,7 +194,8 @@ test_expect_success 'show' '
cat > test/expect << EOF
* remote origin
URL: $(pwd)/one
Fetch URL: $(pwd)/one
Push URL: $(pwd)/one
HEAD branch: (not queried)
Remote branches: (status not queried)
master

View File

@@ -419,6 +419,19 @@ test_expect_success 'push with config remote.*.push = HEAD' '
git config --remove-section remote.there
git config --remove-section branch.master
test_expect_success 'push with config remote.*.pushurl' '
mk_test heads/master &&
git checkout master &&
git config remote.there.url test2repo &&
git config remote.there.pushurl testrepo &&
git push there &&
check_push_result $the_commit heads/master
'
# clean up the cruft left with the previous one
git config --remove-section remote.there
test_expect_success 'push with dry-run' '
mk_test heads/master &&

View File

@@ -92,20 +92,34 @@ test_expect_success '--rebase with rebased upstream' '
git remote add -f me . &&
git checkout copy &&
git tag copy-orig &&
git reset --hard HEAD^ &&
echo conflicting modification > file &&
git commit -m conflict file &&
git checkout to-rebase &&
echo file > file2 &&
git commit -m to-rebase file2 &&
git tag to-rebase-orig &&
git pull --rebase me copy &&
test "conflicting modification" = "$(cat file)" &&
test file = $(cat file2)
'
test_expect_success '--rebase with rebased default upstream' '
git update-ref refs/remotes/me/copy copy-orig &&
git checkout --track -b to-rebase2 me/copy &&
git reset --hard to-rebase-orig &&
git pull --rebase &&
test "conflicting modification" = "$(cat file)" &&
test file = $(cat file2)
'
test_expect_success 'pull --rebase dies early with dirty working directory' '
git checkout to-rebase &&
git update-ref refs/remotes/me/copy copy^ &&
COPY=$(git rev-parse --verify me/copy) &&
git rebase --onto $COPY copy &&

View File

@@ -6,7 +6,7 @@
test_description='Test updating submodules
This test verifies that "git submodule update" detaches the HEAD of the
submodule and "git submodule update --rebase" does not detach the HEAD.
submodule and "git submodule update --rebase/--merge" does not detach the HEAD.
'
. ./test-lib.sh
@@ -76,6 +76,20 @@ test_expect_success 'submodule update --rebase staying on master' '
)
'
test_expect_success 'submodule update --merge staying on master' '
(cd super/submodule &&
git reset --hard HEAD~1
) &&
(cd super &&
(cd submodule &&
compare_head
) &&
git submodule update --merge submodule &&
cd submodule &&
compare_head
)
'
test_expect_success 'submodule update - rebase in .git/config' '
(cd super &&
git config submodule.submodule.update rebase
@@ -110,6 +124,40 @@ test_expect_success 'submodule update - checkout in .git/config but --rebase giv
)
'
test_expect_success 'submodule update - merge in .git/config' '
(cd super &&
git config submodule.submodule.update merge
) &&
(cd super/submodule &&
git reset --hard HEAD~1
) &&
(cd super &&
(cd submodule &&
compare_head
) &&
git submodule update submodule &&
cd submodule &&
compare_head
)
'
test_expect_success 'submodule update - checkout in .git/config but --merge given' '
(cd super &&
git config submodule.submodule.update checkout
) &&
(cd super/submodule &&
git reset --hard HEAD~1
) &&
(cd super &&
(cd submodule &&
compare_head
) &&
git submodule update --merge submodule &&
cd submodule &&
compare_head
)
'
test_expect_success 'submodule update - checkout in .git/config' '
(cd super &&
git config submodule.submodule.update checkout
@@ -137,4 +185,14 @@ test_expect_success 'submodule init picks up rebase' '
)
'
test_expect_success 'submodule init picks up merge' '
(cd super &&
git config submodule.merging.url git://non-existing/git &&
git config submodule.merging.path does-not-matter &&
git config submodule.merging.update merge &&
git submodule init merging &&
test "merge" = $(git config submodule.merging.update)
)
'
test_done

View File

@@ -148,6 +148,22 @@ test_expect_success 'Prompting works' '
grep "^To: to@example.com$" msgtxt1
'
test_expect_success 'cccmd works' '
clean_fake_sendmail &&
cp $patches cccmd.patch &&
echo cccmd--cccmd@example.com >>cccmd.patch &&
echo sed -n s/^cccmd--//p \"\$1\" > cccmd-sed &&
chmod +x cccmd-sed &&
git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--cc-cmd=./cccmd-sed \
--smtp-server="$(pwd)/fake.sendmail" \
cccmd.patch \
&&
grep ^Cc:.*cccmd@example.com msgtxt1
'
z8=zzzzzzzz
z64=$z8$z8$z8$z8$z8$z8$z8$z8
z512=$z64$z64$z64$z64$z64$z64$z64$z64
@@ -274,7 +290,7 @@ EOF
test_suppression () {
git send-email \
--dry-run \
--suppress-cc=$1 \
--suppress-cc=$1 ${2+"--suppress-cc=$2"} \
--from="Example <from@example.com>" \
--to=to@example.com \
--smtp-server relay.example.com \
@@ -282,8 +298,8 @@ test_suppression () {
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
>actual-suppress-$1 &&
test_cmp expected-suppress-$1 actual-suppress-$1
>actual-suppress-$1${2+"-$2"} &&
test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
}
test_expect_success 'sendemail.cc set' '
@@ -316,6 +332,34 @@ test_expect_success 'sendemail.cc unset' '
test_suppression sob
'
cat >expected-suppress-cccmd <<\EOF
0001-Second.patch
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>
From: Example <from@example.com>
To: to@example.com
Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
Message-Id: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
Result: OK
EOF
test_expect_success 'sendemail.cccmd' '
echo echo cc-cmd@example.com > cccmd &&
chmod +x cccmd &&
git config sendemail.cccmd ./cccmd &&
test_suppression cccmd
'
cat >expected-suppress-all <<\EOF
0001-Second.patch
Dry-OK. Log says:
@@ -341,6 +385,31 @@ cat >expected-suppress-body <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<cc-cmd@example.com>
From: Example <from@example.com>
To: to@example.com
Cc: A <author@example.com>, One <one@example.com>, two@example.com, cc-cmd@example.com
Subject: [PATCH 1/1] Second.
Date: DATE-STRING
Message-Id: MESSAGE-ID-STRING
X-Mailer: X-MAILER-STRING
Result: OK
EOF
test_expect_success '--suppress-cc=body' '
test_suppression body
'
cat >expected-suppress-body-cccmd <<\EOF
0001-Second.patch
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@@ -356,8 +425,8 @@ X-Mailer: X-MAILER-STRING
Result: OK
EOF
test_expect_success '--suppress-cc=body' '
test_suppression body
test_expect_success '--suppress-cc=body --suppress-cc=cccmd' '
test_suppression body cccmd
'
cat >expected-suppress-sob <<\EOF
@@ -381,6 +450,7 @@ Result: OK
EOF
test_expect_success '--suppress-cc=sob' '
git config --unset sendemail.cccmd
test_suppression sob
'

View File

@@ -9,7 +9,7 @@ static int verbose = 0, dry_run = 0, quiet = 0;
static char *string = NULL;
static char *file = NULL;
int length_callback(const struct option *opt, const char *arg, int unset)
static int length_callback(const struct option *opt, const char *arg, int unset)
{
printf("Callback: \"%s\", %d\n",
(arg ? arg : "not set"), unset);
@@ -20,7 +20,7 @@ int length_callback(const struct option *opt, const char *arg, int unset)
return 0;
}
int number_callback(const struct option *opt, const char *arg, int unset)
static int number_callback(const struct option *opt, const char *arg, int unset)
{
*(int *)opt->value = strtol(arg, NULL, 10);
return 0;

View File

@@ -140,7 +140,7 @@ static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_option
return call_unpack_fn(src, o);
}
int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
{
int i;
struct tree_desc t[MAX_UNPACK_TREES];
@@ -326,6 +326,23 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
if (src[0])
conflicts |= 1;
}
/* special case: "diff-index --cached" looking at a tree */
if (o->diff_index_cached &&
n == 1 && dirmask == 1 && S_ISDIR(names->mode)) {
int matches;
matches = cache_tree_matches_traversal(o->src_index->cache_tree,
names, info);
/*
* Everything under the name matches. Adjust o->pos to
* skip the entire hierarchy.
*/
if (matches) {
o->pos += matches;
return mask;
}
}
if (traverse_trees_recursive(n, dirmask, conflicts,
names, info) < 0)
return -1;

View File

@@ -27,6 +27,7 @@ struct unpack_trees_options {
aggressive:1,
skip_unmerged:1,
initial_checkout:1,
diff_index_cached:1,
gently:1;
const char *prefix;
int pos;

View File

@@ -13,7 +13,8 @@ PATTERNS("html", "^[ \t]*(<[Hh][1-6][ \t].*>.*)$",
"[^<>= \t]+|[^[:space:]]|[\x80-\xff]+"),
PATTERNS("java",
"!^[ \t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\n"
"^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$",
"^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$",
/* -- */
"[a-zA-Z_][a-zA-Z0-9_]*"
"|[-+0-9.e]+[fFlL]?|0[xXbB]?[0-9a-fA-F]+[lL]?"
"|[-+*/<>%&^|=!]="
@@ -25,7 +26,7 @@ PATTERNS("objc",
/* Objective-C methods */
"^[ \t]*([-+][ \t]*\\([ \t]*[A-Za-z_][A-Za-z_0-9* \t]*\\)[ \t]*[A-Za-z_].*)$\n"
/* C functions */
"^[ \t]*(([ \t]*[A-Za-z_][A-Za-z_0-9]*){2,}[ \t]*\\([^;]*)$\n"
"^[ \t]*(([A-Za-z_][A-Za-z_0-9]*[ \t]+)+[A-Za-z_][A-Za-z_0-9]*[ \t]*\\([^;]*)$\n"
/* Objective-C class/protocol definitions */
"^(@(implementation|interface|protocol)[ \t].*)$",
/* -- */

12
ws.c
View File

@@ -10,11 +10,12 @@
static struct whitespace_rule {
const char *rule_name;
unsigned rule_bits;
unsigned loosens_error;
} whitespace_rule_names[] = {
{ "trailing-space", WS_TRAILING_SPACE },
{ "space-before-tab", WS_SPACE_BEFORE_TAB },
{ "indent-with-non-tab", WS_INDENT_WITH_NON_TAB },
{ "cr-at-eol", WS_CR_AT_EOL },
{ "trailing-space", WS_TRAILING_SPACE, 0 },
{ "space-before-tab", WS_SPACE_BEFORE_TAB, 0 },
{ "indent-with-non-tab", WS_INDENT_WITH_NON_TAB, 0 },
{ "cr-at-eol", WS_CR_AT_EOL, 1 },
};
unsigned parse_whitespace_rule(const char *string)
@@ -79,7 +80,8 @@ unsigned whitespace_rule(const char *pathname)
unsigned all_rule = 0;
int i;
for (i = 0; i < ARRAY_SIZE(whitespace_rule_names); i++)
all_rule |= whitespace_rule_names[i].rule_bits;
if (!whitespace_rule_names[i].loosens_error)
all_rule |= whitespace_rule_names[i].rule_bits;
return all_rule;
} else if (ATTR_FALSE(value)) {
/* false (-whitespace) */

View File

@@ -13,7 +13,7 @@
int wt_status_relative_paths = 1;
int wt_status_use_color = -1;
int wt_status_submodule_summary;
static int wt_status_submodule_summary;
static char wt_status_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* WT_STATUS_HEADER */
GIT_COLOR_GREEN, /* WT_STATUS_UPDATED */