From 2b2da6846370978123935258890a059167dc73bd Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Sat, 5 Jul 2008 02:00:13 +0200 Subject: [PATCH 1/9] Documentation: be precise about which date --pretty uses This makes it explicit that the --pretty formats 'medium' and 'email' use the author date (and ignore the committer date). Signed-off-by: Junio C Hamano --- Documentation/pretty-formats.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index ec3755579..69e6d2fa4 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -30,7 +30,7 @@ This is designed to be as compact as possible. commit Author: - Date: + Date: @@ -50,9 +50,9 @@ This is designed to be as compact as possible. commit <sha1> Author: <author> - AuthorDate: <date & time> + AuthorDate: <author date> Commit: <committer> - CommitDate: <date & time> + CommitDate: <committer date> <title line> @@ -62,7 +62,7 @@ This is designed to be as compact as possible. From <sha1> <date> From: <author> - Date: <date & time> + Date: <author date> Subject: [PATCH] <title line> <full commit message> From a41a32bf1ce74f3be5c1ab398db1a93b89e6a99e Mon Sep 17 00:00:00 2001 From: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Date: Fri, 4 Jul 2008 22:43:41 -0600 Subject: [PATCH 2/9] Documentation cvs: Clarify when a bare repository is needed New users sometimes import a project and then immediately try to use the imported repository as a central shared repository. This provides pointers about setting up a bare repository for that in the parts of the documentation dealing with CVS migration. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- Documentation/git-cvsimport.txt | 6 ++++++ Documentation/git-cvsserver.txt | 3 +++ Documentation/gitcvs-migration.txt | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 2f9b35f62..93b7d2dc9 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -31,6 +31,12 @@ to work with; after that, you need to 'git merge' incremental imports, or any CVS branches, yourself. It is advisable to specify a named remote via -r to separate and protect the incoming branches. +If you intend to set up a shared public repository that all developers can +read/write, or if you want to use linkgit:git-cvsserver[1], then you +probably want to make a bare clone of the imported repository, +and use the clone as the shared repository. +See linkgit:gitcvs-migration[7]. + OPTIONS ------- diff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt index 3310ae25f..19da87e71 100644 --- a/Documentation/git-cvsserver.txt +++ b/Documentation/git-cvsserver.txt @@ -133,6 +133,9 @@ write access to the log file and to the database (see <<dbbackend,Database Backend>>. If you want to offer write access over SSH, the users of course also need write access to the git repository itself. +You also need to ensure that each repository is "bare" (without a git index +file) for `cvs commit` to work. See linkgit:gitcvs-migration[7]. + [[configaccessmethod]] All configuration variables can also be overridden for a specific method of access. Valid method names are "ext" (for SSH access) and "pserver". The diff --git a/Documentation/gitcvs-migration.txt b/Documentation/gitcvs-migration.txt index 1db3f5294..0325d6759 100644 --- a/Documentation/gitcvs-migration.txt +++ b/Documentation/gitcvs-migration.txt @@ -143,6 +143,11 @@ work, you must not modify the imported branches; instead, create new branches for your own changes, and merge in the imported branches as necessary. +If you want a shared repository, you will need to make a bare clone +of the imported directory, as described above. Then treat the imported +directory as another development clone for purposes of merging +incremental imports. + Advanced Shared Repository Management ------------------------------------- From 70cff3ac16e842e465f304e7af3b588840899dc9 Mon Sep 17 00:00:00 2001 From: Brian Hetro <whee@smaertness.net> Date: Sat, 5 Jul 2008 01:24:41 -0400 Subject: [PATCH 3/9] builtin-log.c: Use 'git_config_string' to get 'format.subjectprefix' and 'format.suffix' Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin-log.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 9979e37f3..430d87661 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -234,12 +234,8 @@ static int git_log_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "format.pretty")) return git_config_string(&fmt_pretty, var, value); - if (!strcmp(var, "format.subjectprefix")) { - if (!value) - config_error_nonbool(var); - fmt_patch_subject_prefix = xstrdup(value); - return 0; - } + if (!strcmp(var, "format.subjectprefix")) + return git_config_string(&fmt_patch_subject_prefix, var, value); if (!strcmp(var, "log.date")) return git_config_string(&default_date_mode, var, value); if (!strcmp(var, "log.showroot")) { @@ -489,12 +485,8 @@ static int git_format_config(const char *var, const char *value, void *cb) add_header(value); return 0; } - if (!strcmp(var, "format.suffix")) { - if (!value) - return config_error_nonbool(var); - fmt_patch_suffix = xstrdup(value); - return 0; - } + if (!strcmp(var, "format.suffix")) + return git_config_string(&fmt_patch_suffix, var, value); if (!strcmp(var, "format.cc")) { if (!value) return config_error_nonbool(var); From cd8be6c9b64adcb7744aba89bac8ef4261ccacc5 Mon Sep 17 00:00:00 2001 From: Brian Hetro <whee@smaertness.net> Date: Sat, 5 Jul 2008 01:24:42 -0400 Subject: [PATCH 4/9] convert.c: Use 'git_config_string' to get 'smudge' and 'clean' Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- convert.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/convert.c b/convert.c index 1c6684478..352b69d4c 100644 --- a/convert.c +++ b/convert.c @@ -319,8 +319,8 @@ static int apply_filter(const char *path, const char *src, size_t len, static struct convert_driver { const char *name; struct convert_driver *next; - char *smudge; - char *clean; + const char *smudge; + const char *clean; } *user_convert, **user_convert_tail; static int read_convert_config(const char *var, const char *value, void *cb) @@ -358,19 +358,12 @@ static int read_convert_config(const char *var, const char *value, void *cb) * The command-line will not be interpolated in any way. */ - if (!strcmp("smudge", ep)) { - if (!value) - return config_error_nonbool(var); - drv->smudge = strdup(value); - return 0; - } + if (!strcmp("smudge", ep)) + return git_config_string(&drv->smudge, var, value); + + if (!strcmp("clean", ep)) + return git_config_string(&drv->clean, var, value); - if (!strcmp("clean", ep)) { - if (!value) - return config_error_nonbool(var); - drv->clean = strdup(value); - return 0; - } return 0; } @@ -576,7 +569,7 @@ int convert_to_git(const char *path, const char *src, size_t len, struct git_attr_check check[3]; int crlf = CRLF_GUESS; int ident = 0, ret = 0; - char *filter = NULL; + const char *filter = NULL; setup_convert_check(check); if (!git_checkattr(path, ARRAY_SIZE(check), check)) { @@ -606,7 +599,7 @@ int convert_to_working_tree(const char *path, const char *src, size_t len, struc struct git_attr_check check[3]; int crlf = CRLF_GUESS; int ident = 0, ret = 0; - char *filter = NULL; + const char *filter = NULL; setup_convert_check(check); if (!git_checkattr(path, ARRAY_SIZE(check), check)) { From daec808cc61af32de789a31dd5c96001915c3f2d Mon Sep 17 00:00:00 2001 From: Brian Hetro <whee@smaertness.net> Date: Sat, 5 Jul 2008 01:24:43 -0400 Subject: [PATCH 5/9] diff.c: Use 'git_config_string' to get 'diff.external' Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- diff.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/diff.c b/diff.c index f281c5b82..78c4d3a35 100644 --- a/diff.c +++ b/diff.c @@ -153,12 +153,8 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) diff_auto_refresh_index = git_config_bool(var, value); return 0; } - if (!strcmp(var, "diff.external")) { - if (!value) - return config_error_nonbool(var); - external_diff_cmd_cfg = xstrdup(value); - return 0; - } + if (!strcmp(var, "diff.external")) + return git_config_string(&external_diff_cmd_cfg, var, value); if (!prefixcmp(var, "diff.")) { const char *ep = strrchr(var, '.'); From 7ef8ea7035a3be4a97259e53e8dd3c1b8fd81ac0 Mon Sep 17 00:00:00 2001 From: Brian Hetro <whee@smaertness.net> Date: Sat, 5 Jul 2008 01:24:44 -0400 Subject: [PATCH 6/9] http.c: Use 'git_config_string' to clean up SSL config. Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- http.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/http.c b/http.c index ad1464041..1108ab4a3 100644 --- a/http.c +++ b/http.c @@ -13,14 +13,14 @@ static CURL *curl_default; char curl_errorstr[CURL_ERROR_SIZE]; static int curl_ssl_verify = -1; -static char *ssl_cert = NULL; +static const char *ssl_cert = NULL; #if LIBCURL_VERSION_NUM >= 0x070902 -static char *ssl_key = NULL; +static const char *ssl_key = NULL; #endif #if LIBCURL_VERSION_NUM >= 0x070908 -static char *ssl_capath = NULL; +static const char *ssl_capath = NULL; #endif -static char *ssl_cainfo = NULL; +static const char *ssl_cainfo = NULL; static long curl_low_speed_limit = -1; static long curl_low_speed_time = -1; static int curl_ftp_no_epsv = 0; @@ -101,39 +101,27 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.sslcert", var)) { - if (ssl_cert == NULL) { - if (!value) - return config_error_nonbool(var); - ssl_cert = xstrdup(value); - } + if (ssl_cert == NULL) + return git_config_string(&ssl_cert, var, value); return 0; } #if LIBCURL_VERSION_NUM >= 0x070902 if (!strcmp("http.sslkey", var)) { - if (ssl_key == NULL) { - if (!value) - return config_error_nonbool(var); - ssl_key = xstrdup(value); - } + if (ssl_key == NULL) + return git_config_string(&ssl_key, var, value); return 0; } #endif #if LIBCURL_VERSION_NUM >= 0x070908 if (!strcmp("http.sslcapath", var)) { - if (ssl_capath == NULL) { - if (!value) - return config_error_nonbool(var); - ssl_capath = xstrdup(value); - } + if (ssl_capath == NULL) + return git_config_string(&ssl_capath, var, value); return 0; } #endif if (!strcmp("http.sslcainfo", var)) { - if (ssl_cainfo == NULL) { - if (!value) - return config_error_nonbool(var); - ssl_cainfo = xstrdup(value); - } + if (ssl_cainfo == NULL) + return git_config_string(&ssl_cainfo, var, value); return 0; } From 984c6e7ec1f7f6278a207b7d6178962f85130d10 Mon Sep 17 00:00:00 2001 From: Brian Hetro <whee@smaertness.net> Date: Sat, 5 Jul 2008 01:24:40 -0400 Subject: [PATCH 7/9] builtin-commit.c: Use 'git_config_string' to get 'commit.template' Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin-commit.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/builtin-commit.c b/builtin-commit.c index 90200ed64..bcbea3893 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -45,7 +45,8 @@ static enum { COMMIT_PARTIAL, } commit_style; -static char *logfile, *force_author, *template_file; +static char *logfile, *force_author; +static const char *template_file; static char *edit_message, *use_message; static char *author_name, *author_email, *author_date; static int all, edit_flag, also, interactive, only, amend, signoff; @@ -864,12 +865,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1) int git_commit_config(const char *k, const char *v, void *cb) { - if (!strcmp(k, "commit.template")) { - if (!v) - return config_error_nonbool(v); - template_file = xstrdup(v); - return 0; - } + if (!strcmp(k, "commit.template")) + return git_config_string(&template_file, k, v); return git_status_config(k, v, cb); } From 8a33dd8b6e29722e86556c178d7c0b963804f0d3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano <gitster@pobox.com> Date: Sat, 5 Jul 2008 18:14:27 -0700 Subject: [PATCH 8/9] attribute documentation: keep EXAMPLE at end The document gives overall definition of states in DESCRIPTION, describes various aspects of git operations that can be influenced in EFFECTS, and finally gives examples in the EXAMPLE section. Archive creation however was somehow documented after the EXAMPLE section, not insode EFFECTS. Signed-off-by: Junio C Hamano <gitster@pobox.com> --- Documentation/gitattributes.txt | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 471754eb1..ef06d94ca 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -450,6 +450,23 @@ String:: variable. +Creating an archive +~~~~~~~~~~~~~~~~~~~ + +`export-subst` +^^^^^^^^^^^^^^ + +If the attribute `export-subst` is set for a file then git will expand +several placeholders when adding this file to an archive. The +expansion depends on the availability of a commit ID, i.e. if +linkgit:git-archive[1] has been given a tree instead of a commit or a +tag then no replacement will be done. The placeholders are the same +as those for the option `--pretty=format:` of linkgit:git-log[1], +except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` +in the file. E.g. the string `$Format:%H$` will be replaced by the +commit hash. + + EXAMPLE ------- @@ -499,22 +516,6 @@ frotz unspecified ---------------------------------------------------------------- -Creating an archive -~~~~~~~~~~~~~~~~~~~ - -`export-subst` -^^^^^^^^^^^^^^ - -If the attribute `export-subst` is set for a file then git will expand -several placeholders when adding this file to an archive. The -expansion depends on the availability of a commit ID, i.e. if -linkgit:git-archive[1] has been given a tree instead of a commit or a -tag then no replacement will be done. The placeholders are the same -as those for the option `--pretty=format:` of linkgit:git-log[1], -except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` -in the file. E.g. the string `$Format:%H$` will be replaced by the -commit hash. - GIT --- From 9b373229506c9f563b2e2f053c3f1d932789fbfd Mon Sep 17 00:00:00 2001 From: Junio C Hamano <gitster@pobox.com> Date: Sat, 5 Jul 2008 17:58:50 -0700 Subject: [PATCH 9/9] clone -q: honor "quiet" option over native transports. The earlier built-in conversion seems to have broken "git-clone"; this teaches the command to honor the "-q" option again when talking to the remote end over native transports (file://, git:// and ssh://). Signed-off-by: Junio C Hamano <gitster@pobox.com> --- transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transport.c b/transport.c index 3ff851935..6f549b336 100644 --- a/transport.c +++ b/transport.c @@ -645,7 +645,9 @@ static int fetch_refs_via_pack(struct transport *transport, args.lock_pack = 1; args.use_thin_pack = data->thin; args.include_tag = data->followtags; - args.verbose = transport->verbose > 0; + args.verbose = (transport->verbose > 0); + args.quiet = args.no_progress = (transport->verbose < 0); + args.no_progress = !isatty(1); args.depth = data->depth; for (i = 0; i < nr_heads; i++)