Skip to content

Commit 0d0ba03

Browse files
committed
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.
2 parents d7d1c79 + 497d9c3 commit 0d0ba03

17 files changed

+123
-41
lines changed

Documentation/diff-options.txt

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,29 @@ endif::git-format-patch[]
206206
the diff-patch output format. Non default number of
207207
digits can be specified with `--abbrev=<n>`.
208208

209-
-B::
210-
Break complete rewrite changes into pairs of delete and create.
211-
212-
-M::
209+
-B[<n>][/<m>]::
210+
Break complete rewrite changes into pairs of delete and
211+
create. This serves two purposes:
212+
+
213+
It affects the way a change that amounts to a total rewrite of a file
214+
not as a series of deletion and insertion mixed together with a very
215+
few lines that happen to match textually as the context, but as a
216+
single deletion of everything old followed by a single insertion of
217+
everything new, and the number `m` controls this aspect of the -B
218+
option (defaults to 60%). `-B/70%` specifies that less than 30% of the
219+
original should remain in the result for git to consider it a total
220+
rewrite (i.e. otherwise the resulting patch will be a series of
221+
deletion and insertion mixed together with context lines).
222+
+
223+
When used with -M, a totally-rewritten file is also considered as the
224+
source of a rename (usually -M only considers a file that disappeared
225+
as the source of a rename), and the number `n` controls this aspect of
226+
the -B option (defaults to 50%). `-B20%` specifies that a change with
227+
addition and deletion compared to 20% or more of the file's size are
228+
eligible for being picked up as a possible source of a rename to
229+
another file.
230+
231+
-M[<n>]::
213232
ifndef::git-log[]
214233
Detect renames.
215234
endif::git-log[]
@@ -218,9 +237,15 @@ ifdef::git-log[]
218237
For following files across renames while traversing history, see
219238
`--follow`.
220239
endif::git-log[]
240+
If `n` is specified, it is a is a threshold on the similarity
241+
index (i.e. amount of addition/deletions compared to the
242+
file's size). For example, `-M90%` means git should consider a
243+
delete/add pair to be a rename if more than 90% of the file
244+
hasn't changed.
221245

222-
-C::
246+
-C[<n>]::
223247
Detect copies as well as renames. See also `--find-copies-harder`.
248+
If `n` is specified, it has the same meaning as for `-M<n>`.
224249

225250
ifndef::git-format-patch[]
226251
--diff-filter=[ACDMRTUXB*]::

Documentation/git-apply.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ with the `--cache` option the patch is only applied to the index.
2626
Without these options, the command applies the patch only to files,
2727
and does not require them to be in a git repository.
2828

29+
This command applies the patch but does not create a commit. Use
30+
linkgit:git-am[1] to create commits from patches generated by
31+
linkgit:git-format-patch[1] and/or received by email.
32+
2933
OPTIONS
3034
-------
3135
<patch>...::
@@ -242,6 +246,12 @@ If `--index` is not specified, then the submodule commits in the patch
242246
are ignored and only the absence or presence of the corresponding
243247
subdirectory is checked and (if possible) updated.
244248

249+
250+
SEE ALSO
251+
--------
252+
linkgit:git-am[1].
253+
254+
245255
Author
246256
------
247257
Written by Linus Torvalds <[email protected]>

Documentation/git-log.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ OPTIONS
5555
paths. With this, the full diff is shown for commits that touch
5656
the specified paths; this means that "<path>..." limits only
5757
commits, and doesn't limit diff for those commits.
58+
+
59+
Note that this affects all diff-based output types, e.g. those
60+
produced by --stat etc.
5861

5962
--log-size::
6063
Before the log message print out its size in bytes. Intended

Documentation/git-notes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ OPTIONS
129129
is taken to be in `refs/notes/` if it is not qualified.
130130

131131
-n::
132+
--dry-run::
132133
Do not remove anything; just report the object names whose notes
133134
would be removed.
134135

135136
-v::
137+
--verbose::
136138
Report all object names whose notes are removed.
137139

138140

Documentation/git-prune.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ OPTIONS
3131
-------
3232

3333
-n::
34+
--dry-run::
3435
Do not remove anything; just report what it would
3536
remove.
3637

3738
-v::
39+
--verbose::
3840
Report all removed objects.
3941

4042
\--::

Documentation/git-show-ref.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,15 @@ flag, so you can do
163163

164164
to get a listing of all tags together with what they dereference.
165165

166+
FILES
167+
-----
168+
`.git/refs/*`, `.git/packed-refs`
169+
166170
SEE ALSO
167171
--------
168-
linkgit:git-ls-remote[1]
172+
linkgit:git-ls-remote[1],
173+
linkgit:git-update-ref[1],
174+
linkgit:gitrepository-layout[5]
169175

170176
AUTHORS
171177
-------

Documentation/pretty-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--pretty[='<format>']::
2-
--format[='<format>']::
2+
--format='<format>'::
33

44
Pretty-print the contents of the commit logs in a given format,
55
where '<format>' can be one of 'oneline', 'short', 'medium',

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,8 +1854,9 @@ builtin/prune.o builtin/reflog.o reachable.o: reachable.h
18541854
builtin/commit.o builtin/revert.o wt-status.o: wt-status.h
18551855
builtin/tar-tree.o archive-tar.o: tar.h
18561856
builtin/pack-objects.o: thread-utils.h
1857+
connect.o transport.o http-backend.o: url.h
18571858
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1858-
http.o http-walker.o http-push.o remote-curl.o: http.h
1859+
http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h
18591860

18601861
xdiff-interface.o $(XDIFF_OBJS): \
18611862
xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \

builtin/check-ref-format.c

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,38 @@ static void collapse_slashes(char *dst, const char *src)
3333
*dst = '\0';
3434
}
3535

