Merge branch 'maint'

* maint:
  gitweb: clarify search results page when no matching commit found
  Documentation: add a FILES section for show-ref
  Makefile: add missing dependency on http.h
  Makefile: add missing dependencies on url.h
  Documentation/git-log: Clarify --full-diff
  git-rebase: fix typo when parsing --force-rebase
  imap-send: Fix sprintf usage
  prune: allow --dry-run for -n and --verbose for -v
  notes: allow --dry-run for -n and --verbose for -v
  Document -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C
  Documentation: cite git-am from git-apply
  t7003: fix subdirectory-filter test
  Allow "check-ref-format --branch" from subdirectory
  check-ref-format: handle subcommands in separate functions
  pretty-options.txt: match --format's documentation with implementation.
This commit is contained in:
Junio C Hamano 2010-08-09 13:05:47 -07:00
commit 0d0ba03a18
17 changed files with 122 additions and 40 deletions

View File

@ -206,10 +206,29 @@ endif::git-format-patch[]
the diff-patch output format. Non default number of
digits can be specified with `--abbrev=<n>`.
-B::
Break complete rewrite changes into pairs of delete and create.
-B[<n>][/<m>]::
Break complete rewrite changes into pairs of delete and
create. This serves two purposes:
+
It affects the way a change that amounts to a total rewrite of a file
not as a series of deletion and insertion mixed together with a very
few lines that happen to match textually as the context, but as a
single deletion of everything old followed by a single insertion of
everything new, and the number `m` controls this aspect of the -B
option (defaults to 60%). `-B/70%` specifies that less than 30% of the
original should remain in the result for git to consider it a total
rewrite (i.e. otherwise the resulting patch will be a series of
deletion and insertion mixed together with context lines).
+
When used with -M, a totally-rewritten file is also considered as the
source of a rename (usually -M only considers a file that disappeared
as the source of a rename), and the number `n` controls this aspect of
the -B option (defaults to 50%). `-B20%` specifies that a change with
addition and deletion compared to 20% or more of the file's size are
eligible for being picked up as a possible source of a rename to
another file.
-M::
-M[<n>]::
ifndef::git-log[]
Detect renames.
endif::git-log[]
@ -218,9 +237,15 @@ ifdef::git-log[]
For following files across renames while traversing history, see
`--follow`.
endif::git-log[]
If `n` is specified, it is a is a threshold on the similarity
index (i.e. amount of addition/deletions compared to the
file's size). For example, `-M90%` means git should consider a
delete/add pair to be a rename if more than 90% of the file
hasn't changed.
-C::
-C[<n>]::
Detect copies as well as renames. See also `--find-copies-harder`.
If `n` is specified, it has the same meaning as for `-M<n>`.
ifndef::git-format-patch[]
--diff-filter=[ACDMRTUXB*]::

View File

@ -26,6 +26,10 @@ with the `--cache` option the patch is only applied to the index.
Without these options, the command applies the patch only to files,
and does not require them to be in a git repository.
This command applies the patch but does not create a commit. Use
linkgit:git-am[1] to create commits from patches generated by
linkgit:git-format-patch[1] and/or received by email.
OPTIONS
-------
<patch>...::
@ -242,6 +246,12 @@ If `--index` is not specified, then the submodule commits in the patch
are ignored and only the absence or presence of the corresponding
subdirectory is checked and (if possible) updated.
SEE ALSO
--------
linkgit:git-am[1].
Author
------
Written by Linus Torvalds <torvalds@osdl.org>

View File

@ -55,6 +55,9 @@ OPTIONS
paths. With this, the full diff is shown for commits that touch
the specified paths; this means that "<path>..." limits only
commits, and doesn't limit diff for those commits.
+
Note that this affects all diff-based output types, e.g. those
produced by --stat etc.
--log-size::
Before the log message print out its size in bytes. Intended

View File

@ -129,10 +129,12 @@ OPTIONS
is taken to be in `refs/notes/` if it is not qualified.
-n::
--dry-run::
Do not remove anything; just report the object names whose notes
would be removed.
-v::
--verbose::
Report all object names whose notes are removed.

View File

@ -31,10 +31,12 @@ OPTIONS
-------
-n::
--dry-run::
Do not remove anything; just report what it would
remove.
-v::
--verbose::
Report all removed objects.
\--::

View File

@ -163,9 +163,15 @@ flag, so you can do
to get a listing of all tags together with what they dereference.
FILES
-----
`.git/refs/*`, `.git/packed-refs`
SEE ALSO
--------
linkgit:git-ls-remote[1]
linkgit:git-ls-remote[1],
linkgit:git-update-ref[1],
linkgit:gitrepository-layout[5]
AUTHORS
-------

View File

@ -1,5 +1,5 @@
--pretty[='<format>']::
--format[='<format>']::
--format='<format>'::
Pretty-print the contents of the commit logs in a given format,
where '<format>' can be one of 'oneline', 'short', 'medium',

View File

@ -1854,8 +1854,9 @@ builtin/prune.o builtin/reflog.o reachable.o: reachable.h
builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
builtin/tar-tree.o archive-tar.o: tar.h
builtin/pack-objects.o: thread-utils.h
connect.o transport.o http-backend.o: url.h
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
http.o http-walker.o http-push.o remote-curl.o: http.h
http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h
xdiff-interface.o $(XDIFF_OBJS): \
xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \

View File

@ -33,28 +33,38 @@ static void collapse_slashes(char *dst, const char *src)
*dst = '\0';
}
static int check_ref_format_branch(const char *arg)
{
struct strbuf sb = STRBUF_INIT;
int nongit;
setup_git_directory_gently(&nongit);
if (strbuf_check_branch_ref(&sb, arg))
die("'%s' is not a valid branch name", arg);
printf("%s\n", sb.buf + 11);
return 0;
}
static int check_ref_format_print(const char *arg)
{
char *refname = xmalloc(strlen(arg) + 1);
if (check_ref_format(arg))
return 1;
collapse_slashes(refname, arg);
printf("%s\n", refname);
return 0;
}
int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
{
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(builtin_check_ref_format_usage);
if (argc == 3 && !strcmp(argv[1], "--branch")) {
struct strbuf sb = STRBUF_INIT;
if (strbuf_check_branch_ref(&sb, argv[2]))
die("'%s' is not a valid branch name", argv[2]);
printf("%s\n", sb.buf + 11);
exit(0);
}
if (argc == 3 && !strcmp(argv[1], "--print")) {
char *refname = xmalloc(strlen(argv[2]) + 1);
if (check_ref_format(argv[2]))
exit(1);
collapse_slashes(refname, argv[2]);
printf("%s\n", refname);
exit(0);
}
if (argc == 3 && !strcmp(argv[1], "--branch"))
return check_ref_format_branch(argv[2]);
if (argc == 3 && !strcmp(argv[1], "--print"))
return check_ref_format_print(argv[2]);
if (argc != 2)
usage(builtin_check_ref_format_usage);
return !!check_ref_format(argv[1]);

View File

@ -798,8 +798,9 @@ static int prune(int argc, const char **argv, const char *prefix)
struct notes_tree *t;
int show_only = 0, verbose = 0;
struct option options[] = {
OPT_BOOLEAN('n', NULL, &show_only, "do not remove, show only"),
OPT_BOOLEAN('v', NULL, &verbose, "report pruned notes"),
OPT_BOOLEAN('n', "dry-run", &show_only,
"do not remove, show only"),
OPT_BOOLEAN('v', "verbose", &verbose, "report pruned notes"),
OPT_END()
};

View File

@ -125,10 +125,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
const struct option options[] = {
OPT_BOOLEAN('n', NULL, &show_only,
OPT_BOOLEAN('n', "dry-run", &show_only,
"do not remove, show only"),
OPT_BOOLEAN('v', NULL, &verbose,
"report pruned objects"),
OPT_BOOLEAN('v', "verbose", &verbose, "report pruned objects"),
OPT_DATE(0, "expire", &expire,
"expire objects older than <time>"),
OPT_END()

View File

@ -18,7 +18,7 @@
#define MAX_SCORE 60000.0
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
#define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%) */
#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen 60%) */
#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen (60%) */
#define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */

View File

@ -346,7 +346,7 @@ do
--root)
rebase_root=t
;;
-f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase|--no-ff)
-f|--f|--fo|--for|--forc|--force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase|--no-ff)
force_rebase=t
;;
--rerere-autoupdate|--no-rerere-autoupdate)

