Merge branch 'maint'
* maint: Start preparing 1.5.6.4 release notes git fetch-pack: do not complain about "no common commits" in an empty repo rebase-i: keep old parents when preserving merges t7600-merge: Use test_expect_failure to test option parsing Fix buffer overflow in prepare_attr_stack Fix buffer overflow in git diff Fix buffer overflow in git-grep git-cvsserver: fix call to nonexistant cleanupWorkDir() Documentation/git-cherry-pick.txt et al.: Fix misleading -n description Conflicts: RelNotes
This commit is contained in:
commit
88bbda08d7
43
Documentation/RelNotes-1.5.6.4.txt
Normal file
43
Documentation/RelNotes-1.5.6.4.txt
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
GIT v1.5.6.4 Release Notes
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Fixes since v1.5.6.3
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* Various commands could overflow its internal buffer on a platform
|
||||||
|
with small PATH_MAX value in a repository that has contents with
|
||||||
|
long pathnames.
|
||||||
|
|
||||||
|
* There wasn't a way to make --pretty=format:%<> specifiers to honor
|
||||||
|
.mailmap name rewriting for authors and committers. Now you can with
|
||||||
|
%aN and %cN.
|
||||||
|
|
||||||
|
* Bash completion wasted too many cycles; this has been optimized to be
|
||||||
|
usable again.
|
||||||
|
|
||||||
|
* Bash completion lost ref part when completing something like "git show
|
||||||
|
pu:Makefile".
|
||||||
|
|
||||||
|
* "git-cvsserver" did not clean up its temporary working area after annotate
|
||||||
|
request.
|
||||||
|
|
||||||
|
* "git-daemon" called syslog() from its signal handler, which was a
|
||||||
|
no-no.
|
||||||
|
|
||||||
|
* "git-fetch" into an empty repository used to remind that the fetch will
|
||||||
|
be huge by saying "no common commits", but this was an unnecessary
|
||||||
|
noise; it is already known by the user anyway.
|
||||||
|
|
||||||
|
* "git-mailinfo" (hence "git-am") did not correctly handle in-body [PATCH]
|
||||||
|
line to override the commit title taken from the mail Subject header.
|
||||||
|
|
||||||
|
* "git-rebase -i -p" lost parents that are not involved in the history
|
||||||
|
being rewritten.
|
||||||
|
|
||||||
|
Contains other various documentation fixes.
|
||||||
|
|
||||||
|
--
|
||||||
|
exec >/var/tmp/1
|
||||||
|
echo O=$(git describe maint)
|
||||||
|
O=v1.5.6.3-21-gebcce31
|
||||||
|
git shortlog --no-merges $O..maint
|
@ -58,14 +58,14 @@ OPTIONS
|
|||||||
Usually the command automatically creates a commit with
|
Usually the command automatically creates a commit with
|
||||||
a commit log message stating which commit was
|
a commit log message stating which commit was
|
||||||
cherry-picked. This flag applies the change necessary
|
cherry-picked. This flag applies the change necessary
|
||||||
to cherry-pick the named commit to your working tree,
|
to cherry-pick the named commit to your working tree
|
||||||
but does not make the commit. In addition, when this
|
and the index, but does not make the commit. In addition,
|
||||||
option is used, your working tree does not have to match
|
when this option is used, your index does not have to match
|
||||||
the HEAD commit. The cherry-pick is done against the
|
the HEAD commit. The cherry-pick is done against the
|
||||||
beginning state of your working tree.
|
beginning state of your index.
|
||||||
+
|
+
|
||||||
This is useful when cherry-picking more than one commits'
|
This is useful when cherry-picking more than one commits'
|
||||||
effect to your working tree in a row.
|
effect to your index in a row.
|
||||||
|
|
||||||
-s::
|
-s::
|
||||||
--signoff::
|
--signoff::
|
||||||
|
@ -43,16 +43,16 @@ OPTIONS
|
|||||||
-n::
|
-n::
|
||||||
--no-commit::
|
--no-commit::
|
||||||
Usually the command automatically creates a commit with
|
Usually the command automatically creates a commit with
|
||||||
a commit log message stating which commit was reverted.
|
a commit log message stating which commit was
|
||||||
This flag applies the change necessary to revert the
|
reverted. This flag applies the change necessary
|
||||||
named commit to your working tree, but does not make the
|
to revert the named commit to your working tree
|
||||||
commit. In addition, when this option is used, your
|
and the index, but does not make the commit. In addition,
|
||||||
working tree does not have to match the HEAD commit.
|
when this option is used, your index does not have to match
|
||||||
The revert is done against the beginning state of your
|
the HEAD commit. The revert is done against the
|
||||||
working tree.
|
beginning state of your index.
|
||||||
+
|
+
|
||||||
This is useful when reverting more than one commits'
|
This is useful when reverting more than one commits'
|
||||||
effect to your working tree in a row.
|
effect to your index in a row.
|
||||||
|
|
||||||
-s::
|
-s::
|
||||||
--signoff::
|
--signoff::
|
||||||
|
15
attr.c
15
attr.c
@ -459,7 +459,9 @@ static void prepare_attr_stack(const char *path, int dirlen)
|
|||||||
{
|
{
|
||||||
struct attr_stack *elem, *info;
|
struct attr_stack *elem, *info;
|
||||||
int len;
|
int len;
|
||||||
char pathbuf[PATH_MAX];
|
struct strbuf pathbuf;
|
||||||
|
|
||||||
|
strbuf_init(&pathbuf, dirlen+2+strlen(GITATTRIBUTES_FILE));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At the bottom of the attribute stack is the built-in
|
* At the bottom of the attribute stack is the built-in
|
||||||
@ -510,13 +512,14 @@ static void prepare_attr_stack(const char *path, int dirlen)
|
|||||||
len = strlen(attr_stack->origin);
|
len = strlen(attr_stack->origin);
|
||||||
if (dirlen <= len)
|
if (dirlen <= len)
|
||||||
break;
|
break;
|
||||||
memcpy(pathbuf, path, dirlen);
|
strbuf_reset(&pathbuf);
|
||||||
memcpy(pathbuf + dirlen, "/", 2);
|
strbuf_add(&pathbuf, path, dirlen);
|
||||||
cp = strchr(pathbuf + len + 1, '/');
|
strbuf_addch(&pathbuf, '/');
|
||||||
|
cp = strchr(pathbuf.buf + len + 1, '/');
|
||||||
strcpy(cp + 1, GITATTRIBUTES_FILE);
|
strcpy(cp + 1, GITATTRIBUTES_FILE);
|
||||||
elem = read_attr(pathbuf, 0);
|
elem = read_attr(pathbuf.buf, 0);
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
elem->origin = strdup(pathbuf);
|
elem->origin = strdup(pathbuf.buf);
|
||||||
elem->prev = attr_stack;
|
elem->prev = attr_stack;
|
||||||
attr_stack = elem;
|
attr_stack = elem;
|
||||||
debug_push(elem);
|
debug_push(elem);
|
||||||
|
@ -427,33 +427,35 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
|
|||||||
struct name_entry entry;
|
struct name_entry entry;
|
||||||
char *down;
|
char *down;
|
||||||
int tn_len = strlen(tree_name);
|
int tn_len = strlen(tree_name);
|
||||||
char *path_buf = xmalloc(PATH_MAX + tn_len + 100);
|
struct strbuf pathbuf;
|
||||||
|
|
||||||
|
strbuf_init(&pathbuf, PATH_MAX + tn_len);
|
||||||
|
|
||||||
if (tn_len) {
|
if (tn_len) {
|
||||||
tn_len = sprintf(path_buf, "%s:", tree_name);
|
strbuf_add(&pathbuf, tree_name, tn_len);
|
||||||
down = path_buf + tn_len;
|
strbuf_addch(&pathbuf, ':');
|
||||||
strcat(down, base);
|
tn_len = pathbuf.len;
|
||||||
}
|
}
|
||||||
else {
|
strbuf_addstr(&pathbuf, base);
|
||||||
down = path_buf;
|
len = pathbuf.len;
|
||||||
strcpy(down, base);
|
|
||||||
}
|
|
||||||
len = strlen(path_buf);
|
|
||||||
|
|
||||||
while (tree_entry(tree, &entry)) {
|
while (tree_entry(tree, &entry)) {
|
||||||
strcpy(path_buf + len, entry.path);
|
int te_len = tree_entry_len(entry.path, entry.sha1);
|
||||||
|
pathbuf.len = len;
|
||||||
|
strbuf_add(&pathbuf, entry.path, te_len);
|
||||||
|
|
||||||
if (S_ISDIR(entry.mode))
|
if (S_ISDIR(entry.mode))
|
||||||
/* Match "abc/" against pathspec to
|
/* Match "abc/" against pathspec to
|
||||||
* decide if we want to descend into "abc"
|
* decide if we want to descend into "abc"
|
||||||
* directory.
|
* directory.
|
||||||
*/
|
*/
|
||||||
strcpy(path_buf + len + tree_entry_len(entry.path, entry.sha1), "/");
|
strbuf_addch(&pathbuf, '/');
|
||||||
|
|
||||||
|
down = pathbuf.buf + tn_len;
|
||||||
if (!pathspec_matches(paths, down))
|
if (!pathspec_matches(paths, down))
|
||||||
;
|
;
|
||||||
else if (S_ISREG(entry.mode))
|
else if (S_ISREG(entry.mode))
|
||||||
hit |= grep_sha1(opt, entry.sha1, path_buf, tn_len);
|
hit |= grep_sha1(opt, entry.sha1, pathbuf.buf, tn_len);
|
||||||
else if (S_ISDIR(entry.mode)) {
|
else if (S_ISDIR(entry.mode)) {
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
struct tree_desc sub;
|
struct tree_desc sub;
|
||||||
@ -469,6 +471,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
|
|||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
strbuf_release(&pathbuf);
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
|||||||
if (silent_on_removed)
|
if (silent_on_removed)
|
||||||
continue;
|
continue;
|
||||||
diff_addremove(&revs->diffopt, '-', ce->ce_mode,
|
diff_addremove(&revs->diffopt, '-', ce->ce_mode,
|
||||||
ce->sha1, ce->name, NULL);
|
ce->sha1, ce->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
changed = ce_match_stat(ce, &st, ce_option);
|
changed = ce_match_stat(ce, &st, ce_option);
|
||||||
@ -184,7 +184,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
|||||||
newmode = ce_mode_from_stat(ce, st.st_mode);
|
newmode = ce_mode_from_stat(ce, st.st_mode);
|
||||||
diff_change(&revs->diffopt, oldmode, newmode,
|
diff_change(&revs->diffopt, oldmode, newmode,
|
||||||
ce->sha1, (changed ? null_sha1 : ce->sha1),
|
ce->sha1, (changed ? null_sha1 : ce->sha1),
|
||||||
ce->name, NULL);
|
ce->name);
|
||||||
|
|
||||||
}
|
}
|
||||||
diffcore_std(&revs->diffopt);
|
diffcore_std(&revs->diffopt);
|
||||||
@ -208,7 +208,7 @@ static void diff_index_show_file(struct rev_info *revs,
|
|||||||
const unsigned char *sha1, unsigned int mode)
|
const unsigned char *sha1, unsigned int mode)
|
||||||
{
|
{
|
||||||
diff_addremove(&revs->diffopt, prefix[0], mode,
|
diff_addremove(&revs->diffopt, prefix[0], mode,
|
||||||
sha1, ce->name, NULL);
|
sha1, ce->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_stat_data(struct cache_entry *ce,
|
static int get_stat_data(struct cache_entry *ce,
|
||||||
@ -312,7 +312,7 @@ static int show_modified(struct oneway_unpack_data *cbdata,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
diff_change(&revs->diffopt, oldmode, mode,
|
diff_change(&revs->diffopt, oldmode, mode,
|
||||||
old->sha1, sha1, old->name, NULL);
|
old->sha1, sha1, old->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
diff.c
11
diff.c
@ -3412,9 +3412,8 @@ int diff_result_code(struct diff_options *opt, int status)
|
|||||||
void diff_addremove(struct diff_options *options,
|
void diff_addremove(struct diff_options *options,
|
||||||
int addremove, unsigned mode,
|
int addremove, unsigned mode,
|
||||||
const unsigned char *sha1,
|
const unsigned char *sha1,
|
||||||
const char *base, const char *path)
|
const char *concatpath)
|
||||||
{
|
{
|
||||||
char concatpath[PATH_MAX];
|
|
||||||
struct diff_filespec *one, *two;
|
struct diff_filespec *one, *two;
|
||||||
|
|
||||||
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(mode))
|
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(mode))
|
||||||
@ -3436,9 +3435,6 @@ void diff_addremove(struct diff_options *options,
|
|||||||
addremove = (addremove == '+' ? '-' :
|
addremove = (addremove == '+' ? '-' :
|
||||||
addremove == '-' ? '+' : addremove);
|
addremove == '-' ? '+' : addremove);
|
||||||
|
|
||||||
if (!path) path = "";
|
|
||||||
sprintf(concatpath, "%s%s", base, path);
|
|
||||||
|
|
||||||
if (options->prefix &&
|
if (options->prefix &&
|
||||||
strncmp(concatpath, options->prefix, options->prefix_length))
|
strncmp(concatpath, options->prefix, options->prefix_length))
|
||||||
return;
|
return;
|
||||||
@ -3459,9 +3455,8 @@ void diff_change(struct diff_options *options,
|
|||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const unsigned char *old_sha1,
|
||||||
const unsigned char *new_sha1,
|
const unsigned char *new_sha1,
|
||||||
const char *base, const char *path)
|
const char *concatpath)
|
||||||
{
|
{
|
||||||
char concatpath[PATH_MAX];
|
|
||||||
struct diff_filespec *one, *two;
|
struct diff_filespec *one, *two;
|
||||||
|
|
||||||
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(old_mode)
|
if (DIFF_OPT_TST(options, IGNORE_SUBMODULES) && S_ISGITLINK(old_mode)
|
||||||
@ -3474,8 +3469,6 @@ void diff_change(struct diff_options *options,
|
|||||||
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
|
tmp = old_mode; old_mode = new_mode; new_mode = tmp;
|
||||||
tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c;
|
tmp_c = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_c;
|
||||||
}
|
}
|
||||||
if (!path) path = "";
|
|
||||||
sprintf(concatpath, "%s%s", base, path);
|
|
||||||
|
|
||||||
if (options->prefix &&
|
if (options->prefix &&
|
||||||
strncmp(concatpath, options->prefix, options->prefix_length))
|
strncmp(concatpath, options->prefix, options->prefix_length))
|
||||||
|
9
diff.h
9
diff.h
@ -14,12 +14,12 @@ typedef void (*change_fn_t)(struct diff_options *options,
|
|||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const unsigned char *old_sha1,
|
||||||
const unsigned char *new_sha1,
|
const unsigned char *new_sha1,
|
||||||
const char *base, const char *path);
|
const char *fullpath);
|
||||||
|
|
||||||
typedef void (*add_remove_fn_t)(struct diff_options *options,
|
typedef void (*add_remove_fn_t)(struct diff_options *options,
|
||||||
int addremove, unsigned mode,
|
int addremove, unsigned mode,
|
||||||
const unsigned char *sha1,
|
const unsigned char *sha1,
|
||||||
const char *base, const char *path);
|
const char *fullpath);
|
||||||
|
|
||||||
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
|
typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,
|
||||||
struct diff_options *options, void *data);
|
struct diff_options *options, void *data);
|
||||||
@ -164,14 +164,13 @@ extern void diff_addremove(struct diff_options *,
|
|||||||
int addremove,
|
int addremove,
|
||||||
unsigned mode,
|
unsigned mode,
|
||||||
const unsigned char *sha1,
|
const unsigned char *sha1,
|
||||||
const char *base,
|
const char *fullpath);
|
||||||
const char *path);
|
|
||||||
|
|
||||||
extern void diff_change(struct diff_options *,
|
extern void diff_change(struct diff_options *,
|
||||||
unsigned mode1, unsigned mode2,
|
unsigned mode1, unsigned mode2,
|
||||||
const unsigned char *sha1,
|
const unsigned char *sha1,
|
||||||
const unsigned char *sha2,
|
const unsigned char *sha2,
|
||||||
const char *base, const char *path);
|
const char *fullpath);
|
||||||
|
|
||||||
extern void diff_unmerge(struct diff_options *,
|
extern void diff_unmerge(struct diff_options *,
|
||||||
const char *path,
|
const char *path,
|
||||||
|
@ -1884,7 +1884,7 @@ sub req_annotate
|
|||||||
}
|
}
|
||||||
|
|
||||||
# done; get out of the tempdir
|
# done; get out of the tempdir
|
||||||
cleanupWorkDir();
|
cleanupWorkTree();
|
||||||
|
|
||||||
print "ok\n";
|
print "ok\n";
|
||||||
|
|
||||||
|
@ -174,6 +174,8 @@ pick_one_preserving_merges () {
|
|||||||
new_parents="$new_parents $new_p"
|
new_parents="$new_parents $new_p"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
new_parents="$new_parents $p"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
case $fast_forward in
|
case $fast_forward in
|
||||||
|
@ -260,7 +260,7 @@ static int tree_difference = REV_TREE_SAME;
|
|||||||
static void file_add_remove(struct diff_options *options,
|
static void file_add_remove(struct diff_options *options,
|
||||||
int addremove, unsigned mode,
|
int addremove, unsigned mode,
|
||||||
const unsigned char *sha1,
|
const unsigned char *sha1,
|
||||||
const char *base, const char *path)
|
const char *fullpath)
|
||||||
{
|
{
|
||||||
int diff = REV_TREE_DIFFERENT;
|
int diff = REV_TREE_DIFFERENT;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ static void file_change(struct diff_options *options,
|
|||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode, unsigned new_mode,
|
||||||
const unsigned char *old_sha1,
|
const unsigned char *old_sha1,
|
||||||
const unsigned char *new_sha1,
|
const unsigned char *new_sha1,
|
||||||
const char *base, const char *path)
|
const char *fullpath)
|
||||||
{
|
{
|
||||||
tree_difference = REV_TREE_DIFFERENT;
|
tree_difference = REV_TREE_DIFFERENT;
|
||||||
DIFF_OPT_SET(options, HAS_CHANGES);
|
DIFF_OPT_SET(options, HAS_CHANGES);
|
||||||
|
@ -221,37 +221,13 @@ test_expect_success 'setup' '
|
|||||||
|
|
||||||
test_debug 'gitk --all'
|
test_debug 'gitk --all'
|
||||||
|
|
||||||
test_expect_success 'test option parsing' '
|
test_expect_failure 'test option parsing' '
|
||||||
if git merge -$ c1
|
test_must_fail git merge -$ c1 &&
|
||||||
then
|
test_must_fail git merge --no-such c1 &&
|
||||||
echo "[OOPS] -$ accepted"
|
test_must_fail git merge -s foobar c1 &&
|
||||||
false
|
test_must_fail git merge -s=foobar c1 &&
|
||||||
fi &&
|
test_must_fail git merge -m &&
|
||||||
if git merge --no-such c1
|
test_must_fail git merge
|
||||||
then
|
|
||||||
echo "[OOPS] --no-such accepted"
|
|
||||||
false
|
|
||||||
fi &&
|
|
||||||
if git merge -s foobar c1
|
|
||||||
then
|
|
||||||
echo "[OOPS] -s foobar accepted"
|
|
||||||
false
|
|
||||||
fi &&
|
|
||||||
if git merge -s=foobar c1
|
|
||||||
then
|
|
||||||
echo "[OOPS] -s=foobar accepted"
|
|
||||||
false
|
|
||||||
fi &&
|
|
||||||
if git merge -m
|
|
||||||
then
|
|
||||||
echo "[OOPS] missing commit msg accepted"
|
|
||||||
false
|
|
||||||
fi &&
|
|
||||||
if git merge
|
|
||||||
then
|
|
||||||
echo "[OOPS] missing commit references accepted"
|
|
||||||
false
|
|
||||||
fi
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'merge c0 with c1' '
|
test_expect_success 'merge c0 with c1' '
|
||||||
|
27
tree-diff.c
27
tree-diff.c
@ -15,6 +15,15 @@ static char *malloc_base(const char *base, int baselen, const char *path, int pa
|
|||||||
return newbase;
|
return newbase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *malloc_fullname(const char *base, int baselen, const char *path, int pathlen)
|
||||||
|
{
|
||||||
|
char *fullname = xmalloc(baselen + pathlen + 1);
|
||||||
|
memcpy(fullname, base, baselen);
|
||||||
|
memcpy(fullname + baselen, path, pathlen);
|
||||||
|
fullname[baselen + pathlen] = 0;
|
||||||
|
return fullname;
|
||||||
|
}
|
||||||
|
|
||||||
static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc,
|
static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc,
|
||||||
const char *base, int baselen);
|
const char *base, int baselen);
|
||||||
|
|
||||||
@ -24,6 +33,7 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const
|
|||||||
const char *path1, *path2;
|
const char *path1, *path2;
|
||||||
const unsigned char *sha1, *sha2;
|
const unsigned char *sha1, *sha2;
|
||||||
int cmp, pathlen1, pathlen2;
|
int cmp, pathlen1, pathlen2;
|
||||||
|
char *fullname;
|
||||||
|
|
||||||
sha1 = tree_entry_extract(t1, &path1, &mode1);
|
sha1 = tree_entry_extract(t1, &path1, &mode1);
|
||||||
sha2 = tree_entry_extract(t2, &path2, &mode2);
|
sha2 = tree_entry_extract(t2, &path2, &mode2);
|
||||||
@ -55,15 +65,20 @@ static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const
|
|||||||
if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode1)) {
|
if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode1)) {
|
||||||
int retval;
|
int retval;
|
||||||
char *newbase = malloc_base(base, baselen, path1, pathlen1);
|
char *newbase = malloc_base(base, baselen, path1, pathlen1);
|
||||||
if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE))
|
if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE)) {
|
||||||
|
newbase[baselen + pathlen1] = 0;
|
||||||
opt->change(opt, mode1, mode2,
|
opt->change(opt, mode1, mode2,
|
||||||
sha1, sha2, base, path1);
|
sha1, sha2, newbase);
|
||||||
|
newbase[baselen + pathlen1] = '/';
|
||||||
|
}
|
||||||
retval = diff_tree_sha1(sha1, sha2, newbase, opt);
|
retval = diff_tree_sha1(sha1, sha2, newbase, opt);
|
||||||
free(newbase);
|
free(newbase);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
opt->change(opt, mode1, mode2, sha1, sha2, base, path1);
|
fullname = malloc_fullname(base, baselen, path1, pathlen1);
|
||||||
|
opt->change(opt, mode1, mode2, sha1, sha2, fullname);
|
||||||
|
free(fullname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,10 +220,10 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree
|
|||||||
unsigned mode;
|
unsigned mode;
|
||||||
const char *path;
|
const char *path;
|
||||||
const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode);
|
const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode);
|
||||||
|
int pathlen = tree_entry_len(path, sha1);
|
||||||
|
|
||||||
if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) {
|
if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) {
|
||||||
enum object_type type;
|
enum object_type type;
|
||||||
int pathlen = tree_entry_len(path, sha1);
|
|
||||||
char *newbase = malloc_base(base, baselen, path, pathlen);
|
char *newbase = malloc_base(base, baselen, path, pathlen);
|
||||||
struct tree_desc inner;
|
struct tree_desc inner;
|
||||||
void *tree;
|
void *tree;
|
||||||
@ -224,7 +239,9 @@ static void show_entry(struct diff_options *opt, const char *prefix, struct tree
|
|||||||
free(tree);
|
free(tree);
|
||||||
free(newbase);
|
free(newbase);
|
||||||
} else {
|
} else {
|
||||||
opt->add_remove(opt, prefix[0], mode, sha1, base, path);
|
char *fullname = malloc_fullname(base, baselen, path, pathlen);
|
||||||
|
opt->add_remove(opt, prefix[0], mode, sha1, fullname);
|
||||||
|
free(fullname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user