Skip to content

Commit 433e972

Browse files
committed
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
2 parents a5adcbe + a9b2d42 commit 433e972

File tree

7 files changed

+82
-39
lines changed

7 files changed

+82
-39
lines changed

Documentation/RelNotes-1.6.3.2.txt

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,56 @@ Fixes since v1.6.3.1
88
casting the (char *) pointer to (int *); GCC 4.4 did not like this,
99
and aborted compilation.
1010

11-
* http-push had a small use-after-free bug.
12-
13-
* command completion code in bash did not reliably detect that we are
14-
in a bare repository.
15-
16-
* "git for-each-ref" had a segfaulting bug when dealing with a tag object
17-
created by an ancient git.
18-
1911
* Some unlink(2) failures went undiagnosed.
2012

2113
* The "recursive" merge strategy misbehaved when faced rename/delete
2214
conflicts while coming up with an intermediate merge base.
2315

16+
* The low-level merge algorithm did not handle a degenerate case of
17+
merging a file with itself using itself as the common ancestor
18+
gracefully. It should produce the file itself, but instead
19+
produced an empty result.
20+
2421
* GIT_TRACE mechanism segfaulted when tracing a shell-quoted aliases.
2522

23+
* OpenBSD also uses st_ctimspec in "struct stat", instead of "st_ctim".
24+
25+
* With NO_CROSS_DIRECTORY_HARDLINKS, "make install" can be told not to
26+
create hardlinks between $(gitexecdir)/git-$builtin_commands and
27+
$(bindir)/git.
28+
29+
* command completion code in bash did not reliably detect that we are
30+
in a bare repository.
31+
2632
* "git add ." in an empty directory complained that pathspec "." did not
2733
match anything, which may be technically correct, but not useful. We
2834
silently make it a no-op now.
2935

36+
* "git add -p" (and "patch" action in "git add -i") was broken when
37+
the first hunk that adds a line at the top was split into two and
38+
both halves are marked to be used.
39+
40+
* "git for-each-ref" had a segfaulting bug when dealing with a tag object
41+
created by an ancient git.
42+
3043
* "git format-patch -k" still added patch numbers if format.numbered
3144
configuration was set.
3245

33-
* OpenBSD also uses st_ctimspec in "struct stat", instead of "st_ctim".
46+
* "git grep --color ''" did not terminate.
3447

35-
* With NO_CROSS_DIRECTORY_HARDLINKS, "make install" can be told not to
36-
create hardlinks between $(gitexecdir)/git-$builtin_commands and
37-
$(bindir)/git.
48+
* http-push had a small use-after-free bug.
3849

3950
* "git push" was converting OFS_DELTA pack representation into less
4051
efficient REF_DELTA representation unconditionally upon transfer,
4152
making the transferred data unnecessarily larger.
4253

54+
* "git remote show origin" segfaulted when origin was still empty.
55+
4356
Many other general usability updates around help text, diagnostic messages
4457
and documentation are included as well.
4558

4659
---
4760
exec >/var/tmp/1
48-
O=v1.6.3.1-51-g2a1feb9
61+
O=v1.6.3.1-68-g456cb4c
4962
echo O=$(git describe maint)
5063
git shortlog --no-merges $O..maint
51-

builtin-blame.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,18 +362,28 @@ static struct origin *find_origin(struct scoreboard *sb,
362362
"", &diff_opts);
363363
diffcore_std(&diff_opts);
364364

