Merge branch 'maint'
* maint: t1010-mktree: Adjust expected result to code and documentation combined diff: correctly handle truncated file Document new "already-merged" rule for branch -d
This commit is contained in:
commit
f3bd6ab7ea
@ -63,7 +63,9 @@ way to clean up all obsolete remote-tracking branches.
|
|||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
-d::
|
-d::
|
||||||
Delete a branch. The branch must be fully merged in HEAD.
|
Delete a branch. The branch must be fully merged in its
|
||||||
|
upstream branch, or in `HEAD` if no upstream was set with
|
||||||
|
`--track` or `--set-upstream`.
|
||||||
|
|
||||||
-D::
|
-D::
|
||||||
Delete a branch irrespective of its merged status.
|
Delete a branch irrespective of its merged status.
|
||||||
|
@ -204,7 +204,7 @@ static void consume_line(void *state_, char *line, unsigned long len)
|
|||||||
static void combine_diff(const unsigned char *parent, unsigned int mode,
|
static void combine_diff(const unsigned char *parent, unsigned int mode,
|
||||||
mmfile_t *result_file,
|
mmfile_t *result_file,
|
||||||
struct sline *sline, unsigned int cnt, int n,
|
struct sline *sline, unsigned int cnt, int n,
|
||||||
int num_parent)
|
int num_parent, int result_deleted)
|
||||||
{
|
{
|
||||||
unsigned int p_lno, lno;
|
unsigned int p_lno, lno;
|
||||||
unsigned long nmask = (1UL << n);
|
unsigned long nmask = (1UL << n);
|
||||||
@ -215,7 +215,7 @@ static void combine_diff(const unsigned char *parent, unsigned int mode,
|
|||||||
struct combine_diff_state state;
|
struct combine_diff_state state;
|
||||||
unsigned long sz;
|
unsigned long sz;
|
||||||
|
|
||||||
if (!cnt)
|
if (result_deleted)
|
||||||
return; /* result deleted */
|
return; /* result deleted */
|
||||||
|
|
||||||
parent_file.ptr = grab_blob(parent, mode, &sz);
|
parent_file.ptr = grab_blob(parent, mode, &sz);
|
||||||
@ -517,7 +517,7 @@ static void show_line_to_eol(const char *line, int len, const char *reset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
||||||
int use_color)
|
int use_color, int result_deleted)
|
||||||
{
|
{
|
||||||
unsigned long mark = (1UL<<num_parent);
|
unsigned long mark = (1UL<<num_parent);
|
||||||
unsigned long no_pre_delete = (2UL<<num_parent);
|
unsigned long no_pre_delete = (2UL<<num_parent);
|
||||||
@ -530,7 +530,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
|||||||
const char *c_plain = diff_get_color(use_color, DIFF_PLAIN);
|
const char *c_plain = diff_get_color(use_color, DIFF_PLAIN);
|
||||||
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
|
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
|
||||||
|
|
||||||
if (!cnt)
|
if (result_deleted)
|
||||||
return; /* result deleted */
|
return; /* result deleted */
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -687,6 +687,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
{
|
{
|
||||||
struct diff_options *opt = &rev->diffopt;
|
struct diff_options *opt = &rev->diffopt;
|
||||||
unsigned long result_size, cnt, lno;
|
unsigned long result_size, cnt, lno;
|
||||||
|
int result_deleted = 0;
|
||||||
char *result, *cp;
|
char *result, *cp;
|
||||||
struct sline *sline; /* survived lines */
|
struct sline *sline; /* survived lines */
|
||||||
int mode_differs = 0;
|
int mode_differs = 0;
|
||||||
@ -767,6 +768,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deleted_file:
|
deleted_file:
|
||||||
|
result_deleted = 1;
|
||||||
result_size = 0;
|
result_size = 0;
|
||||||
elem->mode = 0;
|
elem->mode = 0;
|
||||||
result = xcalloc(1, 1);
|
result = xcalloc(1, 1);
|
||||||
@ -823,7 +825,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
combine_diff(elem->parent[i].sha1,
|
combine_diff(elem->parent[i].sha1,
|
||||||
elem->parent[i].mode,
|
elem->parent[i].mode,
|
||||||
&result_file, sline,
|
&result_file, sline,
|
||||||
cnt, i, num_parent);
|
cnt, i, num_parent, result_deleted);
|
||||||
if (elem->parent[i].mode != elem->mode)
|
if (elem->parent[i].mode != elem->mode)
|
||||||
mode_differs = 1;
|
mode_differs = 1;
|
||||||
}
|
}
|
||||||
@ -889,7 +891,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
dump_quoted_path("+++ ", b_prefix, elem->path,
|
dump_quoted_path("+++ ", b_prefix, elem->path,
|
||||||
c_meta, c_reset);
|
c_meta, c_reset);
|
||||||
dump_sline(sline, cnt, num_parent,
|
dump_sline(sline, cnt, num_parent,
|
||||||
DIFF_OPT_TST(opt, COLOR_DIFF));
|
DIFF_OPT_TST(opt, COLOR_DIFF), result_deleted);
|
||||||
}
|
}
|
||||||
free(result);
|
free(result);
|
||||||
|
|
||||||
|
@ -58,14 +58,12 @@ test_expect_success 'allow missing object with --missing' '
|
|||||||
test_cmp tree.missing actual
|
test_cmp tree.missing actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'mktree reads ls-tree -r output (1)' '
|
test_expect_success 'mktree refuses to read ls-tree -r output (1)' '
|
||||||
git mktree <all >actual &&
|
test_must_fail git mktree <all >actual
|
||||||
test_cmp tree actual
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'mktree reads ls-tree -r output (2)' '
|
test_expect_success 'mktree refuses to read ls-tree -r output (2)' '
|
||||||
git mktree <all.withsub >actual &&
|
test_must_fail git mktree <all.withsub >actual
|
||||||
test_cmp tree.withsub actual
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -81,4 +81,12 @@ test_expect_success 'check combined output (2)' '
|
|||||||
verify_helper sidesansone
|
verify_helper sidesansone
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'diagnose truncated file' '
|
||||||
|
>file &&
|
||||||
|
git add file &&
|
||||||
|
git commit --amend -C HEAD &&
|
||||||
|
git show >out &&
|
||||||
|
grep "diff --cc file" out
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user