mirror of
https://github.com/git/git.git
synced 2026-03-15 03:00:07 +01:00
Merge branch 'master' into next
* master: gitweb: Refactor reading and parsing config file into read_config_file sh-18n: quell "unused variable" warning init/clone: remove short option -L and document --separate-git-dir doc: discuss textconv versus external diff drivers
This commit is contained in:
@@ -12,7 +12,7 @@ SYNOPSIS
|
||||
'git clone' [--template=<template_directory>]
|
||||
[-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
|
||||
[-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
|
||||
[--separate-git-dir|-L <git dir>]
|
||||
[--separate-git-dir <git dir>]
|
||||
[--depth <depth>] [--recursive|--recurse-submodules] [--] <repository>
|
||||
[<directory>]
|
||||
|
||||
@@ -177,7 +177,6 @@ objects from the source repository into a pack in the cloned repository.
|
||||
repository does not have a worktree/checkout (i.e. if any of
|
||||
`--no-checkout`/`-n`, `--bare`, or `--mirror` is given)
|
||||
|
||||
-L=<git dir>::
|
||||
--separate-git-dir=<git dir>::
|
||||
Instead of placing the cloned repository where it is supposed
|
||||
to be, place the cloned repository at the specified directory,
|
||||
|
||||
@@ -8,7 +8,7 @@ git-init-db - Creates an empty git repository
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
'git init-db' [-q | --quiet] [--bare] [--template=<template_directory>] [--shared[=<permissions>]]
|
||||
'git init-db' [-q | --quiet] [--bare] [--template=<template_directory>] [--separate-git-dir <git dir>] [--shared[=<permissions>]]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
@@ -9,7 +9,7 @@ git-init - Create an empty git repository or reinitialize an existing one
|
||||
SYNOPSIS
|
||||
--------
|
||||
'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
|
||||
[--separate-git-dir|-L <git dir>]
|
||||
[--separate-git-dir <git dir>]
|
||||
[--shared[=<permissions>]] [directory]
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ current working directory.
|
||||
Specify the directory from which templates will be used. (See the "TEMPLATE
|
||||
DIRECTORY" section below.)
|
||||
|
||||
-L=<git dir>::
|
||||
--separate-git-dir=<git dir>::
|
||||
|
||||
Instead of initializing the repository where it is supposed to be,
|
||||
|
||||
@@ -593,6 +593,37 @@ and now produces better output), you can remove the cache
|
||||
manually with `git update-ref -d refs/notes/textconv/jpg` (where
|
||||
"jpg" is the name of the diff driver, as in the example above).
|
||||
|
||||
Choosing textconv versus external diff
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
If you want to show differences between binary or specially-formatted
|
||||
blobs in your repository, you can choose to use either an external diff
|
||||
command, or to use textconv to convert them to a diff-able text format.
|
||||
Which method you choose depends on your exact situation.
|
||||
|
||||
The advantage of using an external diff command is flexibility. You are
|
||||
not bound to find line-oriented changes, nor is it necessary for the
|
||||
output to resemble unified diff. You are free to locate and report
|
||||
changes in the most appropriate way for your data format.
|
||||
|
||||
A textconv, by comparison, is much more limiting. You provide a
|
||||
transformation of the data into a line-oriented text format, and git
|
||||
uses its regular diff tools to generate the output. There are several
|
||||
advantages to choosing this method:
|
||||
|
||||
1. Ease of use. It is often much simpler to write a binary to text
|
||||
transformation than it is to perform your own diff. In many cases,
|
||||
existing programs can be used as textconv filters (e.g., exif,
|
||||
odt2txt).
|
||||
|
||||
2. Git diff features. By performing only the transformation step
|
||||
yourself, you can still utilize many of git's diff features,
|
||||
including colorization, word-diff, and combined diffs for merges.
|
||||
|
||||
3. Caching. Textconv caching can speed up repeated diffs, such as those
|
||||
you might trigger by running `git log -p`.
|
||||
|
||||
|
||||
Marking files as binary
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ static struct option builtin_clone_options[] = {
|
||||
"path to git-upload-pack on the remote"),
|
||||
OPT_STRING(0, "depth", &option_depth, "depth",
|
||||
"create a shallow clone of that depth"),
|
||||
OPT_STRING('L', "separate-git-dir", &real_git_dir, "gitdir",
|
||||
OPT_STRING(0, "separate-git-dir", &real_git_dir, "gitdir",
|
||||
"separate git dir from working tree"),
|
||||
|
||||
OPT_END()
|
||||
|
||||
@@ -490,7 +490,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||
"specify that the git repository is to be shared amongst several users",
|
||||
PARSE_OPT_OPTARG | PARSE_OPT_NONEG, shared_callback, 0},
|
||||
OPT_BIT('q', "quiet", &flags, "be quiet", INIT_DB_QUIET),
|
||||
OPT_STRING('L', "separate-git-dir", &real_git_dir, "gitdir",
|
||||
OPT_STRING(0, "separate-git-dir", &real_git_dir, "gitdir",
|
||||
"separate git dir from working tree"),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
@@ -643,18 +643,30 @@ sub filter_snapshot_fmts {
|
||||
# if it is true then gitweb config would be run for each request.
|
||||
our $per_request_config = 1;
|
||||
|
||||
# read and parse gitweb config file given by its parameter.
|
||||
# returns true on success, false on recoverable error, allowing
|
||||
# to chain this subroutine, using first file that exists.
|
||||
# dies on errors during parsing config file, as it is unrecoverable.
|
||||
sub read_config_file {
|
||||
my $filename = shift;
|
||||
return unless defined $filename;
|
||||
# die if there are errors parsing config file
|
||||
if (-e $filename) {
|
||||
do $filename;
|
||||
die $@ if $@;
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM);
|
||||
sub evaluate_gitweb_config {
|
||||
our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
|
||||
our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
|
||||
# die if there are errors parsing config file
|
||||
if (-e $GITWEB_CONFIG) {
|
||||
do $GITWEB_CONFIG;
|
||||
die $@ if $@;
|
||||
} elsif (-e $GITWEB_CONFIG_SYSTEM) {
|
||||
do $GITWEB_CONFIG_SYSTEM;
|
||||
die $@ if $@;
|
||||
}
|
||||
|
||||
# use first config file that exists
|
||||
read_config_file($GITWEB_CONFIG) or
|
||||
read_config_file($GITWEB_CONFIG_SYSTEM);
|
||||
}
|
||||
|
||||
# Get loadavg of system, to compare against $maxload.
|
||||
|
||||
@@ -68,7 +68,7 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Default values for command line options. */
|
||||
unsigned short int show_variables = 0;
|
||||
/* unsigned short int show_variables = 0; */
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ main (int argc, char *argv[])
|
||||
/* git sh-i18n--envsubst --variables '$foo and $bar' */
|
||||
if (strcmp(argv[1], "--variables"))
|
||||
error ("first argument must be --variables when two are given");
|
||||
show_variables = 1;
|
||||
/* show_variables = 1; */
|
||||
print_variables (argv[2]);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -409,7 +409,7 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
|
||||
cd newdir &&
|
||||
mv .git here &&
|
||||
ln -s here .git &&
|
||||
git init -L ../realgitdir
|
||||
git init --separate-git-dir ../realgitdir
|
||||
) &&
|
||||
echo "gitdir: `pwd`/realgitdir" >expected &&
|
||||
test_cmp expected newdir/.git &&
|
||||
|
||||
Reference in New Issue
Block a user