summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xDocumentation/cmd-list.perl1
-rw-r--r--Documentation/config.txt5
-rw-r--r--Documentation/git-mergetool.txt46
-rw-r--r--Documentation/git-receive-pack.txt32
-rw-r--r--Documentation/git-send-email.txt23
-rw-r--r--Documentation/git-svn.txt8
-rw-r--r--Makefile5
-rw-r--r--builtin-bundle.c185
-rw-r--r--builtin-grep.c15
-rw-r--r--builtin-push.c2
-rw-r--r--builtin-revert.c13
-rw-r--r--builtin-shortlog.c5
-rw-r--r--fast-import.c8
-rwxr-xr-xgit-cvsserver.perl6
-rw-r--r--git-gui/.gitignore1
-rwxr-xr-xgit-gui/CREDITS-GEN71
-rw-r--r--git-gui/Makefile28
-rwxr-xr-xgit-gui/git-gui.sh76
-rwxr-xr-xgit-merge.sh7
-rwxr-xr-xgit-mergetool.sh352
-rwxr-xr-xgit-send-email.perl10
-rwxr-xr-xgit-svn.perl7
-rw-r--r--perl/Makefile2
-rw-r--r--receive-pack.c109
-rw-r--r--revision.c219
-rw-r--r--revision.h9
-rw-r--r--run-command.c116
-rw-r--r--run-command.h19
-rw-r--r--sha1_name.c12
-rwxr-xr-xt/t5401-update-hooks.sh30
-rwxr-xr-xt/t5510-fetch.sh38
-rwxr-xr-xt/t9300-fast-import.sh50
33 files changed, 1007 insertions, 504 deletions
diff --git a/.gitignore b/.gitignore
index 0eaba0a278..27797d1491 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,6 +75,7 @@ git-merge-ours
git-merge-recursive
git-merge-resolve
git-merge-stupid
+git-mergetool
git-mktag
git-mktree
git-name-rev
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index f61c77aa7c..b54382b2bf 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -124,6 +124,7 @@ git-merge-index plumbingmanipulators
git-merge mainporcelain
git-merge-one-file purehelpers
git-merge-tree ancillaryinterrogators
+git-mergetool ancillarymanipulators
git-mktag plumbingmanipulators
git-mktree plumbingmanipulators
git-mv mainporcelain
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5408dd67d3..aaae9ac305 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -453,6 +453,11 @@ merge.summary::
Whether to include summaries of merged commits in newly created
merge commit messages. False by default.
+merge.tool::
+ Controls which merge resolution program is used by
+ gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
+ "meld", "xxdiff", "emerge"
+
merge.verbosity::
Controls the amount of output shown by the recursive merge
strategy. Level 0 outputs nothing except a final error
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
new file mode 100644
index 0000000000..ae69a0eb83
--- /dev/null
+++ b/Documentation/git-mergetool.txt
@@ -0,0 +1,46 @@
+git-mergetool(1)
+================
+
+NAME
+----
+git-mergetool - Run merge conflict resolution tools to resolve merge conflicts
+
+SYNOPSIS
+--------
+'git-mergetool' [--tool=<tool>] [<file>]...
+
+DESCRIPTION
+-----------
+
+Use 'git mergetool' to run one of several merge utilities to resolve
+merge conflicts. It is typically run after gitlink:git-merge[1].
+
+If one or more <file> parameters are given, the merge tool program will
+be run to resolve differences on each file. If no <file> names are
+specified, 'git mergetool' will run the merge tool program on every file
+with merge conflicts.
+
+OPTIONS
+-------
+-t or --tool=<tool>::
+ Use the merge resolution program specified by <tool>.
+ Valid merge tools are:
+ kdiff3, tkdiff, meld, xxdiff, and emerge.
+
+ If a merge resolution program is not specified, 'git mergetool'
+ will use the configuration variable merge.tool. If the
+ configuration variable merge.tool is not set, 'git mergetool'
+ will pick a suitable default.
+
+Author
+------
+Written by Theodore Y Ts'o <tytso@mit.edu>
+
+Documentation
+--------------
+Documentation by Theodore Y Ts'o.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt
index 3cf55111cc..6914aa59c3 100644
--- a/Documentation/git-receive-pack.txt
+++ b/Documentation/git-receive-pack.txt
@@ -40,13 +40,13 @@ OPTIONS
pre-receive Hook
----------------
Before any ref is updated, if $GIT_DIR/hooks/pre-receive file exists
-and is executable, it will be invoked once, with three parameters
-per ref to be updated:
+and is executable, it will be invoked once with no parameters. The
+standard input of the hook will be one line per ref to be updated:
- $GIT_DIR/hooks/pre-receive (refname sha1-old sha1-new)+
+ sha1-old SP sha1-new SP refname LF
-The refname parameter is relative to $GIT_DIR; e.g. for the master
-head this is "refs/heads/master". The two sha1 arguments after
+The refname value is relative to $GIT_DIR; e.g. for the master
+head this is "refs/heads/master". The two sha1 values before
each refname are the object names for the refname before and after
the update. Refs to be created will have sha1-old equal to 0{40},
while refs to be deleted will have sha1-new equal to 0{40}, otherwise
@@ -86,13 +86,14 @@ post-receive Hook
-----------------
After all refs were updated (or attempted to be updated), if any
ref update was successful, and if $GIT_DIR/hooks/post-receive
-file exists and is executable, it will be invoke once with three
-parameters for each successfully updated ref:
+file exists and is executable, it will be invoke once with no
+parameters. The standard input of the hook will be one line
+for each successfully updated ref:
- $GIT_DIR/hooks/post-receive (refname sha1-old sha1-new)+
+ sha1-old SP sha1-new SP refname LF
-The refname parameter is relative to $GIT_DIR; e.g. for the master
-head this is "refs/heads/master". The two sha1 arguments after
+The refname value is relative to $GIT_DIR; e.g. for the master
+head this is "refs/heads/master". The two sha1 values before
each refname are the object names for the refname before and after
the update. Refs that were created will have sha1-old equal to
0{40}, while refs that were deleted will have sha1-new equal to
@@ -105,18 +106,17 @@ ref listing the commits pushed to the repository:
#!/bin/sh
# mail out commit update information.
- while test $# -gt 0
+ while read oval nval ref
do
- if expr "$2" : '0*$' >/dev/null
+ if expr "$oval" : '0*$' >/dev/null
then
echo "Created a new ref, with the following commits:"
- git-rev-list --pretty "$2"
+ git-rev-list --pretty "$nval"
else
echo "New commits:"
- git-rev-list --pretty "$3" "^$2"
+ git-rev-list --pretty "$nval" "^$oval"
fi |
- mail -s "Changes to ref $1" commit-list@mydomain
- shift; shift; shift; # discard this ref's args
+ mail -s "Changes to ref $ref" commit-list@mydomain
done
exit 0
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 35b0104e4a..9b3aabb6fe 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -40,7 +40,8 @@ The --cc option must be repeated for each user you want on the cc list.
the first will be sent as replies to the first email sent. When using
this, it is recommended that the first file given be an overview of the
entire patch series.
- Default is --chain-reply-to
+ Default is the value of the 'sendemail.chainreplyto' configuration
+ value; if that is unspecified, default to --chain-reply-to.
--compose::
Use $EDITOR to edit an introductory message for the
@@ -91,6 +92,26 @@ The --cc option must be repeated for each user you want on the cc list.
The --to option must be repeated for each user you want on the to list.
+CONFIGURATION
+-------------
+sendemail.aliasesfile::
+ To avoid typing long email addresses, point this to one or more
+ email aliases files. You must also supply 'sendemail.aliasfiletype'.
+
+sendemail.aliasfiletype::
+ Format of the file(s) specified in sendemail.aliasesfile. Must be
+ one of 'mutt', 'mailrc', 'pine', or 'gnus'.
+
+sendemail.bcc::
+ Email address (or alias) to always bcc.
+
+sendemail.chainreplyto::
+ Boolean value specifying the default to the '--chain_reply_to'
+ parameter.
+
+sendemail.smtpserver::
+ Default smtp server to use.
+
Author
------
Written by Ryan Anderson <ryan@michonline.com>
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 9b5a3d6196..a0d34e0058 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -104,6 +104,14 @@ accepts. However '--fetch-all' only fetches from the current
Like 'git-rebase'; this requires that the working tree be clean
and have no uncommitted changes.
++
+--
+-l;;
+--local;;
+ Do not fetch remotely; only run 'git-rebase' against the
+ last fetched commit from the upstream SVN.
+--
++
'dcommit'::
Commit each diff from a specified head directly to the SVN
diff --git a/Makefile b/Makefile
index 084b7fe177..45fe3663a5 100644
--- a/Makefile
+++ b/Makefile
@@ -179,7 +179,7 @@ SCRIPT_SH = \
git-clean.sh git-clone.sh git-commit.sh \
git-fetch.sh git-gc.sh \
git-ls-remote.sh \
- git-merge-one-file.sh git-parse-remote.sh \
+ git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
git-pull.sh git-rebase.sh \
git-repack.sh git-request-pull.sh git-reset.sh \
git-sh-setup.sh \
@@ -931,8 +931,7 @@ dist: git.spec git-archive
$(TAR) rf $(GIT_TARNAME).tar \
$(GIT_TARNAME)/git.spec \
$(GIT_TARNAME)/version \
- $(GIT_TARNAME)/git-gui/version \
- $(GIT_TARNAME)/git-gui/credits
+ $(GIT_TARNAME)/git-gui/version
@rm -rf $(GIT_TARNAME)
gzip -f -9 $(GIT_TARNAME).tar
diff --git a/builtin-bundle.c b/builtin-bundle.c
index 279b8f8e58..786808081b 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -160,7 +160,28 @@ static int fork_with_pipe(const char **argv, int *in, int *out)
return pid;
}
-static int verify_bundle(struct bundle_header *header)
+static int list_refs(struct ref_list *r, int argc, const char **argv)
+{
+ int i;
+
+ for (i = 0; i < r->nr; i++) {
+ if (argc > 1) {
+ int j;
+ for (j = 1; j < argc; j++)
+ if (!strcmp(r->list[i].name, argv[j]))
+ break;
+ if (j == argc)
+ continue;
+ }
+ printf("%s %s\n", sha1_to_hex(r->list[i].sha1),
+ r->list[i].name);
+ }
+ return 0;
+}
+
+#define PREREQ_MARK (1u<<16)
+
+static int verify_bundle(struct bundle_header *header, int verbose)
{
/*
* Do fast check, then if any prereqs are missing then go line by line
@@ -179,7 +200,7 @@ static int verify_bundle(struct bundle_header *header)
struct ref_list_entry *e = p->list + i;
struct object *o = parse_object(e->sha1);
if (o) {
- o->flags |= BOUNDARY_SHOW;
+ o->flags |= PREREQ_MARK;
add_pending_object(&revs, o, e->name);
continue;
}
@@ -187,7 +208,7 @@ static int verify_bundle(struct bundle_header *header)
error(message);
error("%s %s", sha1_to_hex(e->sha1), e->name);
}
- if (revs.pending.nr == 0)
+ if (revs.pending.nr != p->nr)
return ret;
req_nr = revs.pending.nr;
setup_revisions(2, argv, &revs, NULL);
@@ -202,7 +223,7 @@ static int verify_bundle(struct bundle_header *header)
i = req_nr;
while (i && (commit = get_revision(&revs)))
- if (commit->object.flags & BOUNDARY_SHOW)
+ if (commit->object.flags & PREREQ_MARK)
i--;
for (i = 0; i < req_nr; i++)
@@ -216,56 +237,24 @@ static int verify_bundle(struct bundle_header *header)
for (i = 0; i < refs.nr; i++)
clear_commit_marks((struct commit *)refs.objects[i].item, -1);
+ if (verbose) {
+ struct ref_list *r;
+
+ r = &header->references;
+ printf("The bundle contains %d ref%s\n",
+ r->nr, (1 < r->nr) ? "s" : "");
+ list_refs(r, 0, NULL);
+ r = &header->prerequisites;
+ printf("The bundle requires these %d ref%s\n",
+ r->nr, (1 < r->nr) ? "s" : "");
+ list_refs(r, 0, NULL);
+ }
return ret;
}
static int list_heads(struct bundle_header *header, int argc, const char **argv)
{
- int i;
- struct ref_list *r = &header->references;
-
- for (i = 0; i < r->nr; i++) {
- if (argc > 1) {
- int j;
- for (j = 1; j < argc; j++)
- if (!strcmp(r->list[i].name, argv[j]))
- break;
- if (j == argc)
- continue;
- }
- printf("%s %s\n", sha1_to_hex(r->list[i].sha1),
- r->list[i].name);
- }
- return 0;
-}
-
-static void show_commit(struct commit *commit)
-{
- write_or_die(1, sha1_to_hex(commit->object.sha1), 40);
- write_or_die(1, "\n", 1);
- if (commit->parents) {
- free_commit_list(commit->parents);
- commit->parents = NULL;
- }
-}
-
-static void show_object(struct object_array_entry *p)
-{
- /* An object with name "foo\n0000000..." can be used to
- * confuse downstream git-pack-objects very badly.
- */
- const char *ep = strchr(p->name, '\n');
- int len = ep ? ep - p->name : strlen(p->name);
- write_or_die(1, sha1_to_hex(p->item->sha1), 40);
- write_or_die(1, " ", 1);
- if (len)
- write_or_die(1, p->name, len);
- write_or_die(1, "\n", 1);
-}
-
-static void show_edge(struct commit *commit)
-{
- ; /* nothing to do */
+ return list_refs(&header->references, argc, argv);
}
static int create_bundle(struct bundle_header *header, const char *path,
@@ -273,19 +262,23 @@ static int create_bundle(struct bundle_header *header, const char *path,
{
int bundle_fd = -1;
const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));
- const char **argv_pack = xmalloc(4 * sizeof(const char *));
- int pid, in, out, i, status;
+ const char **argv_pack = xmalloc(5 * sizeof(const char *));
+ int pid, in, out, i, status, ref_count = 0;
char buffer[1024];
struct rev_info revs;
bundle_fd = (!strcmp(path, "-") ? 1 :
- open(path, O_CREAT | O_WRONLY, 0666));
+ open(path, O_CREAT | O_EXCL | O_WRONLY, 0666));
if (bundle_fd < 0)
- return error("Could not write to '%s'", path);
+ return error("Could not create '%s': %s", path, strerror(errno));
/* write signature */
write_or_die(bundle_fd, bundle_signature, strlen(bundle_signature));
+ /* init revs to list objects for pack-objects later */
+ save_commit_buffer = 0;
+ init_revisions(&revs, NULL);
+
/* write prerequisites */
memcpy(argv_boundary + 3, argv + 1, argc * sizeof(const char *));
argv_boundary[0] = "rev-list";
@@ -296,9 +289,20 @@ static int create_bundle(struct bundle_header *header, const char *path,
pid = fork_with_pipe(argv_boundary, NULL, &out);
if (pid < 0)
return -1;
- while ((i = read_string(out, buffer, sizeof(buffer))) > 0)
- if (buffer[0] == '-')
+ while ((i = read_string(out, buffer, sizeof(buffer))) > 0) {
+ unsigned char sha1[20];
+ if (buffer[0] == '-') {
write_or_die(bundle_fd, buffer, i);
+ if (!get_sha1_hex(buffer + 1, sha1)) {
+ struct object *object = parse_object(sha1);
+ object->flags |= UNINTERESTING;
+ add_pending_object(&revs, object, buffer);
+ }
+ } else if (!get_sha1_hex(buffer, sha1)) {
+ struct object *object = parse_object(sha1);
+ object->flags |= SHOWN;
+ }
+ }
while ((i = waitpid(pid, &status, 0)) < 0)
if (errno != EINTR)
return error("rev-list died");
@@ -306,28 +310,38 @@ static int create_bundle(struct bundle_header *header, const char *path,
return error("rev-list died %d", WEXITSTATUS(status));
/* write references */
- save_commit_buffer = 0;
- init_revisions(&revs, NULL);
- revs.tag_objects = 1;
- revs.tree_objects = 1;
- revs.blob_objects = 1;
argc = setup_revisions(argc, argv, &revs, NULL);
if (argc > 1)
return error("unrecognized argument: %s'", argv[1]);
+
for (i = 0; i < revs.pending.nr; i++) {
struct object_array_entry *e = revs.pending.objects + i;
- if (!(e->item->flags & UNINTERESTING)) {
- unsigned char sha1[20];
- char *ref;
- if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
- continue;
- write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40);
- write_or_die(bundle_fd, " ", 1);
- write_or_die(bundle_fd, ref, strlen(ref));
- write_or_die(bundle_fd, "\n", 1);
- free(ref);
+ unsigned char sha1[20];
+ char *ref;
+
+ if (e->item->flags & UNINTERESTING)
+ continue;
+ if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
+ continue;
+ /*
+ * Make sure the refs we wrote out is correct; --max-count and
+ * other limiting options could have prevented all the tips
+ * from getting output.
+ */
+ if (!(e->item->flags & SHOWN)) {
+ warn("ref '%s' is excluded by the rev-list options",
+ e->name);
+ continue;
}
+ ref_count++;
+ write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40);
+ write_or_die(bundle_fd, " ", 1);
+ write_or_die(bundle_fd, ref, strlen(ref));
+ write_or_die(bundle_fd, "\n", 1);
+ free(ref);
}
+ if (!ref_count)
+ die ("Refusing to create empty bundle.");
/* end header */
write_or_die(bundle_fd, "\n", 1);
@@ -336,36 +350,42 @@ static int create_bundle(struct bundle_header *header, const char *path,
argv_pack[0] = "pack-objects";
argv_pack[1] = "--all-progress";
argv_pack[2] = "--stdout";
- argv_pack[3] = NULL;
+ argv_pack[3] = "--thin";
+ argv_pack[4] = NULL;
in = -1;
out = bundle_fd;
pid = fork_with_pipe(argv_pack, &in, &out);
if (pid < 0)
return error("Could not spawn pack-objects");
- close(1);
- dup2(in, 1);
+ for (i = 0; i < revs.pending.nr; i++) {
+ struct object *object = revs.pending.objects[i].item;
+ if (object->flags & UNINTERESTING)
+ write(in, "^", 1);
+ write(in, sha1_to_hex(object->sha1), 40);
+ write(in, "\n", 1);
+ }
close(in);
- prepare_revision_walk(&revs);
- mark_edges_uninteresting(revs.commits, &revs, show_edge);
- traverse_commit_list(&revs, show_commit, show_object);
- close(1);
while (waitpid(pid, &status, 0) < 0)
if (errno != EINTR)
return -1;
if (!WIFEXITED(status) || WEXITSTATUS(status))
return error ("pack-objects died");
- return 0;
+
+ return status;
}
static int unbundle(struct bundle_header *header, int bundle_fd,
int argc, const char **argv)
{
- const char *argv_index_pack[] = {"index-pack", "--stdin", NULL};
+ const char *argv_index_pack[] = {"index-pack",
+ "--fix-thin", "--stdin", NULL};
int pid, status, dev_null;
- if (verify_bundle(header))
+ if (verify_bundle(header, 0))
return -1;
dev_null = open("/dev/null", O_WRONLY);
+ if (dev_null < 0)
+ return error("Could not open /dev/null");
pid = fork_with_pipe(argv_index_pack, &bundle_fd, &dev_null);
if (pid < 0)
return error("Could not spawn index-pack");
@@ -402,12 +422,12 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
memset(&header, 0, sizeof(header));
if (strcmp(cmd, "create") &&
- !(bundle_fd = read_header(bundle_file, &header)))
+ (bundle_fd = read_header(bundle_file, &header)) < 0)
return 1;
if (!strcmp(cmd, "verify")) {
close(bundle_fd);
- if (verify_bundle(&header))
+ if (verify_bundle(&header, 1))
return 1;
fprintf(stderr, "%s is okay\n", bundle_file);
return 0;
@@ -427,4 +447,3 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
} else
usage(bundle_usage);
}
-
diff --git a/builtin-grep.c b/builtin-grep.c
index 694da5ba09..4510d35324 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -431,6 +431,19 @@ static const char emsg_missing_context_len[] =
static const char emsg_missing_argument[] =
"option requires an argument -%s";
+static int strtoul_ui(char const *s, unsigned int *result)
+{
+ unsigned long ul;
+ char *p;
+
+ errno = 0;
+ ul = strtoul(s, &p, 10);
+ if (errno || *p || p == s || (unsigned int) ul != ul)
+ return -1;
+ *result = ul;
+ return 0;
+}
+
int cmd_grep(int argc, const char **argv, const char *prefix)
{
int hit = 0;
@@ -553,7 +566,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
scan = arg + 1;
break;
}
- if (sscanf(scan, "%u", &num) != 1)
+ if (strtoul_ui(scan, &num))
die(emsg_invalid_context_len, scan);
switch (arg[1]) {
case 'A':
diff --git a/builtin-push.c b/builtin-push.c
index 979efcc45f..6ab9a28e8c 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -336,7 +336,7 @@ static int do_push(const char *repo)
argv[dest_argc] = NULL;
if (verbose)
fprintf(stderr, "Pushing to %s\n", dest);
- err = run_command_v(argv);
+ err = run_command_v_opt(argv, 0);
if (!err)
continue;
switch (err) {
diff --git a/builtin-revert.c b/builtin-revert.c
index 2f2dc1bbaa..652eece5ad 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -207,6 +207,7 @@ static int merge_recursive(const char *base_sha1,
const char *next_sha1, const char *next_name)
{
char buffer[256];
+ const char *argv[6];
sprintf(buffer, "GITHEAD_%s", head_sha1);
setenv(buffer, head_name, 1);
@@ -219,10 +220,14 @@ static int merge_recursive(const char *base_sha1,
* and $prev on top of us (when reverting), or the change between
* $prev and $commit on top of us (when cherry-picking or replaying).
*/
-
- return run_command_opt(RUN_COMMAND_NO_STDIN | RUN_GIT_CMD,
- "merge-recursive", base_sha1, "--",
- head_sha1, next_sha1, NULL);
+ argv[0] = "merge-recursive";
+ argv[1] = base_sha1;
+ argv[2] = "--";
+ argv[3] = head_sha1;
+ argv[4] = next_sha1;
+ argv[5] = NULL;
+
+ return run_command_v_opt(argv, RUN_COMMAND_NO_STDIN | RUN_GIT_CMD);
}
static int revert_or_cherry_pick(int argc, const char **argv)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 2d7726e8b9..29343aefc8 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -304,8 +304,11 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
if (!access(".mailmap", R_OK))
read_mailmap(".mailmap");
- if (rev.pending.nr == 0)
+ if (rev.pending.nr == 0) {
+ if (isatty(0))
+ fprintf(stderr, "(reading log to summarize from standard input)\n");
read_from_stdin(&list);
+ }
else
get_from_rev(&rev, &list);
diff --git a/fast-import.c b/fast-import.c
index 726f5ba7d2..55ffae4fa6 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1058,7 +1058,7 @@ static void load_tree(struct tree_entry *root)
struct tree_entry *e = new_tree_entry();
if (t->entry_count == t->entry_capacity)
- root->tree = t = grow_tree_content(t, 8);
+ root->tree = t = grow_tree_content(t, t->entry_count);
t->entries[t->entry_count++] = e;
e->tree = NULL;
@@ -1066,7 +1066,7 @@ static void load_tree(struct tree_entry *root)
if (!c)
die("Corrupt mode in %s", sha1_to_hex(sha1));
e->versions[0].mode = e->versions[1].mode;
- e->name = to_atom(c, (unsigned short)strlen(c));
+ e->name = to_atom(c, strlen(c));
c += e->name->str_len + 1;
hashcpy(e->versions[0].sha1, (unsigned char*)c);
hashcpy(e->versions[1].sha1, (unsigned char*)c);
@@ -1225,9 +1225,9 @@ static int tree_content_set(
}
if (t->entry_count == t->entry_capacity)
- root->tree = t = grow_tree_content(t, 8);
+ root->tree = t = grow_tree_content(t, t->entry_count);
e = new_tree_entry();
- e->name = to_atom(p, (unsigned short)n);
+ e->name = to_atom(p, n);
e->versions[0].mode = 0;
hashclr(e->versions[0].sha1);
t->entries[t->entry_count++] = e;
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 1bf892e4c1..65fcc84049 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -957,12 +957,12 @@ sub req_update
{
$log->info("Merged successfully");
print "M M $filename\n";
- $log->debug("Update-existing $dirpart");
+ $log->debug("Merged $dirpart");
# Don't want to actually _DO_ the update if -n specified
unless ( $state->{globaloptions}{-n} )
{
- print "Update-existing $dirpart\n";
+ print "Merged $dirpart\n";
$log->debug($state->{CVSROOT} . "/$state->{module}/$filename");
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
my $kopts = kopts_from_path($filepart);
@@ -978,7 +978,7 @@ sub req_update
# Don't want to actually _DO_ the update if -n specified
unless ( $state->{globaloptions}{-n} )
{
- print "Update-existing $dirpart\n";
+ print "Merged $dirpart\n";
print $state->{CVSROOT} . "/$state->{module}/$filename\n";
my $kopts = kopts_from_path($filepart);
print "/$filepart/1.$meta->{revision}/+/$kopts/\n";
diff --git a/git-gui/.gitignore b/git-gui/.gitignore
index 805ca2e1c7..c714d382e8 100644
--- a/git-gui/.gitignore
+++ b/git-gui/.gitignore
@@ -1,4 +1,3 @@
-CREDITS-FILE
GIT-VERSION-FILE
git-citool
git-gui
diff --git a/git-gui/CREDITS-GEN b/git-gui/CREDITS-GEN
deleted file mode 100755
index d1b0f86355..0000000000
--- a/git-gui/CREDITS-GEN
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-CF=CREDITS-FILE
-tip=
-
-tree_search ()
-{
- head=$1
- tree=$2
- for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
- do
- test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
- vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
- case "$vn" in
- gitgui-[0-9]*) echo $p; break;;
- esac
- done
-}
-
-generate_credits ()
-{
- tip=$1 &&
- rm -f "$2" &&
- git shortlog -n -s $tip | sed 's/: .*$//' >"$2" || exit
-}
-
-# Always use the tarball credits file if found, just
-# in case we are somehow contained in a larger git
-# repository that doesn't actually track our state.
-# (At least one package manager is doing this.)
-#
-# We may be a subproject, so try looking for the merge
-# commit that supplied this directory content if we are
-# not at the toplevel. We probably will always be the
-# second parent in the commit, but we shouldn't rely on
-# that fact.
-#
-
-credits_tmp=/var/tmp/gitgui-credits-$$
-trap 'rm -f "$credits_tmp"' 0
-
-orig="$credits_tmp"
-
-if test -f credits
-then
- orig=credits
-elif prefix="$(git rev-parse --show-prefix 2>/dev/null)" &&
- test -n "$prefix" &&
- head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
- tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
- tip=$(tree_search $head $tree) &&
- test -n "$tip"
-then
- generate_credits $tip "$orig" || exit
-elif tip="$(git rev-parse --verify HEAD 2>/dev/null)" &&
- test -n "$tip"
-then
- generate_credits $tip "$orig" || exit
-else
- echo "error: Cannot locate authorship information." >&2
- exit 1
-fi
-
-if test -f "$orig" && cmp -s "$orig" "$CF"
-then
- : noop
-else
- rm -f "$CF" &&
- cat "$orig" >"$CF"
-fi
-
diff --git a/git-gui/Makefile b/git-gui/Makefile
index e486e8f984..b82789ead6 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -7,8 +7,9 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
-include GIT-VERSION-FILE
+SCRIPT_SH = git-gui.sh
GITGUI_BUILT_INS = git-citool
-ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
+ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
ifndef SHELL_PATH
SHELL_PATH = /bin/sh
@@ -27,28 +28,29 @@ ifndef V
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
endif
+ifeq ($(findstring $(MAKEFLAGS),s),s)
+QUIET_GEN =
+QUIET_BUILT_IN =
+endif
+
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
-git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
+$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)rm -f $@ $@+ && \
- sed -n \
- -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
+ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
- -e '1,/^set gitgui_credits /p' \
$@.sh >$@+ && \
- cat CREDITS-FILE >>$@+ && \
- sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+ && \
chmod +x $@+ && \
mv $@+ $@
-CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
- $(QUIET_GEN)$(SHELL_PATH) ./CREDITS-GEN
-
$(GITGUI_BUILT_INS): git-gui
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
+# These can record GITGUI_VERSION
+$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
+
all:: $(ALL_PROGRAMS)
install: all
@@ -56,14 +58,12 @@ install: all
$(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
$(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
-dist-version: CREDITS-FILE
+dist-version:
@mkdir -p $(TARDIR)
@echo $(GITGUI_VERSION) > $(TARDIR)/version
- @cat CREDITS-FILE > $(TARDIR)/credits
clean::
- rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
+ rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
.PHONY: all install dist-version clean
.PHONY: .FORCE-GIT-VERSION-FILE
-.PHONY: .FORCE-CREDITS-FILE
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 1981827a8e..60e79ca1b0 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -19,9 +19,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
-set gitgui_credits {
-Paul Mackerras
-}
######################################################################
##
@@ -302,6 +299,11 @@ proc ask_popup {msg} {
##
## version check
+if {{--version} eq $argv || {version} eq $argv} {
+ puts "git-gui version $appvers"
+ exit
+}
+
set req_maj 1
set req_min 5
@@ -1171,7 +1173,7 @@ File [short_path $path] cannot be committed by this program.
}
}
}
- if {!$files_ready} {
+ if {!$files_ready && ![string match *merge $curType]} {
info_popup {No changes to commit.
You must add at least 1 file before you can commit.
@@ -4492,61 +4494,6 @@ proc do_commit {} {
commit_tree
}
-proc do_credits {} {
- global gitgui_credits
-
- set w .credits_dialog
-
- toplevel $w
- wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
-
- label $w.header -text {git-gui Contributors} -font font_uibold
- pack $w.header -side top -fill x
-
- frame $w.buttons
- button $w.buttons.close -text {Close} \
- -font font_ui \
- -command [list destroy $w]
- pack $w.buttons.close -side right
- pack $w.buttons -side bottom -fill x -pady 10 -padx 10
-
- frame $w.credits
- text $w.credits.t \
- -background [$w.header cget -background] \
- -yscrollcommand [list $w.credits.sby set] \
- -width 20 \
- -height 10 \
- -wrap none \
- -borderwidth 1 \
- -relief solid \
- -padx 5 -pady 5 \
- -font font_ui
- scrollbar $w.credits.sby -command [list $w.credits.t yview]
- pack $w.credits.sby -side right -fill y
- pack $w.credits.t -fill both -expand 1
- pack $w.credits -side top -fill both -expand 1 -padx 5 -pady 5
-
- label $w.desc \
- -text "All portions are copyrighted by their respective authors
-and are distributed under the GNU General Public License." \
- -padx 5 -pady 5 \
- -justify left \
- -anchor w \
- -borderwidth 1 \
- -relief solid \
- -font font_ui
- pack $w.desc -side top -fill x -padx 5 -pady 5
-
- $w.credits.t insert end "[string trim $gitgui_credits]\n"
- $w.credits.t conf -state disabled
- $w.credits.t see 1.0
-
- bind $w <Visibility> "grab $w; focus $w"
- bind $w <Key-Escape> [list destroy $w]
- wm title $w [$w.header cget -text]
- tkwait window $w
-}
-
proc do_about {} {
global appvers copyright
global tcl_patchLevel tk_patchLevel
@@ -4563,10 +4510,6 @@ proc do_about {} {
button $w.buttons.close -text {Close} \
-font font_ui \
-command [list destroy $w]
- button $w.buttons.credits -text {Contributors} \
- -font font_ui \
- -command do_credits
- pack $w.buttons.credits -side left
pack $w.buttons.close -side right
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -5116,8 +5059,6 @@ enable_option branch
enable_option transport
switch -- $subcommand {
---version -
-version -
browser -
blame {
disable_option multicommit
@@ -5488,11 +5429,6 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
# -- Not a normal commit type invocation? Do that instead!
#
switch -- $subcommand {
---version -
-version {
- puts "git-gui version $appvers"
- exit
-}
browser {
if {[llength $argv] != 1} {
puts stderr "usage: $argv0 browser commit"
diff --git a/git-merge.sh b/git-merge.sh
index 4afcd95316..6ce62c860a 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -294,7 +294,12 @@ f,*)
git-update-index --refresh 2>/dev/null
new_head=$(git-rev-parse --verify "$1^0") &&
git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
- finish "$new_head" "Fast forward" || exit
+ msg="Fast forward"
+ if test -n "$have_message"
+ then
+ msg="$msg (no commit created; -m option ignored)"
+ fi
+ finish "$new_head" "$msg" || exit
dropsave
exit 0
;;
diff --git a/git-mergetool.sh b/git-mergetool.sh
new file mode 100755
index 0000000000..52386a5443
--- /dev/null
+++ b/git-mergetool.sh
@@ -0,0 +1,352 @@
+#!/bin/sh
+#
+# This program resolves merge conflicts in git
+#
+# Copyright (c) 2006 Theodore Y. Ts'o
+#
+# This file is licensed under the GPL v2, or a later version
+# at the discretion of Junio C Hammano.
+#
+
+USAGE='[--tool=tool] [file to merge] ...'
+SUBDIRECTORY_OK=Yes
+. git-sh-setup
+require_work_tree
+
+# Returns true if the mode reflects a symlink
+function is_symlink () {
+ test "$1" = 120000
+}
+
+function local_present () {
+ test -n "$local_mode"
+}
+
+function remote_present () {
+ test -n "$remote_mode"
+}
+
+function base_present () {
+ test -n "$base_mode"
+}
+
+cleanup_temp_files () {
+ if test "$1" = --save-backup ; then
+ mv -- "$BACKUP" "$path.orig"
+ rm -f -- "$LOCAL" "$REMOTE" "$BASE"
+ else
+ rm -f -- "$LOCAL" "$REMOTE" "$BASE" "$BACKUP"
+ fi
+}
+
+function describe_file () {
+ mode="$1"
+ branch="$2"
+ file="$3"
+
+ echo -n " "
+ if test -z "$mode"; then
+ echo -n "'$path' was deleted"
+ elif is_symlink "$mode" ; then
+ echo -n "'$path' is a symlink containing '"
+ cat "$file"
+ echo -n "'"
+ else
+ if base_present; then
+ echo -n "'$path' was created"
+ else
+ echo -n "'$path' was modified"
+ fi
+ fi
+ echo " in the $branch branch"
+}
+
+
+resolve_symlink_merge () {
+ while /bin/true; do
+ echo -n "Use (r)emote or (l)ocal, or (a)bort? "
+ read ans
+ case "$ans" in
+ [lL]*)
+ git-checkout-index -f --stage=2 -- "$path"
+ git-add -- "$path"
+ cleanup_temp_files --save-backup
+ return
+ ;;
+ [rR]*)
+ git-checkout-index -f --stage=3 -- "$path"
+ git-add -- "$path"
+ cleanup_temp_files --save-backup
+ return
+ ;;
+ [qQ]*)
+ exit 1
+ ;;
+ esac
+ done
+}
+
+resolve_deleted_merge () {
+ while /bin/true; do
+ echo -n "Use (m)odified or (d)eleted file, or (a)bort? "
+ read ans
+ case "$ans" in
+ [mM]*)
+ git-add -- "$path"
+ cleanup_temp_files --save-backup
+ return
+ ;;
+ [dD]*)
+ git-rm -- "$path"
+ cleanup_temp_files
+ return
+ ;;
+ [qQ]*)
+ exit 1
+ ;;
+ esac
+ done
+}
+
+merge_file () {
+ path="$1"
+
+ if test ! -f "$path" ; then
+ echo "$path: file not found"
+ exit 1
+ fi
+
+ f=`git-ls-files -u -- "$path"`
+ if test -z "$f" ; then
+ echo "$path: file does not need merging"
+ exit 1
+ fi
+
+ BACKUP="$path.BACKUP.$$"
+ LOCAL="$path.LOCAL.$$"
+ REMOTE="$path.REMOTE.$$"
+ BASE="$path.BASE.$$"
+
+ mv -- "$path" "$BACKUP"
+ cp -- "$BACKUP" "$path"
+
+ base_mode=`git ls-files -u -- "$path" | awk '{if ($3==1) print $1;}'`
+ local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'`
+ remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'`
+
+ base_present && git cat-file blob ":1:$path" > "$BASE" 2>/dev/null
+ local_present && git cat-file blob ":2:$path" > "$LOCAL" 2>/dev/null
+ remote_present && git cat-file blob ":3:$path" > "$REMOTE" 2>/dev/null
+
+ if test -z "$local_mode" -o -z "$remote_mode"; then
+ echo "Deleted merge conflict for $path:"
+ describe_file "$local_mode" "local" "$LOCAL"
+ describe_file "$remote_mode" "remote" "$REMOTE"
+ resolve_deleted_merge
+ return
+ fi
+
+ if is_symlink "$local_mode" || is_symlink "$remote_mode"; then
+ echo "Symlink merge conflict for $path:"
+ describe_file "$local_mode" "local" "$LOCAL"
+ describe_file "$remote_mode" "remote" "$REMOTE"
+ resolve_symlink_merge
+ return
+ fi
+
+ echo "Normal merge conflict for $path:"
+ describe_file "$local_mode" "local" "$LOCAL"
+ describe_file "$remote_mode" "remote" "$REMOTE"
+ echo -n "Hit return to start merge resolution tool ($merge_tool): "
+ read ans
+
+ case "$merge_tool" in
+ kdiff3)
+ if base_present ; then
+ (kdiff3 --auto --L1 "$path (Base)" -L2 "$path (Local)" --L3 "$path (Remote)" \
+ -o "$path" -- "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+ else
+ (kdiff3 --auto -L1 "$path (Local)" --L2 "$path (Remote)" \
+ -o "$path" -- "$LOCAL" "$REMOTE" > /dev/null 2>&1)
+ fi
+ status=$?
+ if test "$status" -eq 0; then
+ rm "$BACKUP"
+ fi
+ ;;
+ tkdiff)
+ if base_present ; then
+ tkdiff -a "$BASE" -o "$path" -- "$LOCAL" "$REMOTE"
+ else
+ tkdiff -o "$path" -- "$LOCAL" "$REMOTE"
+ fi
+ status=$?
+ if test "$status" -eq 0; then
+ mv -- "$BACKUP" "$path.orig"
+ fi
+ ;;
+ meld)
+ touch "$BACKUP"
+ meld -- "$LOCAL" "$path" "$REMOTE"
+ if test "$path" -nt "$BACKUP" ; then
+ status=0;
+ else
+ while true; do
+ echo "$path seems unchanged."
+ echo -n "Was the merge successful? [y/n] "
+ read answer < /dev/tty
+ case "$answer" in
+ y*|Y*) status=0; break ;;
+ n*|N*) status=1; break ;;
+ esac
+ done
+ fi
+ if test "$status" -eq 0; then
+ mv -- "$BACKUP" "$path.orig"
+ fi
+ ;;
+ xxdiff)
+ touch "$BACKUP"
+ if base_present ; then
+ xxdiff -X --show-merged-pane \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$path" -- "$LOCAL" "$BASE" "$REMOTE"
+ else
+ xxdiff -X --show-merged-pane \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$path" -- "$LOCAL" "$REMOTE"
+ fi
+ if test "$path" -nt "$BACKUP" ; then
+ status=0;
+ else
+ while true; do
+ echo "$path seems unchanged."
+ echo -n "Was the merge successful? [y/n] "
+ read answer < /dev/tty
+ case "$answer" in
+ y*|Y*) status=0; break ;;
+ n*|N*) status=1; break ;;
+ esac
+ done
+ fi
+ if test "$status" -eq 0; then
+ mv -- "$BACKUP" "$path.orig"
+ fi
+ ;;
+ emerge)
+ if base_present ; then
+ emacs -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$path"
+ else
+ emacs -f emerge-files-command "$LOCAL" "$REMOTE" "$path"
+ fi
+ status=$?
+ if test "$status" -eq 0; then
+ mv -- "$BACKUP" "$path.orig"
+ fi
+ ;;
+ esac
+ if test "$status" -ne 0; then
+ echo "merge of $path failed" 1>&2
+ mv -- "$BACKUP" "$path"
+ exit 1
+ fi
+ git add -- "$path"
+ cleanup_temp_files
+}
+
+while case $# in 0) break ;; esac
+do
+ case "$1" in
+ -t|--tool*)
+ case "$#,$1" in
+ *,*=*)
+ merge_tool=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+ ;;
+ 1,*)
+ usage ;;
+ *)
+ merge_tool="$2"
+ shift ;;
+ esac
+ ;;
+ --)
+ break
+ ;;
+ -*)
+ usage
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+if test -z "$merge_tool"; then
+ merge_tool=`git-config merge.tool`
+ if test $merge_tool = kdiff3 -o $merge_tool = tkdiff -o \
+ $merge_tool = xxdiff -o $merge_tool = meld ; then
+ unset merge_tool
+ fi
+fi
+
+if test -z "$merge_tool" ; then
+ if type kdiff3 >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool="kdiff3";
+ elif type tkdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=tkdiff
+ elif type xxdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=xxdiff
+ elif type meld >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=meld
+ elif type emacs >/dev/null 2>&1; then
+ merge_tool=emerge
+ else
+ echo "No available merge resolution programs available."
+ exit 1
+ fi
+fi
+
+case "$merge_tool" in
+ kdiff3|tkdiff|meld|xxdiff)
+ if ! type "$merge_tool" > /dev/null 2>&1; then
+ echo "The merge tool $merge_tool is not available"
+ exit 1
+ fi
+ ;;
+ emerge)
+ if ! type "emacs" > /dev/null 2>&1; then
+ echo "Emacs is not available"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Unknown merge tool: $merge_tool"
+ exit 1
+ ;;
+esac
+
+if test $# -eq 0 ; then
+ files=`git ls-files -u | sed -e 's/^[^ ]* //' | sort -u`
+ if test -z "$files" ; then
+ echo "No files need merging"
+ exit 0
+ fi
+ echo Merging the files: $files
+ git ls-files -u | sed -e 's/^[^ ]* //' | sort -u | while read i
+ do
+ echo ""
+ merge_file "$i" < /dev/tty > /dev/tty
+ done
+else
+ while test $# -gt 0; do
+ echo ""
+ merge_file "$1"
+ shift
+ done
+fi
+exit 0
diff --git a/git-send-email.perl b/git-send-email.perl
index a71a192e4d..6989c0260f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -149,6 +149,16 @@ if ($@) {
$term = new FakeTerm "$@: going non-interactive";
}
+my $def_chain = $repo->config_boolean('sendemail.chainreplyto');
+if ($def_chain and $def_chain eq 'false') {
+ $chain_reply_to = 0;
+}
+
+@bcclist = $repo->config('sendemail.bcc');
+if (!@bcclist or !$bcclist[0]) {
+ @bcclist = ();
+}
+
# Begin by accumulating all the variables (defined above), that we will end up
# needing, first, from the command line:
diff --git a/git-svn.perl b/git-svn.perl
index 326e89fe03..e8457893db 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -56,7 +56,7 @@ my ($_stdin, $_help, $_edit,
$_message, $_file,
$_template, $_shared,
$_version, $_fetch_all,
- $_merge, $_strategy, $_dry_run,
+ $_merge, $_strategy, $_dry_run, $_local,
$_prefix, $_no_checkout, $_verbose);
$Git::SVN::_follow_parent = 1;
my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
@@ -145,6 +145,7 @@ my %cmd = (
{ 'merge|m|M' => \$_merge,
'verbose|v' => \$_verbose,
'strategy|s=s' => \$_strategy,
+ 'local|l' => \$_local,
'fetch-all|all' => \$_fetch_all,
%fc_opts } ],
'commit-diff' => [ \&cmd_commit_diff,
@@ -439,7 +440,9 @@ sub cmd_rebase {
command_noisy('status');
exit 1;
}
- $_fetch_all ? $gs->fetch_all : $gs->fetch;
+ unless ($_local) {
+ $_fetch_all ? $gs->fetch_all : $gs->fetch;
+ }
command_noisy(rebase_cmd(), $gs->refname);
}
diff --git a/perl/Makefile b/perl/Makefile
index 5ec0389883..17d004e5a0 100644
--- a/perl/Makefile
+++ b/perl/Makefile
@@ -33,7 +33,7 @@ $(makfile): ../GIT-CFLAGS Makefile
echo ' echo $(instdir_SQ)' >> $@
else
$(makfile): Makefile.PL ../GIT-CFLAGS
- $(QUIET_GEN)'$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
+ '$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)'
endif
# this is just added comfort for calling make directly in perl dir
diff --git a/receive-pack.c b/receive-pack.c
index 675c88f492..7cf58782e3 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -67,47 +67,11 @@ struct command {
static struct command *commands;
-static const char update_hook[] = "hooks/update";
static const char pre_receive_hook[] = "hooks/pre-receive";
static const char post_receive_hook[] = "hooks/post-receive";
-static int run_hook(const char *hook_name,
- struct command *first_cmd,
- int single)
+static int hook_status(int code, const char *hook_name)
{
- struct command *cmd;
- int argc, code;
- const char **argv;
-
- for (argc = 0, cmd = first_cmd; cmd; cmd = cmd->next) {
- if (!cmd->error_string)
- argc += 3;
- if (single)
- break;
- }
-
- if (!argc || access(hook_name, X_OK) < 0)
- return 0;
-
- argv = xmalloc(sizeof(*argv) * (2 + argc));
- argv[0] = hook_name;
- for (argc = 1, cmd = first_cmd; cmd; cmd = cmd->next) {
- if (!cmd->error_string) {
- argv[argc++] = xstrdup(cmd->ref_name);
- argv[argc++] = xstrdup(sha1_to_hex(cmd->old_sha1));
- argv[argc++] = xstrdup(sha1_to_hex(cmd->new_sha1));
- }
- if (single)
- break;
- }
- argv[argc] = NULL;
-
- code = run_command_v_opt(argv,
- RUN_COMMAND_NO_STDIN | RUN_COMMAND_STDOUT_TO_STDERR);
- while (--argc > 0)
- free((char*)argv[argc]);
- free(argv);
-
switch (code) {
case 0:
return 0;
@@ -115,6 +79,8 @@ static int run_hook(const char *hook_name,
return error("hook fork failed");
case -ERR_RUN_COMMAND_EXEC:
return error("hook execute failed");
+ case -ERR_RUN_COMMAND_PIPE:
+ return error("hook pipe failed");
case -ERR_RUN_COMMAND_WAITPID:
return error("waitpid failed");
case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
@@ -129,6 +95,69 @@ static int run_hook(const char *hook_name,
}
}
+static int run_hook(const char *hook_name)
+{
+ static char buf[sizeof(commands->old_sha1) * 2 + PATH_MAX + 4];
+ struct command *cmd;
+ struct child_process proc;
+ const char *argv[2];
+ int have_input = 0, code;
+
+ for (cmd = commands; !have_input && cmd; cmd = cmd->next) {
+ if (!cmd->error_string)
+ have_input = 1;
+ }
+
+ if (!have_input || access(hook_name, X_OK) < 0)
+ return 0;
+
+ argv[0] = hook_name;
+ argv[1] = NULL;
+
+ memset(&proc, 0, sizeof(proc));
+ proc.argv = argv;
+ proc.in = -1;
+ proc.stdout_to_stderr = 1;
+
+ code = start_command(&proc);
+ if (code)
+ return hook_status(code, hook_name);
+ for (cmd = commands; cmd; cmd = cmd->next) {
+ if (!cmd->error_string) {
+ size_t n = snprintf(buf, sizeof(buf), "%s %s %s\n",
+ sha1_to_hex(cmd->old_sha1),
+ sha1_to_hex(cmd->new_sha1),
+ cmd->ref_name);
+ if (write_in_full(proc.in, buf, n) != n)
+ break;
+ }
+ }
+ return hook_status(finish_command(&proc), hook_name);
+}
+
+static int run_update_hook(struct command *cmd)
+{
+ static const char update_hook[] = "hooks/update";
+ struct child_process proc;
+ const char *argv[5];
+
+ if (access(update_hook, X_OK) < 0)
+ return 0;
+
+ argv[0] = update_hook;
+ argv[1] = cmd->ref_name;
+ argv[2] = sha1_to_hex(cmd->old_sha1);
+ argv[3] = sha1_to_hex(cmd->new_sha1);
+ argv[4] = NULL;
+
+ memset(&proc, 0, sizeof(proc));
+ proc.argv = argv;
+ proc.no_stdin = 1;
+ proc.stdout_to_stderr = 1;
+
+ return hook_status(run_command(&proc), update_hook);
+}
+
static const char *update(struct command *cmd)
{
const char *name = cmd->ref_name;
@@ -165,7 +194,7 @@ static const char *update(struct command *cmd)
return "non-fast forward";
}
}
- if (run_hook(update_hook, cmd, 1)) {
+ if (run_update_hook(cmd)) {
error("hook declined to update %s", name);
return "hook declined";
}
@@ -238,7 +267,7 @@ static void execute_commands(const char *unpacker_error)
return;
}
- if (run_hook(pre_receive_hook, commands, 0)) {
+ if (run_hook(pre_receive_hook)) {
while (cmd) {
cmd->error_string = "pre-receive hook declined";
cmd = cmd->next;
@@ -493,7 +522,7 @@ int main(int argc, char **argv)
unlink(pack_lockfile);
if (report_status)
report(unpack_status);
- run_hook(post_receive_hook, commands, 0);
+ run_hook(post_receive_hook);
run_update_post_hook(commands);
}
return 0;
diff --git a/revision.c b/revision.c
index f5b8ae4f03..3c2eb125e6 100644
--- a/revision.c
+++ b/revision.c
@@ -437,36 +437,6 @@ static void limit_list(struct rev_info *revs)
continue;
p = &commit_list_insert(commit, p)->next;
}
- if (revs->boundary) {
- /* mark the ones that are on the result list first */
- for (list = newlist; list; list = list->next) {
- struct commit *commit = list->item;
- commit->object.flags |= TMP_MARK;
- }
- for (list = newlist; list; list = list->next) {
- struct commit *commit = list->item;
- struct object *obj = &commit->object;
- struct commit_list *parent;
- if (obj->flags & UNINTERESTING)
- continue;
- for (parent = commit->parents;
- parent;
- parent = parent->next) {
- struct commit *pcommit = parent->item;
- if (!(pcommit->object.flags & UNINTERESTING))
- continue;
- pcommit->object.flags |= BOUNDARY;
- if (pcommit->object.flags & TMP_MARK)
- continue;
- pcommit->object.flags |= TMP_MARK;
- p = &commit_list_insert(pcommit, p)->next;
- }
- }
- for (list = newlist; list; list = list->next) {
- struct commit *commit = list->item;
- commit->object.flags &= ~TMP_MARK;
- }
- }
revs->commits = newlist;
}
@@ -1193,17 +1163,6 @@ static void rewrite_parents(struct rev_info *revs, struct commit *commit)
}
}
-static void mark_boundary_to_show(struct commit *commit)
-{
- struct commit_list *p = commit->parents;
- while (p) {
- commit = p->item;
- p = p->next;
- if (commit->object.flags & BOUNDARY)
- commit->object.flags |= BOUNDARY_SHOW;
- }
-}
-
static int commit_match(struct commit *commit, struct rev_info *opt)
{
if (!opt->grep_filter)
@@ -1235,15 +1194,9 @@ static struct commit *get_revision_1(struct rev_info *revs)
*/
if (!revs->limited) {
if (revs->max_age != -1 &&
- (commit->date < revs->max_age)) {
- if (revs->boundary)
- commit->object.flags |=
- BOUNDARY_SHOW | BOUNDARY;
- else
- continue;
- } else
- add_parents_to_list(revs, commit,
- &revs->commits);
+ (commit->date < revs->max_age))
+ continue;
+ add_parents_to_list(revs, commit, &revs->commits);
}
if (commit->object.flags & SHOWN)
continue;
@@ -1252,18 +1205,6 @@ static struct commit *get_revision_1(struct rev_info *revs)
revs->ignore_packed))
continue;
- /* We want to show boundary commits only when their
- * children are shown. When path-limiter is in effect,
- * rewrite_parents() drops some commits from getting shown,
- * and there is no point showing boundary parents that
- * are not shown. After rewrite_parents() rewrites the
- * parents of a commit that is shown, we mark the boundary
- * parents with BOUNDARY_SHOW.
- */
- if (commit->object.flags & BOUNDARY_SHOW) {
- commit->object.flags |= SHOWN;
- return commit;
- }
if (commit->object.flags & UNINTERESTING)
continue;
if (revs->min_age != -1 && (commit->date > revs->min_age))
@@ -1286,80 +1227,136 @@ static struct commit *get_revision_1(struct rev_info *revs)
if (revs->parents)
rewrite_parents(revs, commit);
}
- if (revs->boundary)
- mark_boundary_to_show(commit);
- commit->object.flags |= SHOWN;
return commit;
} while (revs->commits);
return NULL;
}
+static void gc_boundary(struct object_array *array)
+{
+ unsigned nr = array->nr;
+ unsigned alloc = array->alloc;
+ struct object_array_entry *objects = array->objects;
+
+ if (alloc <= nr) {
+ unsigned i, j;
+ for (i = j = 0; i < nr; i++) {
+ if (objects[i].item->flags & SHOWN)
+ continue;
+ if (i != j)
+ objects[j] = objects[i];
+ j++;
+ }
+ for (i = j; i < nr; i++)
+ objects[i].item = NULL;
+ array->nr = j;
+ }
+}
+
struct commit *get_revision(struct rev_info *revs)
{
struct commit *c = NULL;
+ struct commit_list *l;
+
+ if (revs->boundary == 2) {
+ unsigned i;
+ struct object_array *array = &revs->boundary_commits;
+ struct object_array_entry *objects = array->objects;
+ for (i = 0; i < array->nr; i++) {
+ c = (struct commit *)(objects[i].item);
+ if (!c)
+ continue;
+ if (!(c->object.flags & CHILD_SHOWN))
+ continue;
+ if (!(c->object.flags & SHOWN))
+ break;
+ }
+ if (array->nr <= i)
+ return NULL;
- if (revs->reverse) {
- struct commit_list *list;
+ c->object.flags |= SHOWN | BOUNDARY;
+ return c;
+ }
- /*
- * rev_info.reverse is used to note the fact that we
- * want to output the list of revisions in reverse
- * order. To accomplish this goal, reverse can have
- * different values:
- *
- * 0 do nothing
- * 1 reverse the list
- * 2 internal use: we have already obtained and
- * reversed the list, now we only need to yield
- * its items.
- */
+ if (revs->reverse) {
+ int limit = -1;
- if (revs->reverse == 1) {
- revs->reverse = 0;
- list = NULL;
- while ((c = get_revision(revs)))
- commit_list_insert(c, &list);
- revs->commits = list;
- revs->reverse = 2;
+ if (0 <= revs->max_count) {
+ limit = revs->max_count;
+ if (0 < revs->skip_count)
+ limit += revs->skip_count;
}
-
- if (!revs->commits)
- return NULL;
- c = revs->commits->item;
- list = revs->commits->next;
- free(revs->commits);
- revs->commits = list;
- return c;
+ l = NULL;
+ while ((c = get_revision_1(revs))) {
+ commit_list_insert(c, &l);
+ if ((0 < limit) && !--limit)
+ break;
+ }
+ revs->commits = l;
+ revs->reverse = 0;
+ revs->max_count = -1;
+ c = NULL;
}
- if (0 < revs->skip_count) {
- while ((c = get_revision_1(revs)) != NULL) {
- if (revs->skip_count-- <= 0)
+ /*
+ * Now pick up what they want to give us
+ */
+ c = get_revision_1(revs);
+ if (c) {
+ while (0 < revs->skip_count) {
+ revs->skip_count--;
+ c = get_revision_1(revs);
+ if (!c)
break;
}
}
- /* Check the max_count ... */
+ /*
+ * Check the max_count.
+ */
switch (revs->max_count) {
case -1:
break;
case 0:
- if (revs->boundary) {
- struct commit_list *list = revs->commits;
- while (list) {
- list->item->object.flags |=
- BOUNDARY_SHOW | BOUNDARY;
- list = list->next;
- }
- /* all remaining commits are boundary commits */
- revs->max_count = -1;
- revs->limited = 1;
- } else
- return NULL;
+ c = NULL;
+ break;
default:
revs->max_count--;
}
+
if (c)
+ c->object.flags |= SHOWN;
+
+ if (!revs->boundary) {
return c;
- return get_revision_1(revs);
+ }
+
+ if (!c) {
+ /*
+ * get_revision_1() runs out the commits, and
+ * we are done computing the boundaries.
+ * switch to boundary commits output mode.
+ */
+ revs->boundary = 2;
+ return get_revision(revs);
+ }
+
+ /*
+ * boundary commits are the commits that are parents of the
+ * ones we got from get_revision_1() but they themselves are
+ * not returned from get_revision_1(). Before returning
+ * 'c', we need to mark its parents that they could be boundaries.
+ */
+
+ for (l = c->parents; l; l = l->next) {
+ struct object *p;
+ p = &(l->item->object);
+ if (p->flags & (CHILD_SHOWN | SHOWN))
+ continue;
+ p->flags |= CHILD_SHOWN;
+ gc_boundary(&revs->boundary_commits);
+ add_object_array(p, NULL, &revs->boundary_commits);
+ }
+
+ return c;
}
diff --git a/revision.h b/revision.h
index cf33713608..6ae39e6bec 100644
--- a/revision.h
+++ b/revision.h
@@ -7,7 +7,7 @@
#define SHOWN (1u<<3)
#define TMP_MARK (1u<<4) /* for isolated cases; clean after use */
#define BOUNDARY (1u<<5)
-#define BOUNDARY_SHOW (1u<<6)
+#define CHILD_SHOWN (1u<<6)
#define ADDED (1u<<7) /* Parents already parsed and added? */
#define SYMMETRIC_LEFT (1u<<8)
@@ -21,6 +21,9 @@ struct rev_info {
struct commit_list *commits;
struct object_array pending;
+ /* Parents of shown commits */
+ struct object_array boundary_commits;
+
/* Basic information */
const char *prefix;
void *prune_data;
@@ -40,10 +43,10 @@ struct rev_info {
edge_hint:1,
limited:1,
unpacked:1, /* see also ignore_packed below */
- boundary:1,
+ boundary:2,
left_right:1,
parents:1,
- reverse:2;
+ reverse:1;
/* Diff flags */
unsigned int diff:1,
diff --git a/run-command.c b/run-command.c
index cfbad74d14..bef9775e08 100644
--- a/run-command.c
+++ b/run-command.c
@@ -2,30 +2,70 @@
#include "run-command.h"
#include "exec_cmd.h"
-int run_command_v_opt(const char **argv, int flags)
+static inline void close_pair(int fd[2])
{
- pid_t pid = fork();
+ close(fd[0]);
+ close(fd[1]);
+}
+
+int start_command(struct child_process *cmd)
+{
+ int need_in = !cmd->no_stdin && cmd->in < 0;
+ int fdin[2];
- if (pid < 0)
+ if (need_in) {
+ if (pipe(fdin) < 0)
+ return -ERR_RUN_COMMAND_PIPE;
+ cmd->in = fdin[1];
+ cmd->close_in = 1;
+ }
+
+ cmd->pid = fork();
+ if (cmd->pid < 0) {
+ if (need_in)
+ close_pair(fdin);
return -ERR_RUN_COMMAND_FORK;
- if (!pid) {
- if (flags & RUN_COMMAND_NO_STDIN) {
+ }
+
+ if (!cmd->pid) {
+ if (cmd->no_stdin) {
int fd = open("/dev/null", O_RDWR);
dup2(fd, 0);
close(fd);
+ } else if (need_in) {
+ dup2(fdin[0], 0);
+ close_pair(fdin);
+ } else if (cmd->in) {
+ dup2(cmd->in, 0);
+ close(cmd->in);
}
- if (flags & RUN_COMMAND_STDOUT_TO_STDERR)
+
+ if (cmd->stdout_to_stderr)
dup2(2, 1);
- if (flags & RUN_GIT_CMD) {
- execv_git_cmd(argv);
+ if (cmd->git_cmd) {
+ execv_git_cmd(cmd->argv);
} else {
- execvp(argv[0], (char *const*) argv);
+ execvp(cmd->argv[0], (char *const*) cmd->argv);
}
- die("exec %s failed.", argv[0]);
+ die("exec %s failed.", cmd->argv[0]);
}
+
+ if (need_in)
+ close(fdin[0]);
+ else if (cmd->in)
+ close(cmd->in);
+
+ return 0;
+}
+
+int finish_command(struct child_process *cmd)
+{
+ if (cmd->close_in)
+ close(cmd->in);
+
for (;;) {
int status, code;
- pid_t waiting = waitpid(pid, &status, 0);
+ pid_t waiting = waitpid(cmd->pid, &status, 0);
if (waiting < 0) {
if (errno == EINTR)
@@ -33,7 +73,7 @@ int run_command_v_opt(const char **argv, int flags)
error("waitpid failed (%s)", strerror(errno));
return -ERR_RUN_COMMAND_WAITPID;
}
- if (waiting != pid)
+ if (waiting != cmd->pid)
return -ERR_RUN_COMMAND_WAITPID_WRONG_PID;
if (WIFSIGNALED(status))
return -ERR_RUN_COMMAND_WAITPID_SIGNAL;
@@ -47,47 +87,21 @@ int run_command_v_opt(const char **argv, int flags)
}
}
-int run_command_v(const char **argv)
-{
- return run_command_v_opt(argv, 0);
-}
-
-static int run_command_va_opt(int opt, const char *cmd, va_list param)
-{
- int argc;
- const char *argv[MAX_RUN_COMMAND_ARGS];
- const char *arg;
-
- argv[0] = (char*) cmd;
- argc = 1;
- while (argc < MAX_RUN_COMMAND_ARGS) {
- arg = argv[argc++] = va_arg(param, char *);
- if (!arg)
- break;
- }
- if (MAX_RUN_COMMAND_ARGS <= argc)
- return error("too many args to run %s", cmd);
- return run_command_v_opt(argv, opt);
-}
-
-int run_command_opt(int opt, const char *cmd, ...)
+int run_command(struct child_process *cmd)
{
- va_list params;
- int r;
-
- va_start(params, cmd);
- r = run_command_va_opt(opt, cmd, params);
- va_end(params);
- return r;
+ int code = start_command(cmd);
+ if (code)
+ return code;
+ return finish_command(cmd);
}
-int run_command(const char *cmd, ...)
+int run_command_v_opt(const char **argv, int opt)
{
- va_list params;
- int r;
-
- va_start(params, cmd);
- r = run_command_va_opt(0, cmd, params);
- va_end(params);
- return r;
+ struct child_process cmd;
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.argv = argv;
+ cmd.no_stdin = opt & RUN_COMMAND_NO_STDIN ? 1 : 0;
+ cmd.git_cmd = opt & RUN_GIT_CMD ? 1 : 0;
+ cmd.stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0;
+ return run_command(&cmd);
}
diff --git a/run-command.h b/run-command.h
index 59c4476ced..ff090679a6 100644
--- a/run-command.h
+++ b/run-command.h
@@ -1,22 +1,33 @@
#ifndef RUN_COMMAND_H
#define RUN_COMMAND_H
-#define MAX_RUN_COMMAND_ARGS 256
enum {
ERR_RUN_COMMAND_FORK = 10000,
ERR_RUN_COMMAND_EXEC,
+ ERR_RUN_COMMAND_PIPE,
ERR_RUN_COMMAND_WAITPID,
ERR_RUN_COMMAND_WAITPID_WRONG_PID,
ERR_RUN_COMMAND_WAITPID_SIGNAL,
ERR_RUN_COMMAND_WAITPID_NOEXIT,
};
+struct child_process {
+ const char **argv;
+ pid_t pid;
+ int in;
+ unsigned close_in:1;
+ unsigned no_stdin:1;
+ unsigned git_cmd:1; /* if this is to be git sub-command */
+ unsigned stdout_to_stderr:1;
+};
+
+int start_command(struct child_process *);
+int finish_command(struct child_process *);
+int run_command(struct child_process *);
+
#define RUN_COMMAND_NO_STDIN 1
#define RUN_GIT_CMD 2 /*If this is to be git sub-command */
#define RUN_COMMAND_STDOUT_TO_STDERR 4
int run_command_v_opt(const char **argv, int opt);
-int run_command_v(const char **argv);
-int run_command_opt(int opt, const char *cmd, ...);
-int run_command(const char *cmd, ...);
#endif
diff --git a/sha1_name.c b/sha1_name.c
index 31812d3d26..bede0e5b06 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -602,10 +602,10 @@ static int handle_one_ref(const char *path,
*/
#define ONELINE_SEEN (1u<<20)
-int get_sha1_oneline(const char *prefix, unsigned char *sha1)
+static int get_sha1_oneline(const char *prefix, unsigned char *sha1)
{
struct commit_list *list = NULL, *backup = NULL, *l;
- struct commit *commit;
+ int retval = -1;
if (prefix[0] == '!') {
if (prefix[1] != '!')
@@ -617,20 +617,24 @@ int get_sha1_oneline(const char *prefix, unsigned char *sha1)
for_each_ref(handle_one_ref, &list);
for (l = list; l; l = l->next)
commit_list_insert(l->item, &backup);
- while ((commit = pop_most_recent_commit(&list, ONELINE_SEEN))) {
+ while (list) {
char *p;
+ struct commit *commit;
+
+ commit = pop_most_recent_commit(&list, ONELINE_SEEN);
parse_object(commit->object.sha1);
if (!commit->buffer || !(p = strstr(commit->buffer, "\n\n")))
continue;
if (!prefixcmp(p + 2, prefix)) {
hashcpy(sha1, commit->object.sha1);
+ retval = 0;
break;
}
}
free_commit_list(list);
for (l = backup; l; l = l->next)
clear_commit_marks(l->item, ONELINE_SEEN);
- return commit == NULL;
+ return retval;
}
/*
diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh
index cf6306ce9f..f1c7ff0c0a 100755
--- a/t/t5401-update-hooks.sh
+++ b/t/t5401-update-hooks.sh
@@ -25,8 +25,8 @@ test_expect_success setup '
cat >victim/.git/hooks/pre-receive <<'EOF'
#!/bin/sh
-echo "$@" >>$GIT_DIR/pre-receive.args
-read x; printf "$x" >$GIT_DIR/pre-receive.stdin
+printf "$@" >>$GIT_DIR/pre-receive.args
+cat - >$GIT_DIR/pre-receive.stdin
echo STDOUT pre-receive
echo STDERR pre-receive >&2
EOF
@@ -44,8 +44,8 @@ chmod u+x victim/.git/hooks/update
cat >victim/.git/hooks/post-receive <<'EOF'
#!/bin/sh
-echo "$@" >>$GIT_DIR/post-receive.args
-read x; printf "$x" >$GIT_DIR/post-receive.stdin
+printf "$@" >>$GIT_DIR/post-receive.args
+cat - >$GIT_DIR/post-receive.stdin
echo STDOUT post-receive
echo STDERR post-receive >&2
EOF
@@ -80,11 +80,10 @@ test_expect_success 'hooks ran' '
test -f victim/.git/post-update.stdin
'
-test_expect_success 'pre-receive hook arguments' '
- echo \
- refs/heads/master $commit0 $commit1 \
- refs/heads/tofail $commit1 $commit0 \
- | git diff - victim/.git/pre-receive.args
+test_expect_success 'pre-receive hook input' '
+ (echo $commit0 $commit1 refs/heads/master;
+ echo $commit1 $commit0 refs/heads/tofail
+ ) | git diff - victim/.git/pre-receive.stdin
'
test_expect_success 'update hook arguments' '
@@ -93,9 +92,9 @@ test_expect_success 'update hook arguments' '
) | git diff - victim/.git/update.args
'
-test_expect_success 'post-receive hook arguments' '
- echo refs/heads/master $commit0 $commit1 |
- git diff - victim/.git/post-receive.args
+test_expect_success 'post-receive hook input' '
+ echo $commit0 $commit1 refs/heads/master |
+ git diff - victim/.git/post-receive.stdin
'
test_expect_success 'post-update hook arguments' '
@@ -104,12 +103,15 @@ test_expect_success 'post-update hook arguments' '
'
test_expect_success 'all hook stdin is /dev/null' '
- ! test -s victim/.git/pre-receive.stdin &&
! test -s victim/.git/update.stdin &&
- ! test -s victim/.git/post-receive.stdin &&
! test -s victim/.git/post-update.stdin
'
+test_expect_success 'all *-receive hook args are empty' '
+ ! test -s victim/.git/pre-receive.args &&
+ ! test -s victim/.git/post-receive.args
+'
+
test_expect_failure 'send-pack produced no output' '
test -s send.out
'
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index fa76662dce..426017e1d0 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -90,6 +90,13 @@ test_expect_success 'create bundle 1' '
git bundle create bundle1 master^..master
'
+test_expect_success 'header of bundle looks right' '
+ head -n 1 "$D"/bundle1 | grep "^#" &&
+ head -n 2 "$D"/bundle1 | grep "^-[0-9a-f]\{40\} " &&
+ head -n 3 "$D"/bundle1 | grep "^[0-9a-f]\{40\} " &&
+ head -n 4 "$D"/bundle1 | grep "^$"
+'
+
test_expect_success 'create bundle 2' '
cd "$D" &&
git bundle create bundle2 master~2..master
@@ -101,10 +108,41 @@ test_expect_failure 'unbundle 1' '
git fetch "$D/bundle1" master:master
'
+test_expect_success 'bundle 1 has only 3 files ' '
+ cd "$D" &&
+ (
+ while read x && test -n "$x"
+ do
+ :;
+ done
+ cat
+ ) <bundle1 >bundle.pack &&
+ git index-pack bundle.pack &&
+ verify=$(git verify-pack -v bundle.pack) &&
+ test 4 = $(echo "$verify" | wc -l)
+'
+
test_expect_success 'unbundle 2' '
cd "$D/bundle" &&
git fetch ../bundle2 master:master &&
test "tip" = "$(git log -1 --pretty=oneline master | cut -b42-)"
'
+test_expect_success 'bundle does not prerequisite objects' '
+ cd "$D" &&
+ touch file2 &&
+ git add file2 &&
+ git commit -m add.file2 file2 &&
+ git bundle create bundle3 -1 HEAD &&
+ (
+ while read x && test -n "$x"
+ do
+ :;
+ done
+ cat
+ ) <bundle3 >bundle.pack &&
+ git index-pack bundle.pack &&
+ test 4 = $(git verify-pack -v bundle.pack | wc -l)
+'
+
test_done
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 03f2f8f347..8e958da536 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -501,4 +501,54 @@ test_expect_success \
'test `git-rev-parse --verify branch^1` \
= `git-rev-parse --verify K^1`'
+###
+### series L
+###
+
+cat >input <<INPUT_END
+blob
+mark :1
+data <<EOF
+some data
+EOF
+
+blob
+mark :2
+data <<EOF
+other data
+EOF
+
+commit refs/heads/L
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+create L
+COMMIT
+
+M 644 :1 b.
+M 644 :1 b/other
+M 644 :1 ba
+
+commit refs/heads/L
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data <<COMMIT
+update L
+COMMIT
+
+M 644 :2 b.
+M 644 :2 b/other
+M 644 :2 ba
+INPUT_END
+
+cat >expect <<EXPECT_END
+:100644 100644 4268632... 55d3a52... M b.
+:040000 040000 0ae5cac... 443c768... M b
+:100644 100644 4268632... 55d3a52... M ba
+EXPECT_END
+
+test_expect_success \
+ 'L: verify internal tree sorting' \
+ 'git-fast-import <input &&
+ git-diff --raw L^ L >output &&
+ git diff expect output'
+
test_done