365-
/* It is either one entry that says "modified", or "created",
366-
* or nothing.
367-
*/
368365
if (!diff_queued_diff.nr) {
369366
/* The path is the same as parent */
370367
porigin = get_origin(sb, parent, origin->path);
371368
hashcpy(porigin->blob_sha1, origin->blob_sha1);
372-
}
373-
else if (diff_queued_diff.nr != 1)
374-
die("internal error in blame::find_origin");
375-
else {
376-
struct diff_filepair *p = diff_queued_diff.queue[0];
369+
} else {
370+
/*
371+
* Since origin->path is a pathspec, if the parent
372+
* commit had it as a directory, we will see a whole
373+
* bunch of deletion of files in the directory that we
374+
* do not care about.
375+
*/
376+
int i;
377+
struct diff_filepair *p = NULL;
378+
for (i = 0; i < diff_queued_diff.nr; i++) {
379+
const char *name;
380+
p = diff_queued_diff.queue[i];
381+
name = p->one->path ? p->one->path : p->two->path;
382+
if (!strcmp(name, origin->path))
383+
break;
384+
}
385+
if (!p)
386+
die("internal error in blame::find_origin");
377387
switch (p->status) {
378388
default:
379389
die("internal error in blame::find_origin (%c)",

git-add--interactive.perl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,6 @@ sub patch_update_file {
13171317
open $fh, '| git apply --cached --recount';
13181318
for (@{$head->{TEXT}}, @result) {
13191319
print $fh $_;
1320-
print STDERR $_;
13211320
}
13221321
if (!close $fh) {
13231322
for (@{$head->{TEXT}}, @result) {

grep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,8 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
500500

501501
*eol = '\0';
502502
while (next_match(opt, bol, eol, ctx, &match, eflags)) {
503+
if (match.rm_so == match.rm_eo)
504+
break;
503505
printf("%.*s%s%.*s%s",
504506
(int)match.rm_so, bol,
505507
opt->color_match,

t/t6023-merge-file.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ deduxit me super semitas jusitiae,
5454
EOF
5555
printf "propter nomen suum." >> new4.txt
5656

57+
test_expect_success 'merge with no changes' '
58+
cp orig.txt test.txt &&
59+
git merge-file test.txt orig.txt orig.txt &&
60+
test_cmp test.txt orig.txt
61+
'
62+
5763
cp new1.txt test.txt
5864
test_expect_success "merge without conflict" \
5965
"git merge-file test.txt orig.txt new2.txt"

t/t8003-blame.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,19 @@ test_expect_success 'blame wholesale copy and more' '
129129
130130
'
131131

132+
test_expect_success 'blame path that used to be a directory' '
133+
mkdir path &&
134+
echo A A A A A >path/file &&
135+
echo B B B B B >path/elif &&
136+
git add path &&
137+
test_tick &&
138+
git commit -m "path was a directory" &&
139+
rm -fr path &&
140+
echo A A A A A >path &&
141+
git add path &&
142+
test_tick &&
143+
git commit -m "path is a regular file" &&
144+
git blame HEAD^.. -- path
145+
'
146+
132147
test_done

xdiff/xmerge.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -563,23 +563,22 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
563563
return -1;
564564
}
565565
status = 0;
566-
if (xscr1 || xscr2) {
567-
if (!xscr1) {
568-
result->ptr = xdl_malloc(mf2->size);
569-
memcpy(result->ptr, mf2->ptr, mf2->size);
570-
result->size = mf2->size;
571-
} else if (!xscr2) {
572-
result->ptr = xdl_malloc(mf1->size);
573-
memcpy(result->ptr, mf1->ptr, mf1->size);
574-
result->size = mf1->size;
575-
} else {
576-
status = xdl_do_merge(&xe1, xscr1, name1,
577-
&xe2, xscr2, name2,
578-
flags, xpp, result);
579-
}
580-
xdl_free_script(xscr1);
581-
xdl_free_script(xscr2);
566+
if (!xscr1) {
567+
result->ptr = xdl_malloc(mf2->size);
568+
memcpy(result->ptr, mf2->ptr, mf2->size);
569+
result->size = mf2->size;
570+
} else if (!xscr2) {
571+
result->ptr = xdl_malloc(mf1->size);
572+
memcpy(result->ptr, mf1->ptr, mf1->size);
573+
result->size = mf1->size;
574+
} else {
575+
status = xdl_do_merge(&xe1, xscr1, name1,
576+
&xe2, xscr2, name2,
577+
flags, xpp, result);
582578
}
579+
xdl_free_script(xscr1);
580+
xdl_free_script(xscr2);
581+
583582
xdl_free_env(&xe1);
584583
xdl_free_env(&xe2);
585584

0 commit comments

Comments
 (0)