36+
static int check_ref_format_branch(const char *arg)
37+
{
38+
struct strbuf sb = STRBUF_INIT;
39+
int nongit;
40+
41+
setup_git_directory_gently(&nongit);
42+
if (strbuf_check_branch_ref(&sb, arg))
43+
die("'%s' is not a valid branch name", arg);
44+
printf("%s\n", sb.buf + 11);
45+
return 0;
46+
}
47+
48+
static int check_ref_format_print(const char *arg)
49+
{
50+
char *refname = xmalloc(strlen(arg) + 1);
51+
52+
if (check_ref_format(arg))
53+
return 1;
54+
collapse_slashes(refname, arg);
55+
printf("%s\n", refname);
56+
return 0;
57+
}
58+
3659
int cmd_check_ref_format(int argc, const char **argv, const char *prefix)
3760
{
3861
if (argc == 2 && !strcmp(argv[1], "-h"))
3962
usage(builtin_check_ref_format_usage);
4063

41-
if (argc == 3 && !strcmp(argv[1], "--branch")) {
42-
struct strbuf sb = STRBUF_INIT;
43-
44-
if (strbuf_check_branch_ref(&sb, argv[2]))
45-
die("'%s' is not a valid branch name", argv[2]);
46-
printf("%s\n", sb.buf + 11);
47-
exit(0);
48-
}
49-
if (argc == 3 && !strcmp(argv[1], "--print")) {
50-
char *refname = xmalloc(strlen(argv[2]) + 1);
51-
52-
if (check_ref_format(argv[2]))
53-
exit(1);
54-
collapse_slashes(refname, argv[2]);
55-
printf("%s\n", refname);
56-
exit(0);
57-
}
64+
if (argc == 3 && !strcmp(argv[1], "--branch"))
65+
return check_ref_format_branch(argv[2]);
66+
if (argc == 3 && !strcmp(argv[1], "--print"))
67+
return check_ref_format_print(argv[2]);
5868
if (argc != 2)
5969
usage(builtin_check_ref_format_usage);
6070
return !!check_ref_format(argv[1]);

builtin/notes.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,9 @@ static int prune(int argc, const char **argv, const char *prefix)
798798
struct notes_tree *t;
799799
int show_only = 0, verbose = 0;
800800
struct option options[] = {
801-
OPT_BOOLEAN('n', NULL, &show_only, "do not remove, show only"),
802-
OPT_BOOLEAN('v', NULL, &verbose, "report pruned notes"),
801+
OPT_BOOLEAN('n', "dry-run", &show_only,
802+
"do not remove, show only"),
803+
OPT_BOOLEAN('v', "verbose", &verbose, "report pruned notes"),
803804
OPT_END()
804805
};
805806

builtin/prune.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
125125
{
126126
struct rev_info revs;
127127
const struct option options[] = {
128-
OPT_BOOLEAN('n', NULL, &show_only,
128+
OPT_BOOLEAN('n', "dry-run", &show_only,
129129
"do not remove, show only"),
130-
OPT_BOOLEAN('v', NULL, &verbose,
131-
"report pruned objects"),
130+
OPT_BOOLEAN('v', "verbose", &verbose, "report pruned objects"),
132131
OPT_DATE(0, "expire", &expire,
133132
"expire objects older than <time>"),
134133
OPT_END()

diffcore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define MAX_SCORE 60000.0
1919
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
2020
#define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%) */
21-
#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen 60%) */
21+
#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen (60%) */
2222

2323
#define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */
2424

git-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ do
346346
--root)
347347
rebase_root=t
348348
;;
349-
-f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase|--no-ff)
349+
-f|--f|--fo|--for|--forc|--force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase|--no-ff)
350350
force_rebase=t
351351
;;
352352
--rerere-autoupdate|--no-rerere-autoupdate)

