Merge branch 'maint'
* maint: diff-patch: Avoid emitting double-slashes in textual patch. Reword git-am 3-way fallback failure message. Limit filename for format-patch core.legacyheaders: Use the description used in RelNotes-1.5.0 git-show-ref --verify: Fail if called without a reference Conflicts: builtin-show-ref.c diff.c
This commit is contained in:
commit
8a13becc0d
@ -192,10 +192,17 @@ core.compression::
|
|||||||
slowest.
|
slowest.
|
||||||
|
|
||||||
core.legacyheaders::
|
core.legacyheaders::
|
||||||
A boolean which enables the legacy object header format in case
|
A boolean which
|
||||||
you want to interoperate with old clients accessing the object
|
changes the format of loose objects so that they are more
|
||||||
database directly (where the "http://" and "rsync://" protocols
|
efficient to pack and to send out of the repository over git
|
||||||
count as direct access).
|
native protocol, since v1.4.2. However, loose objects
|
||||||
|
written in the new format cannot be read by git older than
|
||||||
|
that version; people fetching from your repository using
|
||||||
|
older versions of git over dumb transports (e.g. http)
|
||||||
|
will also be affected.
|
||||||
|
+
|
||||||
|
To let git use the new loose object format, you have to
|
||||||
|
set core.legacyheaders to false.
|
||||||
|
|
||||||
core.packedGitWindowSize::
|
core.packedGitWindowSize::
|
||||||
Number of bytes of a pack file to map into memory in a
|
Number of bytes of a pack file to map into memory in a
|
||||||
|
@ -224,6 +224,9 @@ int cmd_log(int argc, const char **argv, const char *prefix)
|
|||||||
return cmd_log_walk(&rev);
|
return cmd_log_walk(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* format-patch */
|
||||||
|
#define FORMAT_PATCH_NAME_MAX 64
|
||||||
|
|
||||||
static int istitlechar(char c)
|
static int istitlechar(char c)
|
||||||
{
|
{
|
||||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
||||||
@ -264,15 +267,18 @@ static int git_format_config(const char *var, const char *value)
|
|||||||
static FILE *realstdout = NULL;
|
static FILE *realstdout = NULL;
|
||||||
static const char *output_directory = NULL;
|
static const char *output_directory = NULL;
|
||||||
|
|
||||||
static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
|
static int reopen_stdout(struct commit *commit, int nr, int keep_subject)
|
||||||
{
|
{
|
||||||
char filename[1024];
|
char filename[PATH_MAX];
|
||||||
char *sol;
|
char *sol;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int suffix_len = strlen(fmt_patch_suffix) + 10; /* ., NUL and slop */
|
int suffix_len = strlen(fmt_patch_suffix) + 1;
|
||||||
|
|
||||||
if (output_directory) {
|
if (output_directory) {
|
||||||
strlcpy(filename, output_directory, 1000);
|
if (strlen(output_directory) >=
|
||||||
|
sizeof(filename) - FORMAT_PATCH_NAME_MAX - suffix_len)
|
||||||
|
return error("name of output directory is too long");
|
||||||
|
strlcpy(filename, output_directory, sizeof(filename) - suffix_len);
|
||||||
len = strlen(filename);
|
len = strlen(filename);
|
||||||
if (filename[len - 1] != '/')
|
if (filename[len - 1] != '/')
|
||||||
filename[len++] = '/';
|
filename[len++] = '/';
|
||||||
@ -297,7 +303,8 @@ static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0;
|
for (j = 0;
|
||||||
len < sizeof(filename) - suffix_len &&
|
j < FORMAT_PATCH_NAME_MAX - suffix_len - 5 &&
|
||||||
|
len < sizeof(filename) - suffix_len &&
|
||||||
sol[j] && sol[j] != '\n';
|
sol[j] && sol[j] != '\n';
|
||||||
j++) {
|
j++) {
|
||||||
if (istitlechar(sol[j])) {
|
if (istitlechar(sol[j])) {
|
||||||
@ -314,10 +321,16 @@ static void reopen_stdout(struct commit *commit, int nr, int keep_subject)
|
|||||||
}
|
}
|
||||||
while (filename[len - 1] == '.' || filename[len - 1] == '-')
|
while (filename[len - 1] == '.' || filename[len - 1] == '-')
|
||||||
len--;
|
len--;
|
||||||
|
filename[len] = 0;
|
||||||
}
|
}
|
||||||
|
if (len + suffix_len >= sizeof(filename))
|
||||||
|
return error("Patch pathname too long");
|
||||||
strcpy(filename + len, fmt_patch_suffix);
|
strcpy(filename + len, fmt_patch_suffix);
|
||||||
fprintf(realstdout, "%s\n", filename);
|
fprintf(realstdout, "%s\n", filename);
|
||||||
freopen(filename, "w", stdout);
|
if (freopen(filename, "w", stdout) == NULL)
|
||||||
|
return error("Cannot open patch file %s",filename);
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_patch_id(struct commit *commit, struct diff_options *options,
|
static int get_patch_id(struct commit *commit, struct diff_options *options,
|
||||||
@ -573,7 +586,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||||||
rev.message_id = message_id;
|
rev.message_id = message_id;
|
||||||
}
|
}
|
||||||
if (!use_stdout)
|
if (!use_stdout)
|
||||||
reopen_stdout(commit, rev.nr, keep_subject);
|
if (reopen_stdout(commit, rev.nr, keep_subject))
|
||||||
|
die("Failed to create output files");
|
||||||
shown = log_tree_commit(&rev, commit);
|
shown = log_tree_commit(&rev, commit);
|
||||||
free(commit->buffer);
|
free(commit->buffer);
|
||||||
commit->buffer = NULL;
|
commit->buffer = NULL;
|
||||||
|
@ -221,9 +221,11 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
unsigned char sha1[20];
|
if (!pattern)
|
||||||
|
die("--verify requires a reference");
|
||||||
while (*pattern) {
|
while (*pattern) {
|
||||||
|
unsigned char sha1[20];
|
||||||
|
|
||||||
if (!prefixcmp(*pattern, "refs/") &&
|
if (!prefixcmp(*pattern, "refs/") &&
|
||||||
resolve_ref(*pattern, sha1, 1, NULL)) {
|
resolve_ref(*pattern, sha1, 1, NULL)) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
|
6
diff.c
6
diff.c
@ -219,6 +219,8 @@ static void emit_rewrite_diff(const char *name_a,
|
|||||||
const char *new = diff_get_color(color_diff, DIFF_FILE_NEW);
|
const char *new = diff_get_color(color_diff, DIFF_FILE_NEW);
|
||||||
const char *reset = diff_get_color(color_diff, DIFF_RESET);
|
const char *reset = diff_get_color(color_diff, DIFF_RESET);
|
||||||
|
|
||||||
|
name_a += (*name_a == '/');
|
||||||
|
name_b += (*name_b == '/');
|
||||||
name_a_tab = strchr(name_a, ' ') ? "\t" : "";
|
name_a_tab = strchr(name_a, ' ') ? "\t" : "";
|
||||||
name_b_tab = strchr(name_b, ' ') ? "\t" : "";
|
name_b_tab = strchr(name_b, ' ') ? "\t" : "";
|
||||||
|
|
||||||
@ -1064,8 +1066,8 @@ static void builtin_diff(const char *name_a,
|
|||||||
const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
|
const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
|
||||||
const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
|
const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
|
||||||
|
|
||||||
a_one = quote_two("a/", name_a);
|
a_one = quote_two("a/", name_a + (*name_a == '/'));
|
||||||
b_two = quote_two("b/", name_b);
|
b_two = quote_two("b/", name_b + (*name_b == '/'));
|
||||||
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
|
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
|
||||||
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
|
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
|
||||||
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
|
printf("%sdiff --git %s %s%s\n", set, a_one, b_two, reset);
|
||||||
|
@ -66,7 +66,7 @@ fall_back_3way () {
|
|||||||
git-update-index -z --index-info <"$dotest/patch-merge-index-info" &&
|
git-update-index -z --index-info <"$dotest/patch-merge-index-info" &&
|
||||||
GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
|
GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
|
||||||
git-write-tree >"$dotest/patch-merge-base+" ||
|
git-write-tree >"$dotest/patch-merge-base+" ||
|
||||||
cannot_fallback "Patch does not record usable index information."
|
cannot_fallback "Repository lacks necessary blobs to fall back on 3-way merge."
|
||||||
|
|
||||||
echo Using index info to reconstruct a base tree...
|
echo Using index info to reconstruct a base tree...
|
||||||
if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
|
if GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \
|
||||||
|
Loading…
Reference in New Issue
Block a user