summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--Documentation/RelNotes-1.6.3.2.txt48
-rw-r--r--Documentation/git-rerere.txt65
-rw-r--r--Documentation/git-send-email.txt4
-rw-r--r--Documentation/git-show-ref.txt4
-rw-r--r--Documentation/git-stash.txt30
-rw-r--r--Documentation/git-svn.txt2
-rw-r--r--Documentation/git.txt5
-rw-r--r--Documentation/gittutorial.txt4
-rw-r--r--Documentation/user-manual.txt4
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--attr.c3
-rw-r--r--base85.c2
-rw-r--r--builtin-apply.c4
-rw-r--r--builtin-blame.c26
-rw-r--r--builtin-commit.c4
-rw-r--r--builtin-fetch-pack.c4
-rw-r--r--builtin-fmt-merge-msg.c1
-rw-r--r--builtin-pack-objects.c3
-rw-r--r--builtin-remote.c9
-rw-r--r--builtin-unpack-objects.c4
-rw-r--r--builtin-upload-archive.c12
-rw-r--r--configure.ac8
-rw-r--r--connect.c5
-rwxr-xr-xcontrib/fast-import/import-tars.perl17
-rw-r--r--daemon.c10
-rw-r--r--delta.h5
-rw-r--r--diff.c1
-rwxr-xr-xgit-add--interactive.perl95
-rwxr-xr-xgit-pull.sh6
-rwxr-xr-xgit-rebase--interactive.sh2
-rwxr-xr-xgit-rebase.sh9
-rw-r--r--grep.c9
-rw-r--r--http.c8
-rw-r--r--index-pack.c6
-rw-r--r--ll-merge.c8
-rw-r--r--patch-delta.c2
-rw-r--r--sha1_file.c3
-rwxr-xr-xt/t3505-cherry-pick-empty.sh10
-rwxr-xr-xt/t3701-add-interactive.sh38
-rwxr-xr-xt/t4131-apply-fake-ancestor.sh42
-rwxr-xr-xt/t6023-merge-file.sh6
-rwxr-xr-xt/t6200-fmt-merge-msg.sh32
-rwxr-xr-xt/t7002-grep.sh9
-rwxr-xr-xt/t7500-commit.sh10
-rwxr-xr-xt/t8003-blame.sh15
-rw-r--r--userdiff.c5
-rw-r--r--ws.c12
-rw-r--r--xdiff/xmerge.c31
49 files changed, 479 insertions, 167 deletions
diff --git a/.gitattributes b/.gitattributes
index 6b9c715d21..0636deea93 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
* whitespace=!indent,trail,space
-*.[ch] whitespace
+*.[ch] whitespace=indent,trail,space
diff --git a/Documentation/RelNotes-1.6.3.2.txt b/Documentation/RelNotes-1.6.3.2.txt
index a3fceebb11..b2f3f0293c 100644
--- a/Documentation/RelNotes-1.6.3.2.txt
+++ b/Documentation/RelNotes-1.6.3.2.txt
@@ -8,44 +8,54 @@ Fixes since v1.6.3.1
casting the (char *) pointer to (int *); GCC 4.4 did not like this,
and aborted compilation.
- * http-push had a small use-after-free bug.
-
- * command completion code in bash did not reliably detect that we are
- in a bare repository.
-
- * "git for-each-ref" had a segfaulting bug when dealing with a tag object
- created by an ancient git.
-
* Some unlink(2) failures went undiagnosed.
* The "recursive" merge strategy misbehaved when faced rename/delete
conflicts while coming up with an intermediate merge base.
+ * The low-level merge algorithm did not handle a degenerate case of
+ merging a file with itself using itself as the common ancestor
+ gracefully. It should produce the file itself, but instead
+ produced an empty result.
+
* GIT_TRACE mechanism segfaulted when tracing a shell-quoted aliases.
+ * OpenBSD also uses st_ctimspec in "struct stat", instead of "st_ctim".
+
+ * With NO_CROSS_DIRECTORY_HARDLINKS, "make install" can be told not to
+ create hardlinks between $(gitexecdir)/git-$builtin_commands and
+ $(bindir)/git.
+
+ * command completion code in bash did not reliably detect that we are
+ in a bare repository.
+
* "git add ." in an empty directory complained that pathspec "." did not
match anything, which may be technically correct, but not useful. We
silently make it a no-op now.
+ * "git add -p" (and "patch" action in "git add -i") was broken when
+ the first hunk that adds a line at the top was split into two and
+ both halves are marked to be used.
+
+ * "git blame path" misbehaved at the commit where path became file
+ from a directory with some files in it.
+
+ * "git for-each-ref" had a segfaulting bug when dealing with a tag object
+ created by an ancient git.
+
* "git format-patch -k" still added patch numbers if format.numbered
configuration was set.
- * OpenBSD also uses st_ctimspec in "struct stat", instead of "st_ctim".
+ * "git grep --color ''" did not terminate. The command also had
+ subtle bugs with its -w option.
- * With NO_CROSS_DIRECTORY_HARDLINKS, "make install" can be told not to
- create hardlinks between $(gitexecdir)/git-$builtin_commands and
- $(bindir)/git.
+ * http-push had a small use-after-free bug.
* "git push" was converting OFS_DELTA pack representation into less
efficient REF_DELTA representation unconditionally upon transfer,
making the transferred data unnecessarily larger.
+ * "git remote show origin" segfaulted when origin was still empty.
+
Many other general usability updates around help text, diagnostic messages
and documentation are included as well.
-
----
-exec >/var/tmp/1
-O=v1.6.3.1-51-g2a1feb9
-echo O=$(git describe maint)
-git shortlog --no-merges $O..maint
-
diff --git a/Documentation/git-rerere.txt b/Documentation/git-rerere.txt
index 64715c17da..a53c3cd35b 100644
--- a/Documentation/git-rerere.txt
+++ b/Documentation/git-rerere.txt
@@ -12,15 +12,15 @@ SYNOPSIS
DESCRIPTION
-----------
-In a workflow that employs relatively long lived topic branches,
-the developer sometimes needs to resolve the same conflict over
+In a workflow employing relatively long lived topic branches,
+the developer sometimes needs to resolve the same conflicts over
and over again until the topic branches are done (either merged
to the "release" branch, or sent out and accepted upstream).
-This command helps this process by recording conflicted
-automerge results and corresponding hand-resolve results on the
-initial manual merge, and later by noticing the same automerge
-results and applying the previously recorded hand resolution.
+This command assists the developer in this process by recording
+conflicted automerge results and corresponding hand resolve results
+on the initial manual merge, and applying previously recorded
+hand resolutions to their corresponding automerge results.
[NOTE]
You need to set the configuration variable rerere.enabled to
@@ -54,18 +54,18 @@ for resolutions.
'gc'::
-This command is used to prune records of conflicted merge that
-occurred long time ago. By default, conflicts older than 15
-days that you have not recorded their resolution, and conflicts
-older than 60 days, are pruned. These are controlled with
+This prunes records of conflicted merges that
+occurred a long time ago. By default, unresolved conflicts older
+than 15 days and resolved conflicts older than 60
+days are pruned. These defaults are controlled via the
`gc.rerereunresolved` and `gc.rerereresolved` configuration
-variables.
+variables respectively.
DISCUSSION
----------
-When your topic branch modifies overlapping area that your
+When your topic branch modifies an overlapping area that your
master branch (or upstream) touched since your topic branch
forked from it, you may want to test it with the latest master,
even before your topic branch is ready to be pushed upstream:
@@ -140,9 +140,9 @@ top of the tip before the test merge:
This would leave only one merge commit when your topic branch is
finally ready and merged into the master branch. This merge
would require you to resolve the conflict, introduced by the
-commits marked with `*`. However, often this conflict is the
+commits marked with `*`. However, this conflict is often the
same conflict you resolved when you created the test merge you
-blew away. 'git-rerere' command helps you to resolve this final
+blew away. 'git-rerere' helps you resolve this final
conflicted merge using the information from your earlier hand
resolve.
@@ -150,33 +150,32 @@ Running the 'git-rerere' command immediately after a conflicted
automerge records the conflicted working tree files, with the
usual conflict markers `<<<<<<<`, `=======`, and `>>>>>>>` in
them. Later, after you are done resolving the conflicts,
-running 'git-rerere' again records the resolved state of these
+running 'git-rerere' again will record the resolved state of these
files. Suppose you did this when you created the test merge of
master into the topic branch.
-Next time, running 'git-rerere' after seeing a conflicted
-automerge, if the conflict is the same as the earlier one
-recorded, it is noticed and a three-way merge between the
+Next time, after seeing the same conflicted automerge,
+running 'git-rerere' will perform a three-way merge between the
earlier conflicted automerge, the earlier manual resolution, and
-the current conflicted automerge is performed by the command.
+the current conflicted automerge.
If this three-way merge resolves cleanly, the result is written
-out to your working tree file, so you would not have to manually
+out to your working tree file, so you do not have to manually
resolve it. Note that 'git-rerere' leaves the index file alone,
so you still need to do the final sanity checks with `git diff`
(or `git diff -c`) and 'git-add' when you are satisfied.
As a convenience measure, 'git-merge' automatically invokes
-'git-rerere' when it exits with a failed automerge, which
-records it if it is a new conflict, or reuses the earlier hand
+'git-rerere' upon exiting with a failed automerge and 'git-rerere'
+records the hand resolve when it is a new conflict, or reuses the earlier hand
resolve when it is not. 'git-commit' also invokes 'git-rerere'
-when recording a merge result. What this means is that you do
-not have to do anything special yourself (Note: you still have
-to set the config variable rerere.enabled to enable this command).
+when committing a merge result. What this means is that you do
+not have to do anything special yourself (besides enabling
+the rerere.enabled config variable).
-In our example, when you did the test merge, the manual
+In our example, when you do the test merge, the manual
resolution is recorded, and it will be reused when you do the
-actual merge later with updated master and topic branch, as long
-as the earlier resolution is still applicable.
+actual merge later with the updated master and topic branch, as long
+as the recorded resolution is still applicable.
The information 'git-rerere' records is also used when running
'git-rebase'. After blowing away the test merge and continuing
@@ -194,11 +193,11 @@ development on the topic branch:
o---o---o---*---o---o---o---o master
------------
-you could run `git rebase master topic`, to keep yourself
-up-to-date even before your topic is ready to be sent upstream.
-This would result in falling back to three-way merge, and it
-would conflict the same way the test merge you resolved earlier.
-'git-rerere' is run by 'git-rebase' to help you resolve this
+you could run `git rebase master topic`, to bring yourself
+up-to-date before your topic is ready to be sent upstream.
+This would result in falling back to a three-way merge, and it
+would conflict the same way as the test merge you resolved earlier.
+'git-rerere' will be run by 'git-rebase' to help you resolve this
conflict.
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 794224b1b3..a2821907c7 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -14,6 +14,10 @@ SYNOPSIS
DESCRIPTION
-----------
Takes the patches given on the command line and emails them out.
+Patches can be specified as files, directories (which will send all
+files in the directory), or directly as a revision list. In the
+last case, any format accepted by linkgit:git-format-patch[1] can
+be passed to git send-email.
The header of the email is configurable by command line options. If not
specified on the command line, the user will be prompted with a ReadLine
diff --git a/Documentation/git-show-ref.txt b/Documentation/git-show-ref.txt
index 2f173fff35..98e294aa86 100644
--- a/Documentation/git-show-ref.txt
+++ b/Documentation/git-show-ref.txt
@@ -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::
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 051f94d26f..1cc24cc47e 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -75,14 +75,22 @@ show [<stash>]::
it will accept any format known to 'git-diff' (e.g., `git stash show
-p stash@\{1}` to view the second most recent stash in patch form).
-apply [--index] [<stash>]::
+pop [<stash>]::
- Restore the changes recorded in the stash on top of the current
- working tree state. When no `<stash>` is given, applies the latest
- one. The working directory must match the index.
+ Remove a single stashed state from the stash list and apply it
+ on top of the current working tree state, i.e., do the inverse
+ operation of `git stash save`. The working directory must
+ match the index.
+
-This operation can fail with conflicts; you need to resolve them
-by hand in the working tree.
+Applying the state can fail with conflicts; in this case, it is not
+removed from the stash list. You need to resolve the conflicts by hand
+and call `git stash drop` manually afterwards.
++
+When no `<stash>` is given, `stash@\{0}` is assumed. See also `apply`.
+
+apply [--index] [<stash>]::
+
+ Like `pop`, but do not remove the state from the stash list.
+
If the `--index` option is used, then tries to reinstate not only the working
tree's changes, but also the index's ones. However, this can fail, when you
@@ -112,12 +120,6 @@ drop [<stash>]::
Remove a single stashed state from the stash list. When no `<stash>`
is given, it removes the latest one. i.e. `stash@\{0}`
-pop [<stash>]::
-
- Remove a single stashed state from the stash list and apply on top
- of the current working tree state. When no `<stash>` is given,
- `stash@\{0}` is assumed. See also `apply`.
-
create::
Create a stash (which is a regular commit object) and return its
@@ -163,7 +165,7 @@ $ git pull
file foobar not up to date, cannot merge.
$ git stash
$ git pull
-$ git stash apply
+$ git stash pop
----------------------------------------------------------------
Interrupted workflow::
@@ -192,7 +194,7 @@ You can use 'git-stash' to simplify the above, like this:
$ git stash
$ edit emergency fix
$ git commit -a -m "Fix in a hurry"
-$ git stash apply
+$ git stash pop
# ... continue hacking ...
----------------------------------------------------------------
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index 1c40894669..74be8435cc 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -615,7 +615,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.
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 9d8f236fe8..3589a12e49 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -227,6 +227,8 @@ The link:user-manual.html#git-concepts[git concepts chapter of the
user-manual] and linkgit:gitcore-tutorial[7] both provide
introductions to the underlying git architecture.
+See linkgit:gitworkflows[7] for an overview of recommended workflows.
+
See also the link:howto-index.html[howto] documents for some useful
examples.
@@ -644,7 +646,8 @@ SEE ALSO
linkgit:gittutorial[7], linkgit:gittutorial-2[7],
link:everyday.html[Everyday Git], linkgit:gitcvs-migration[7],
linkgit:gitglossary[7], linkgit:gitcore-tutorial[7],
-linkgit:gitcli[7], link:user-manual.html[The Git User's Manual]
+linkgit:gitcli[7], link:user-manual.html[The Git User's Manual],
+linkgit:gitworkflows[7]
GIT
---
diff --git a/Documentation/gittutorial.txt b/Documentation/gittutorial.txt
index c5d5596d89..c7fa949c28 100644
--- a/Documentation/gittutorial.txt
+++ b/Documentation/gittutorial.txt
@@ -650,6 +650,9 @@ digressions that may be interesting at this point are:
smart enough to perform a close-to-optimal search even in the
case of complex non-linear history with lots of merged branches.
+ * linkgit:gitworkflows[7]: Gives an overview of recommended
+ workflows.
+
* link:everyday.html[Everyday GIT with 20 Commands Or So]
* linkgit:gitcvs-migration[7]: Git for CVS users.
@@ -661,6 +664,7 @@ linkgit:gitcvs-migration[7],
linkgit:gitcore-tutorial[7],
linkgit:gitglossary[7],
linkgit:git-help[1],
+linkgit:gitworkflows[7],
link:everyday.html[Everyday git],
link:user-manual.html[The Git User's Manual]
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index dbbeb7e7c7..0b88a51d0b 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -1520,10 +1520,10 @@ $ git commit -a -m "blorpl: typofix"
------------------------------------------------
After that, you can go back to what you were working on with
-`git stash apply`:
+`git stash pop`:
------------------------------------------------
-$ git stash apply
+$ git stash pop
------------------------------------------------
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index d292e3a2d3..0673f0db9f 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v1.6.3.1
+DEF_VER=v1.6.3.2
LF='
'
diff --git a/attr.c b/attr.c
index 98eb636f13..f8f6faa94f 100644
--- a/attr.c
+++ b/attr.c
@@ -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++;
diff --git a/base85.c b/base85.c
index b88270f908..b417a15bbc 100644
--- a/base85.c
+++ b/base85.c
@@ -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;
diff --git a/builtin-apply.c b/builtin-apply.c
index 8a3771e87e..a40b982242 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -3315,6 +3315,10 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
argc = parse_options(argc, argv, builtin_apply_options,
apply_usage, 0);
+ fake_ancestor = parse_options_fix_filename(prefix, fake_ancestor);
+ if (fake_ancestor)
+ fake_ancestor = xstrdup(fake_ancestor);
+
if (apply_with_reject)
apply = apply_verbosely = 1;
if (!force_apply && (diffstat || numstat || summary || check || fake_ancestor))
diff --git a/builtin-blame.c b/builtin-blame.c
index cf74a92614..0afdb16cb0 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -362,18 +362,28 @@ static struct origin *find_origin(struct scoreboard *sb,
"", &diff_opts);
diffcore_std(&diff_opts);
- /* It is either one entry that says "modified", or "created",
- * or nothing.
- */
if (!diff_queued_diff.nr) {
/* The path is the same as parent */
porigin = get_origin(sb, parent, origin->path);
hashcpy(porigin->blob_sha1, origin->blob_sha1);
- }
- else if (diff_queued_diff.nr != 1)
- die("internal error in blame::find_origin");
- else {
- struct diff_filepair *p = diff_queued_diff.queue[0];
+ } else {
+ /*
+ * Since origin->path is a pathspec, if the parent
+ * commit had it as a directory, we will see a whole
+ * bunch of deletion of files in the directory that we
+ * do not care about.
+ */
+ int i;
+ struct diff_filepair *p = NULL;
+ for (i = 0; i < diff_queued_diff.nr; i++) {
+ const char *name;
+ p = diff_queued_diff.queue[i];
+ name = p->one->path ? p->one->path : p->two->path;
+ if (!strcmp(name, origin->path))
+ break;
+ }
+ if (!p)
+ die("internal error in blame::find_origin");
switch (p->status) {
default:
die("internal error in blame::find_origin (%c)",
diff --git a/builtin-commit.c b/builtin-commit.c
index 81371b1d26..baaa75cf90 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -699,7 +699,11 @@ static int parse_and_validate_options(int argc, const char *argv[],
argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
logfile = parse_options_fix_filename(prefix, logfile);
+ if (logfile)
+ logfile = xstrdup(logfile);
template_file = parse_options_fix_filename(prefix, template_file);
+ if (template_file)
+ template_file = xstrdup(template_file);
if (force_author && !strchr(force_author, '>'))
force_author = find_author_by_nickname(force_author);
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 6202462216..629735f547 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -483,7 +483,9 @@ static int sideband_demux(int fd, void *data)
{
int *xd = data;
- return recv_sideband("fetch-pack", xd[0], fd);
+ int ret = recv_sideband("fetch-pack", xd[0], fd);
+ close(fd);
+ return ret;
}
static int get_pack(int xd[2], char **pack_lockfile)
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index a7883690d7..fae1482ba9 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -363,6 +363,7 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, options, fmt_merge_msg_usage, 0);
if (argc > 0)
usage_with_options(fmt_merge_msg_usage, options);
+ inpath = parse_options_fix_filename(prefix, inpath);
if (inpath && strcmp(inpath, "-")) {
in = fopen(inpath, "r");
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 9742b45c4d..941cc2d73c 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -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;
diff --git a/builtin-remote.c b/builtin-remote.c
index fda9a54a0c..d436412d9b 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1003,9 +1003,12 @@ static int show(int argc, const char **argv)
get_remote_ref_states(*argv, &states, query_flag);
- printf("* remote %s\n URL: %s\n", *argv,
- states.remote->url_nr > 0 ?
- states.remote->url[0] : "(no URL)");
+ 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)");
if (no_query)
printf(" HEAD branch: (not queried)\n");
else if (!states.heads.nr)
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index 9a773239ca..8e831be476 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -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;
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index 0206b416cb..c4cd1e1327 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -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)
diff --git a/configure.ac b/configure.ac
index 4e728bca35..25fbe3bb6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.
diff --git a/connect.c b/connect.c
index f6b8ba6fec..958c831e43 100644
--- a/connect.c
+++ b/connect.c
@@ -579,7 +579,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
git_tcp_connect(fd, host, flags);
/*
* Separate original protocol components prog and path
- * from extended components with a NUL byte.
+ * from extended host header with a NUL byte.
+ *
+ * Note: Do not add any other headers here! Doing so
+ * will cause older git-daemon servers to crash.
*/
packet_write(fd[1],
"%s %s%chost=%s%c",
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 6309d146e7..78e40d2a13 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -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";
diff --git a/daemon.c b/daemon.c
index daa4c8e8c9..b2babcc076 100644
--- a/daemon.c
+++ b/daemon.c
@@ -406,15 +406,15 @@ static char *xstrdup_tolower(const char *str)
}
/*
- * Separate the "extra args" information as supplied by the client connection.
+ * Read the host as supplied by the client connection.
*/
-static void parse_extra_args(char *extra_args, int buflen)
+static void parse_host_arg(char *extra_args, int buflen)
{
char *val;
int vallen;
char *end = extra_args + buflen;
- while (extra_args < end && *extra_args) {
+ if (extra_args < end && *extra_args) {
saw_extended_args = 1;
if (strncasecmp("host=", extra_args, 5) == 0) {
val = extra_args + 5;
@@ -436,6 +436,8 @@ static void parse_extra_args(char *extra_args, int buflen)
/* On to the next one */
extra_args = val + vallen;
}
+ if (extra_args < end && *extra_args)
+ die("Invalid request");
}
/*
@@ -545,7 +547,7 @@ static int execute(struct sockaddr *addr)
hostname = canon_hostname = ip_address = tcp_port = NULL;
if (len != pktlen)
- parse_extra_args(line + len + 1, pktlen - len - 1);
+ parse_host_arg(line + len + 1, pktlen - len - 1);
for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
struct daemon_service *s = &(daemon_service[i]);
diff --git a/delta.h b/delta.h
index 40ccf5a1e9..b9d333dd5a 100644
--- a/delta.h
+++ b/delta.h
@@ -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;
diff --git a/diff.c b/diff.c
index d24bff1e46..f0b580c150 100644
--- a/diff.c
+++ b/diff.c
@@ -3590,6 +3590,7 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
if (start_command(&child) != 0 ||
strbuf_read(&buf, child.out, 0) < 0 ||
finish_command(&child) != 0) {
+ strbuf_release(&buf);
remove_tempfile();
error("error running textconv command '%s'", pgm);
return NULL;
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index f6e536ece3..df9f231635 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -767,6 +767,96 @@ sub split_hunk {
return @split;
}
+sub find_last_o_ctx {
+ my ($it) = @_;
+ my $text = $it->{TEXT};
+ my ($o_ofs, $o_cnt) = parse_hunk_header($text->[0]);
+ my $i = @{$text};
+ my $last_o_ctx = $o_ofs + $o_cnt;
+ while (0 < --$i) {
+ my $line = $text->[$i];
+ if ($line =~ /^ /) {
+ $last_o_ctx--;
+ next;
+ }
+ last;
+ }
+ return $last_o_ctx;
+}
+
+sub merge_hunk {
+ my ($prev, $this) = @_;
+ my ($o0_ofs, $o0_cnt, $n0_ofs, $n0_cnt) =
+ parse_hunk_header($prev->{TEXT}[0]);
+ my ($o1_ofs, $o1_cnt, $n1_ofs, $n1_cnt) =
+ parse_hunk_header($this->{TEXT}[0]);
+
+ my (@line, $i, $ofs, $o_cnt, $n_cnt);
+ $ofs = $o0_ofs;
+ $o_cnt = $n_cnt = 0;
+ for ($i = 1; $i < @{$prev->{TEXT}}; $i++) {
+ my $line = $prev->{TEXT}[$i];
+ if ($line =~ /^\+/) {
+ $n_cnt++;
+ push @line, $line;
+ next;
+ }
+
+ last if ($o1_ofs <= $ofs);
+
+ $o_cnt++;
+ $ofs++;
+ if ($line =~ /^ /) {
+ $n_cnt++;
+ }
+ push @line, $line;
+ }
+
+ for ($i = 1; $i < @{$this->{TEXT}}; $i++) {
+ my $line = $this->{TEXT}[$i];
+ if ($line =~ /^\+/) {
+ $n_cnt++;
+ push @line, $line;
+ next;
+ }
+ $ofs++;
+ $o_cnt++;
+ if ($line =~ /^ /) {
+ $n_cnt++;
+ }
+ push @line, $line;
+ }
+ my $head = ("@@ -$o0_ofs" .
+ (($o_cnt != 1) ? ",$o_cnt" : '') .
+ " +$n0_ofs" .
+ (($n_cnt != 1) ? ",$n_cnt" : '') .
+ " @@\n");
+ @{$prev->{TEXT}} = ($head, @line);
+}
+
+sub coalesce_overlapping_hunks {
+ my (@in) = @_;
+ my @out = ();
+
+ my ($last_o_ctx, $last_was_dirty);
+
+ for (grep { $_->{USE} } @in) {
+ my $text = $_->{TEXT};
+ my ($o_ofs) = parse_hunk_header($text->[0]);
+ if (defined $last_o_ctx &&
+ $o_ofs <= $last_o_ctx &&
+ !$_->{DIRTY} &&
+ !$last_was_dirty) {
+ merge_hunk($out[-1], $_);
+ }
+ else {
+ push @out, $_;
+ }
+ $last_o_ctx = find_last_o_ctx($out[-1]);
+ $last_was_dirty = $_->{DIRTY};
+ }
+ return @out;
+}
sub color_diff {
return map {
@@ -878,7 +968,8 @@ sub edit_hunk_loop {
my $newhunk = {
TEXT => $text,
TYPE => $hunk->[$ix]->{TYPE},
- USE => 1
+ USE => 1,
+ DIRTY => 1,
};
if (diff_applies($head,
@{$hunk}[0..$ix-1],
@@ -1210,6 +1301,8 @@ sub patch_update_file {
}
}
+ @hunk = coalesce_overlapping_hunks(@hunk);
+
my $n_lofs = 0;
my @result = ();
for (@hunk) {
diff --git a/git-pull.sh b/git-pull.sh
index 35261539ab..cab367ada0 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -176,13 +176,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
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 314cd364b8..f96d887d23 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -420,7 +420,7 @@ do_next () {
NEWHEAD=$(git rev-parse HEAD) &&
case $HEADNAME in
refs/*)
- message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)" &&
+ message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO" &&
git update-ref -m "$message" $HEADNAME $NEWHEAD $OLDHEAD &&
git symbolic-ref HEAD $HEADNAME
;;
diff --git a/git-rebase.sh b/git-rebase.sh
index b83fd3f970..334629fc97 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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
diff --git a/grep.c b/grep.c
index a649f063cf..92a47c71e7 100644
--- a/grep.c
+++ b/grep.c
@@ -331,7 +331,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
if (hit && p->word_regexp) {
if ((pmatch[0].rm_so < 0) ||
- (eol - bol) <= pmatch[0].rm_so ||
+ (eol - bol) < pmatch[0].rm_so ||
(pmatch[0].rm_eo < 0) ||
(eol - bol) < pmatch[0].rm_eo)
die("regexp returned nonsense");
@@ -350,6 +350,10 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
else
hit = 0;
+ /* Words consist of at least one character. */
+ if (pmatch->rm_so == pmatch->rm_eo)
+ hit = 0;
+
if (!hit && pmatch[0].rm_so + bol + 1 < eol) {
/* There could be more than one match on the
* line, and the first match might not be
@@ -360,6 +364,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol,
bol = pmatch[0].rm_so + bol + 1;
while (word_char(bol[-1]) && bol < eol)
bol++;
+ eflags |= REG_NOTBOL;
if (bol < eol)
goto again;
}
@@ -499,6 +504,8 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
*eol = '\0';
while (next_match(opt, bol, eol, ctx, &match, eflags)) {
+ if (match.rm_so == match.rm_eo)
+ break;
printf("%.*s%s%.*s%s",
(int)match.rm_so, bol,
opt->color_match,
diff --git a/http.c b/http.c
index 2e3d6493ef..b5323a68b7 100644
--- a/http.c
+++ b/http.c
@@ -14,7 +14,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
@@ -119,7 +119,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
@@ -189,7 +189,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
@@ -303,7 +303,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
diff --git a/index-pack.c b/index-pack.c
index 6e93ee6af6..0c92bafcbb 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -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;
diff --git a/ll-merge.c b/ll-merge.c
index 81c02ad053..f7c2bc9278 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -238,7 +238,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;
}
@@ -272,7 +272,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;
}
@@ -295,14 +295,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;
}
diff --git a/patch-delta.c b/patch-delta.c
index ed9db81fa8..ef748ce96d 100644
--- a/patch-delta.c
+++ b/patch-delta.c
@@ -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);
diff --git a/sha1_file.c b/sha1_file.c
index e73cd4fc0b..8f5fe62d54 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -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++];
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index 9aaeabd972..e51e505a9f 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -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' '
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index dfc65601aa..fd2a55a5c2 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -165,4 +165,42 @@ test_expect_success FILEMODE 'stage mode but not hunk' '
# end of tests disabled when filemode is not usable
+test_expect_success 'setup again' '
+ git reset --hard &&
+ test_chmod +x file &&
+ echo content >>file
+'
+
+# Write the patch file with a new line at the top and bottom
+cat >patch <<EOF
+index 180b47c..b6f2c08 100644
+--- a/file
++++ b/file
+@@ -1,2 +1,4 @@
++firstline
+ baseline
+ content
++lastline
+EOF
+# Expected output, similar to the patch but w/ diff at the top
+cat >expected <<EOF
+diff --git a/file b/file
+index b6f2c08..61b9053 100755
+--- a/file
++++ b/file
+@@ -1,2 +1,4 @@
++firstline
+ baseline
+ content
++lastline
+EOF
+# Test splitting the first patch, then adding both
+test_expect_success 'add first line works' '
+ git commit -am "clear local changes" &&
+ git apply patch &&
+ (echo s; echo y; echo y) | git add -p file &&
+ git diff --cached > diff &&
+ test_cmp expected diff
+'
+
test_done
diff --git a/t/t4131-apply-fake-ancestor.sh b/t/t4131-apply-fake-ancestor.sh
new file mode 100755
index 0000000000..94373ca9a0
--- /dev/null
+++ b/t/t4131-apply-fake-ancestor.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Stephen Boyd
+#
+
+test_description='git apply --build-fake-ancestor handling.'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit 1 &&
+ test_commit 2 &&
+ mkdir sub &&
+ test_commit 3 sub/3 &&
+ test_commit 4
+'
+
+test_expect_success 'apply --build-fake-ancestor' '
+ git checkout 2 &&
+ echo "A" > 1.t &&
+ git diff > 1.patch &&
+ git reset --hard &&
+ git checkout 1 &&
+ git apply --build-fake-ancestor 1.ancestor 1.patch
+'
+
+test_expect_success 'apply --build-fake-ancestor in a subdirectory' '
+ git checkout 3 &&
+ echo "C" > sub/3.t &&
+ git diff > 3.patch &&
+ git reset --hard &&
+ git checkout 4 &&
+ (
+ cd sub &&
+ git apply --build-fake-ancestor 3.ancestor ../3.patch &&
+ test -f 3.ancestor
+ ) &&
+ git apply --build-fake-ancestor 3.ancestor 3.patch &&
+ test_cmp sub/3.ancestor 3.ancestor
+'
+
+test_done
diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index f8942bc890..7dcf391914 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -54,6 +54,12 @@ deduxit me super semitas jusitiae,
EOF
printf "propter nomen suum." >> new4.txt
+test_expect_success 'merge with no changes' '
+ cp orig.txt test.txt &&
+ git merge-file test.txt orig.txt orig.txt &&
+ test_cmp test.txt orig.txt
+'
+
cp new1.txt test.txt
test_expect_success "merge without conflict" \
"git merge-file test.txt orig.txt new2.txt"
diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh
index 2049ab6cf8..42f6fff373 100755
--- a/t/t6200-fmt-merge-msg.sh
+++ b/t/t6200-fmt-merge-msg.sh
@@ -208,4 +208,36 @@ test_expect_success 'merge-msg test #5-2' '
test_cmp expected actual
'
+test_expect_success 'merge-msg -F' '
+
+ git config --unset-all merge.log
+ git config --unset-all merge.summary
+ git config merge.summary yes &&
+
+ git checkout master &&
+ setdate &&
+ git fetch . left right &&
+
+ git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
+ test_cmp expected actual
+'
+
+test_expect_success 'merge-msg -F in subdirectory' '
+
+ git config --unset-all merge.log
+ git config --unset-all merge.summary
+ git config merge.summary yes &&
+
+ git checkout master &&
+ setdate &&
+ git fetch . left right &&
+ mkdir sub &&
+ cp .git/FETCH_HEAD sub/FETCH_HEAD &&
+ (
+ cd sub &&
+ git fmt-merge-msg -F FETCH_HEAD >../actual
+ ) &&
+ test_cmp expected actual
+'
+
test_done
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index b81593780a..f275af8240 100755
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
@@ -16,12 +16,13 @@ test_expect_success setup '
echo foo mmap bar_mmap
echo foo_mmap bar mmap baz
} >file &&
+ echo ww w >w &&
echo x x xx x >x &&
echo y yy >y &&
echo zzz > z &&
mkdir t &&
echo test >t/t &&
- git add file x y z t/t &&
+ git add file w x y z t/t &&
test_tick &&
git commit -m initial
'
@@ -48,6 +49,12 @@ do
diff expected actual
'
+ test_expect_success "grep -w $L (w)" '
+ : >expected &&
+ ! git grep -n -w -e "^w" >actual &&
+ test_cmp expected actual
+ '
+
test_expect_success "grep -w $L (x)" '
{
echo ${HC}x:1:x x xx x
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 5998baf27b..8eec0fa9bc 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -183,4 +183,14 @@ test_expect_success 'commit message from stdin' '
commit_msg_is "Log with foo word"
'
+test_expect_success 'commit -F overrides -t' '
+ (
+ cd subdir &&
+ echo "-F log" > f.log &&
+ echo "-t template" > t.template &&
+ git commit --allow-empty -F f.log -t t.template
+ ) &&
+ commit_msg_is "-F log"
+'
+
test_done
diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh
index 966bb0a61a..13c25f1d52 100755
--- a/t/t8003-blame.sh
+++ b/t/t8003-blame.sh
@@ -129,4 +129,19 @@ test_expect_success 'blame wholesale copy and more' '
'
+test_expect_success 'blame path that used to be a directory' '
+ mkdir path &&
+ echo A A A A A >path/file &&
+ echo B B B B B >path/elif &&
+ git add path &&
+ test_tick &&
+ git commit -m "path was a directory" &&
+ rm -fr path &&
+ echo A A A A A >path &&
+ git add path &&
+ test_tick &&
+ git commit -m "path is a regular file" &&
+ git blame HEAD^.. -- path
+'
+
test_done
diff --git a/userdiff.c b/userdiff.c
index d556da9751..57529ae63d 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -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].*)$",
/* -- */
diff --git a/ws.c b/ws.c
index b1efcd9d75..819c797cf6 100644
--- a/ws.c
+++ b/ws.c
@@ -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) */
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index d9737f04c2..1cb65a9516 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -563,23 +563,22 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
return -1;
}
status = 0;
- if (xscr1 || xscr2) {
- if (!xscr1) {
- result->ptr = xdl_malloc(mf2->size);
- memcpy(result->ptr, mf2->ptr, mf2->size);
- result->size = mf2->size;
- } else if (!xscr2) {
- result->ptr = xdl_malloc(mf1->size);
- memcpy(result->ptr, mf1->ptr, mf1->size);
- result->size = mf1->size;
- } else {
- status = xdl_do_merge(&xe1, xscr1, name1,
- &xe2, xscr2, name2,
- flags, xpp, result);
- }
- xdl_free_script(xscr1);
- xdl_free_script(xscr2);
+ if (!xscr1) {
+ result->ptr = xdl_malloc(mf2->size);
+ memcpy(result->ptr, mf2->ptr, mf2->size);
+ result->size = mf2->size;
+ } else if (!xscr2) {
+ result->ptr = xdl_malloc(mf1->size);
+ memcpy(result->ptr, mf1->ptr, mf1->size);
+ result->size = mf1->size;
+ } else {
+ status = xdl_do_merge(&xe1, xscr1, name1,
+ &xe2, xscr2, name2,
+ flags, xpp, result);
}
+ xdl_free_script(xscr1);
+ xdl_free_script(xscr2);
+
xdl_free_env(&xe1);
xdl_free_env(&xe2);