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 <torvalds@osdl.org>

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

0 commit comments

Comments
 (0)