From 2b2da6846370978123935258890a059167dc73bd Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Sat, 5 Jul 2008 02:00:13 +0200 Subject: [PATCH 01/13] 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 ec37555794..69e6d2fa44 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 02/13] 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 2f9b35f622..93b7d2dc99 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 3310ae25ff..19da87e71d 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 1db3f52945..0325d6759d 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 03/13] 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 9979e37f38..430d87661e 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 04/13] 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 1c66844783..352b69d4ce 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 05/13] 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 f281c5b82a..78c4d3a35a 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 06/13] 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 ad14640412..1108ab4a31 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 07/13] 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 90200ed643..bcbea3893b 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 08/13] 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 471754eb12..ef06d94ca8 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 09/13] 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 3ff851935f..6f549b336b 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++) From 3ecb171d2b9aca7b09bf112594977d00925893b4 Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sun, 6 Jul 2008 06:10:04 +0200 Subject: [PATCH 10/13] Fix "config_error_nonbool" used with value instead of key The function "config_error_nonbool", that is defined in "config.c", is used to report an error when a config key in the config file should have a corresponding value but it hasn't. So the parameter to this function should be the key and not the value, because the value is undefined. And it could crash if the value is used. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin-tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin-tag.c b/builtin-tag.c index e675206de3..3c97c696a5 100644 --- a/builtin-tag.c +++ b/builtin-tag.c @@ -260,7 +260,7 @@ static int git_tag_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "user.signingkey")) { if (!value) - return config_error_nonbool(value); + return config_error_nonbool(var); set_signingkey(value); return 0; } From 77cb7bc23294851e2b64307e33d2a0d97fee9b2d Mon Sep 17 00:00:00 2001 From: Alex Riesen <raa.lkml@gmail.com> Date: Mon, 7 Jul 2008 00:56:49 +0200 Subject: [PATCH 11/13] git-clone: remove leftover debugging fprintf(). Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin-clone.c | 1 - 1 file changed, 1 deletion(-) diff --git a/builtin-clone.c b/builtin-clone.c index e9ecb5d21a..7bcc664e44 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -417,7 +417,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix) die("could not create leading directories of '%s'", git_dir); set_git_dir(make_absolute_path(git_dir)); - fprintf(stderr, "Initialize %s\n", git_dir); init_db(option_template, option_quiet ? INIT_DB_QUIET : 0); /* From 6fc2a25e6215f1b1916a3da93bf7ddace8ba5310 Mon Sep 17 00:00:00 2001 From: Junio C Hamano <gitster@pobox.com> Date: Sun, 6 Jul 2008 22:26:45 -0700 Subject: [PATCH 12/13] mailinfo: feed the correct line length to decode_transfer_encoding() When handling a MIME multipart message, multi-part boundary lines are eaten by a call to handle_boundary() function from the main loop of handle_body(), and after that happens, we should update the line length correctly, because handle_boundary() udpates line[] with new data. This was caused by a thinko in 9aa2309 (mailinfo: apply the same fix not to lose NULs in BASE64 and QP codepaths, 2008-05-25). Signed-off-by: Junio C Hamano <gitster@pobox.com> --- builtin-mailinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c index 97c1ff9744..fa6e8f90a4 100644 --- a/builtin-mailinfo.c +++ b/builtin-mailinfo.c @@ -812,6 +812,7 @@ static void handle_body(void) np - newline); if (!handle_boundary()) return; + len = strlen(line); } /* Unwrap transfer encoding */ From 2fe403e7452bd6e1e8232445cf5434ce8f1af973 Mon Sep 17 00:00:00 2001 From: Gerrit Pape <pape@smarden.org> Date: Sun, 6 Jul 2008 19:28:50 +0000 Subject: [PATCH 13/13] git-svn.perl: workaround assertions in svn library 1.5.0 With subversion 1.5.0 (C and perl libraries) the git-svn selftest t9101-git-svn-props.sh fails at test 25 and 26. The following commands cause assertions in the svn library $ cd deeply $ git-svn propget svn:ignore . perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_ra/ra_loader.c:674: svn_ra_get_dir: Assertion `*path != '/'' failed. Aborted $ git-svn propget svn:ignore .. perl: /build/buildd/subversion-1.5.0dfsg1/subversion/libsvn_subr/path.c:120: svn_path_join: Assertion `is_canonical(component, clen)' failed. With this commit, git-svn makes sure the path doesn't start with a slash, and is not a dot, working around these assertions. The breakage was reported by Lucas Nussbaum through http://bugs.debian.org/489108 Signed-off-by: Gerrit Pape <pape@smarden.org> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- git-svn.perl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git-svn.perl b/git-svn.perl index f789a6eeca..a366c891dc 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -643,6 +643,8 @@ sub canonicalize_path { $path =~ s#/[^/]+/\.\.##g; $path =~ s#/$##g; $path =~ s#^\./## if $dot_slash_added; + $path =~ s#^/##; + $path =~ s#^\.$##; return $path; }