Merge branch 'master' into next

* master:
  Documentation/gitdiffcore: fix order in pickaxe description
  Documentation: fix minor inconsistency
  Documentation: rebase -i ignores options passed to "git am"
  diff-options: make --patch a synonym for -p
  for-each-ref: Field with abbreviated objectname
  hash_object: correction for zero length file
  gitweb: Use @diff_opts while using format-patch
This commit is contained in:
Junio C Hamano
2010-05-18 22:40:04 -07:00
10 changed files with 25 additions and 9 deletions

View File

@@ -1541,7 +1541,7 @@ receive.denyDeletes::
the ref. Use this to prevent such a ref deletion via a push.
receive.denyCurrentBranch::
If set to true or "refuse", receive-pack will deny a ref update
If set to true or "refuse", git-receive-pack will deny a ref update
to the currently checked out branch of a non-bare repository.
Such a push is potentially dangerous because it brings the HEAD
out of sync with the index and working tree. If set to "warn",

View File

@@ -21,6 +21,7 @@ endif::git-format-patch[]
ifndef::git-format-patch[]
-p::
-u::
--patch::
Generate patch (see section on generating patches).
{git-diff? This is the default.}
endif::git-format-patch[]

View File

@@ -86,6 +86,7 @@ objectsize::
objectname::
The object name (aka SHA-1).
For a non-ambiguous abbreviation of the object name append `:short`.
upstream::
The name of a local ref which can be considered ``upstream''

View File

@@ -295,6 +295,7 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details).
--ignore-date::
These flags are passed to 'git am' to easily change the dates
of the rebased commits (see linkgit:git-am[1]).
Incompatible with the --interactive option.
-i::
--interactive::

View File

@@ -227,8 +227,8 @@ changes that touch a specified string, and is controlled by the
commands.
When diffcore-pickaxe is in use, it checks if there are
filepairs whose "original" side has the specified string and
whose "result" side does not. Such a filepair represents "the
filepairs whose "result" side has the specified string and
whose "origin" side does not. Such a filepair represents "the
string appeared in this changeset". It also checks for the
opposite case that loses the specified string.

View File

@@ -227,6 +227,9 @@ static void grab_common_values(struct atom_value *val, int deref, struct object
strcpy(s, sha1_to_hex(obj->sha1));
v->s = s;
}
else if (!strcmp(name, "objectname:short")) {
v->s = find_unique_abbrev(obj->sha1, DEFAULT_ABBREV);
}
}
}

2
diff.c
View File

@@ -2779,7 +2779,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
const char *arg = av[0];
/* Output format options */
if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
if (!strcmp(arg, "-p") || !strcmp(arg, "-u") || !strcmp(arg, "--patch"))
options->output_format |= DIFF_FORMAT_PATCH;
else if (opt_arg(arg, 'U', "unified", &options->context))
options->output_format |= DIFF_FORMAT_PATCH;

View File

@@ -6151,8 +6151,8 @@ sub git_commitdiff {
}
push @commit_spec, '--root', $hash;
}
open $fd, "-|", git_cmd(), "format-patch", '--encoding=utf8',
'--stdout', @commit_spec
open $fd, "-|", git_cmd(), "format-patch", @diff_opts,
'--encoding=utf8', '--stdout', @commit_spec
or die_error(500, "Open git-format-patch failed");
} else {
die_error(400, "Unknown commitdiff format");

View File

@@ -2454,6 +2454,8 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
else
ret = -1;
strbuf_release(&sbuf);
} else if (!size) {
ret = index_mem(sha1, NULL, size, write_object, type, path);
} else if (size <= SMALL_FILE_SIZE) {
char *buf = xmalloc(size);
if (size == read_in_full(fd, buf, size))
@@ -2462,12 +2464,11 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
else
ret = error("short read %s", strerror(errno));
free(buf);
} else if (size) {
} else {
void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
ret = index_mem(sha1, buf, size, write_object, type, path);
munmap(buf, size);
} else
ret = index_mem(sha1, NULL, size, write_object, type, path);
}
close(fd);
return ret;
}

View File

@@ -295,6 +295,15 @@ test_expect_success 'Check short upstream format' '
test_cmp expected actual
'
cat >expected <<EOF
67a36f1
EOF
test_expect_success 'Check short objectname format' '
git for-each-ref --format="%(objectname:short)" refs/heads >actual &&
test_cmp expected actual
'
test_expect_success 'Check for invalid refname format' '
test_must_fail git for-each-ref --format="%(refname:INVALID)"
'