View File

@ -6521,12 +6521,13 @@ sub git_search {
$paging_nav .= " &sdot; next";
}
if ($#commitlist >= 100) {
}
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash);
git_search_grep_body(\@commitlist, 0, 99, $next_link);
if ($page == 0 && !@commitlist) {
print "<p>No match.</p>\n";
} else {
git_search_grep_body(\@commitlist, 0, 99, $next_link);
}
}
if ($searchtype eq 'pickaxe') {

View File

@ -543,9 +543,13 @@ static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,
while (imap->literal_pending)
get_cmd_result(ctx, NULL);
bufl = nfsnprintf(buf, sizeof(buf), cmd->cb.data ? CAP(LITERALPLUS) ?
"%d %s{%d+}\r\n" : "%d %s{%d}\r\n" : "%d %s\r\n",
cmd->tag, cmd->cmd, cmd->cb.dlen);
if (!cmd->cb.data)
bufl = nfsnprintf(buf, sizeof(buf), "%d %s\r\n", cmd->tag, cmd->cmd);
else
bufl = nfsnprintf(buf, sizeof(buf), "%d %s{%d%s}\r\n",
cmd->tag, cmd->cmd, cmd->cb.dlen,
CAP(LITERALPLUS) ? "+" : "");
if (Verbose) {
if (imap->num_in_progress)
printf("(%d in progress) ", imap->num_in_progress);
@ -1086,7 +1090,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
int gai;
char portstr[6];
snprintf(portstr, sizeof(portstr), "%hu", srvc->port);
snprintf(portstr, sizeof(portstr), "%d", srvc->port);
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;

View File

@ -41,6 +41,23 @@ test_expect_success "check-ref-format --branch @{-1}" '
refname2=$(git check-ref-format --branch @{-2}) &&
test "$refname2" = master'
test_expect_success 'check-ref-format --branch from subdir' '
mkdir subdir &&
T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) &&
git update-ref refs/heads/master $sha1 &&
git update-ref refs/remotes/origin/master $sha1
git checkout master &&
git checkout origin/master &&
git checkout master &&
refname=$(
cd subdir &&
git check-ref-format --branch @{-1}
) &&
test "$refname" = "$sha1"
'
valid_ref_normalized() {
test_expect_success "ref name '$1' simplifies to '$2'" "
refname=\$(git check-ref-format --print '$1') &&

View File

@ -147,7 +147,8 @@ test_expect_success 'use index-filter to move into a subdirectory' '
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
git update-index --index-info &&
mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
test -z "$(git diff HEAD directorymoved:newsubdir)"'
git diff --exit-code HEAD directorymoved:newsubdir
'
test_expect_success 'stops when msg filter fails' '
old=$(git rev-parse HEAD) &&