gitweb/gitweb.perl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6521,12 +6521,13 @@ sub git_search {
65216521
$paging_nav .= " &sdot; next";
65226522
}
65236523

6524-
if ($#commitlist >= 100) {
6525-
}
6526-
65276524
git_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);
65286525
git_print_header_div('commit', esc_html($co{'title'}), $hash);
6529-
git_search_grep_body(\@commitlist, 0, 99, $next_link);
6526+
if ($page == 0 && !@commitlist) {
6527+
print "<p>No match.</p>\n";
6528+
} else {
6529+
git_search_grep_body(\@commitlist, 0, 99, $next_link);
6530+
}
65306531
}
65316532

65326533
if ($searchtype eq 'pickaxe') {

imap-send.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,13 @@ static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,
543543
while (imap->literal_pending)
544544
get_cmd_result(ctx, NULL);
545545

546-
bufl = nfsnprintf(buf, sizeof(buf), cmd->cb.data ? CAP(LITERALPLUS) ?
547-
"%d %s{%d+}\r\n" : "%d %s{%d}\r\n" : "%d %s\r\n",
548-
cmd->tag, cmd->cmd, cmd->cb.dlen);
546+
if (!cmd->cb.data)
547+
bufl = nfsnprintf(buf, sizeof(buf), "%d %s\r\n", cmd->tag, cmd->cmd);
548+
else
549+
bufl = nfsnprintf(buf, sizeof(buf), "%d %s{%d%s}\r\n",
550+
cmd->tag, cmd->cmd, cmd->cb.dlen,
551+
CAP(LITERALPLUS) ? "+" : "");
552+
549553
if (Verbose) {
550554
if (imap->num_in_progress)
551555
printf("(%d in progress) ", imap->num_in_progress);
@@ -1086,7 +1090,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
10861090
int gai;
10871091
char portstr[6];
10881092

1089-
snprintf(portstr, sizeof(portstr), "%hu", srvc->port);
1093+
snprintf(portstr, sizeof(portstr), "%d", srvc->port);
10901094

10911095
memset(&hints, 0, sizeof(hints));
10921096
hints.ai_socktype = SOCK_STREAM;

t/t1402-check-ref-format.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,23 @@ test_expect_success "check-ref-format --branch @{-1}" '
4141
refname2=$(git check-ref-format --branch @{-2}) &&
4242
test "$refname2" = master'
4343

44+
test_expect_success 'check-ref-format --branch from subdir' '
45+
mkdir subdir &&
46+
47+
T=$(git write-tree) &&
48+
sha1=$(echo A | git commit-tree $T) &&
49+
git update-ref refs/heads/master $sha1 &&
50+
git update-ref refs/remotes/origin/master $sha1
51+
git checkout master &&
52+
git checkout origin/master &&
53+
git checkout master &&
54+
refname=$(
55+
cd subdir &&
56+
git check-ref-format --branch @{-1}
57+
) &&
58+
test "$refname" = "$sha1"
59+
'
60+
4461
valid_ref_normalized() {
4562
test_expect_success "ref name '$1' simplifies to '$2'" "
4663
refname=\$(git check-ref-format --print '$1') &&

t/t7003-filter-branch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ test_expect_success 'use index-filter to move into a subdirectory' '
147147
GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \
148148
git update-index --index-info &&
149149
mv \"\$GIT_INDEX_FILE.new\" \"\$GIT_INDEX_FILE\"" directorymoved &&
150-
test -z "$(git diff HEAD directorymoved:newsubdir)"'
150+
git diff --exit-code HEAD directorymoved:newsubdir
151+
'
151152

152153
test_expect_success 'stops when msg filter fails' '
153154
old=$(git rev-parse HEAD) &&

0 commit comments

Comments
 (0)