aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-03 00:49:40 -0700
committerJunio C Hamano <gitster@pobox.com>2009-06-03 00:49:40 -0700
commit433e972aeb5e485d2f7a7ac605a1c043822e25d9 (patch)
tree53d39fd7fdbd01c870d08937e805849dd4d6c404
parenta5adcbe377de7c8f5d794fce1fe2b23a0bddf758 (diff)
parenta9b2d42486ee0b461220bf3895114926d9ddf9be (diff)
downloadgit-433e972aeb5e485d2f7a7ac605a1c043822e25d9.tar.gz
git-433e972aeb5e485d2f7a7ac605a1c043822e25d9.tar.xz
Merge branch 'maint'
* maint: blame: correctly handle a path that used to be a directory add -i: do not dump patch during application Update draft release notes for 1.6.3.2 grep: fix colouring of matches with zero length Documentation: teach stash/pop workflow instead of stash/apply Change xdl_merge to generate output even for null merges t6023: merge-file fails to output anything for a degenerate merge
-rw-r--r--Documentation/RelNotes-1.6.3.2.txt40
-rw-r--r--builtin-blame.c26
-rwxr-xr-xgit-add--interactive.perl1
-rw-r--r--grep.c2
-rwxr-xr-xt/t6023-merge-file.sh6
-rwxr-xr-xt/t8003-blame.sh15
-rw-r--r--xdiff/xmerge.c31
7 files changed, 82 insertions, 39 deletions
diff --git a/Documentation/RelNotes-1.6.3.2.txt b/Documentation/RelNotes-1.6.3.2.txt
index a3fceebb1..0b48d1a1d 100644
--- a/Documentation/RelNotes-1.6.3.2.txt
+++ b/Documentation/RelNotes-1.6.3.2.txt
@@ -8,44 +8,56 @@ 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 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.
- * 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
+O=v1.6.3.1-68-g456cb4c
echo O=$(git describe maint)
git shortlog --no-merges $O..maint
-
diff --git a/builtin-blame.c b/builtin-blame.c
index 9dc333591..0c2d29a43 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/git-add--interactive.perl b/git-add--interactive.perl
index a06172c69..df9f23163 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1317,7 +1317,6 @@ sub patch_update_file {
open $fh, '| git apply --cached --recount';
for (@{$head->{TEXT}}, @result) {
print $fh $_;
- print STDERR $_;
}
if (!close $fh) {
for (@{$head->{TEXT}}, @result) {
diff --git a/grep.c b/grep.c
index cc6d5b04c..7bf4a60ac 100644
--- a/grep.c
+++ b/grep.c
@@ -500,6 +500,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/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index f8942bc89..7dcf39191 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/t8003-blame.sh b/t/t8003-blame.sh
index 966bb0a61..13c25f1d5 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/xdiff/xmerge.c b/xdiff/xmerge.c
index d9737f04c..1cb65a951 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);