From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "René Scharfe" <l.s.r@web.de>,
"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Duy Nguyen" <pclouds@gmail.com>,
"Git Mailing List" <git@vger.kernel.org>,
"Ralf Thielow" <ralf.thielow@gmail.com>,
"Taufiq Hoven" <taufiq.hoven@gmail.com>
Subject: Re: [PATCH 2/3] stripspace: respect repository config
Date: Tue, 22 Nov 2016 12:24:15 -0800 [thread overview]
Message-ID: <xmqqoa17p8k0.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20161122195015.rztaixpz7zvdxb4u@sigill.intra.peff.net> (Jeff King's message of "Tue, 22 Nov 2016 14:50:15 -0500")
Jeff King <peff@peff.net> writes:
> So what do you want to do for v2.11? I think there are minor regressions
> in stripspace, archive, and mailinfo with respect to reading
> .git/config. The right solution in each case is to do a gentle repo
> setup. We have patches for stripspace already, but not yet for the other
> two. They _should_ be fairly trivial, but we are getting awfully close
> to the release.
Right.
> Do you want to do another round of -rc3? Ship with the
> minor regressions and fix them up in v2.11.1?
I am leaning towards the former (though we may also end up doing the
latter).
Here is an initial attempt. It turns out that write_archive() must
be callable outside a repository to respond to "git archive --list",
which happens in parse_archive_args(), and the "have-repository?"
check cannot be moved before that to the caller.
No tests yet. Help appreciated ;-)
archive.c | 9 ++-------
archive.h | 2 +-
builtin/archive.c | 6 +++---
builtin/upload-archive.c | 2 +-
git.c | 4 ++--
5 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/archive.c b/archive.c
index dde1ab4c79..901b10264f 100644
--- a/archive.c
+++ b/archive.c
@@ -504,15 +504,11 @@ static int parse_archive_args(int argc, const char **argv,
}
int write_archive(int argc, const char **argv, const char *prefix,
- int setup_prefix, const char *name_hint, int remote)
+ const char *name_hint, int remote)
{
- int nongit = 0;
const struct archiver *ar = NULL;
struct archiver_args args;
- if (setup_prefix && prefix == NULL)
- prefix = setup_git_directory_gently(&nongit);
-
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
git_config(git_default_config, NULL);
@@ -520,7 +516,7 @@ int write_archive(int argc, const char **argv, const char *prefix,
init_zip_archiver();
argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote);
- if (nongit) {
+ if (!startup_info->have_repository) {
/*
* We know this will die() with an error, so we could just
* die ourselves; but its error message will be more specific
@@ -528,7 +524,6 @@ int write_archive(int argc, const char **argv, const char *prefix,
*/
setup_git_directory();
}
-
parse_treeish_arg(argv, &args, prefix, remote);
parse_pathspec_arg(argv + 1, &args);
diff --git a/archive.h b/archive.h
index 4a791e1fed..415e0152e2 100644
--- a/archive.h
+++ b/archive.h
@@ -36,7 +36,7 @@ typedef int (*write_archive_entry_fn_t)(struct archiver_args *args,
unsigned int mode);
extern int write_archive_entries(struct archiver_args *args, write_archive_entry_fn_t write_entry);
-extern int write_archive(int argc, const char **argv, const char *prefix, int setup_prefix, const char *name_hint, int remote);
+extern int write_archive(int argc, const char **argv, const char *prefix, const char *name_hint, int remote);
const char *archive_format_from_filename(const char *filename);
extern void *sha1_file_to_archive(const struct archiver_args *args,
diff --git a/builtin/archive.c b/builtin/archive.c
index 49f491413a..f863465a0f 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -85,8 +85,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
const char *output = NULL;
const char *remote = NULL;
struct option local_opts[] = {
- OPT_STRING('o', "output", &output, N_("file"),
- N_("write the archive to this file")),
+ OPT_FILENAME('o', "output", &output,
+ N_("write the archive to this file")),
OPT_STRING(0, "remote", &remote, N_("repo"),
N_("retrieve the archive from remote repository <repo>")),
OPT_STRING(0, "exec", &exec, N_("command"),
@@ -105,5 +105,5 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
- return write_archive(argc, argv, prefix, 1, output, 0);
+ return write_archive(argc, argv, prefix, output, 0);
}
diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
index dc872f6a94..cde06977b7 100644
--- a/builtin/upload-archive.c
+++ b/builtin/upload-archive.c
@@ -43,7 +43,7 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
}
/* parse all options sent by the client */
- return write_archive(sent_argv.argc, sent_argv.argv, prefix, 0, NULL, 1);
+ return write_archive(sent_argv.argc, sent_argv.argv, prefix, NULL, 1);
}
__attribute__((format (printf, 1, 2)))
diff --git a/git.c b/git.c
index efa1059fe0..e8b2baf2d1 100644
--- a/git.c
+++ b/git.c
@@ -396,7 +396,7 @@ static struct cmd_struct commands[] = {
{ "am", cmd_am, RUN_SETUP | NEED_WORK_TREE },
{ "annotate", cmd_annotate, RUN_SETUP },
{ "apply", cmd_apply, RUN_SETUP_GENTLY },
- { "archive", cmd_archive },
+ { "archive", cmd_archive, RUN_SETUP_GENTLY },
{ "bisect--helper", cmd_bisect__helper, RUN_SETUP },
{ "blame", cmd_blame, RUN_SETUP },
{ "branch", cmd_branch, RUN_SETUP },
@@ -445,7 +445,7 @@ static struct cmd_struct commands[] = {
{ "ls-files", cmd_ls_files, RUN_SETUP | SUPPORT_SUPER_PREFIX },
{ "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
- { "mailinfo", cmd_mailinfo },
+ { "mailinfo", cmd_mailinfo, RUN_SETUP_GENTLY },
{ "mailsplit", cmd_mailsplit },
{ "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
{ "merge-base", cmd_merge_base, RUN_SETUP },
next prev parent reply other threads:[~2016-11-22 20:24 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 14:18 [PATCH 0/3] Fix problems with rebase -i when core.commentchar is defined Johannes Schindelin
2016-11-21 14:18 ` [PATCH 1/3] rebase -i: identify problems with core.commentchar Johannes Schindelin
2016-11-21 18:15 ` Junio C Hamano
2016-11-21 18:24 ` Junio C Hamano
2016-11-21 19:05 ` [PATCH 1/3] rebase -i: highlight " Junio C Hamano
2016-11-21 19:05 ` [PATCH 2/3] stripspace: respect repository config Junio C Hamano
2016-11-21 20:28 ` Junio C Hamano
2016-11-22 16:11 ` Johannes Schindelin
2016-11-21 19:05 ` [PATCH 3/3] rebase -i: handle core.commentChar=auto Junio C Hamano
2016-11-21 20:29 ` Junio C Hamano
2016-11-21 20:25 ` [PATCH 1/3] rebase -i: highlight problems with core.commentchar Junio C Hamano
2016-11-22 16:09 ` Johannes Schindelin
2016-11-22 17:05 ` Junio C Hamano
2016-11-23 11:05 ` Johannes Schindelin
2016-11-21 18:49 ` [PATCH 1/3] rebase -i: identify " Jeff King
2016-11-21 19:12 ` Junio C Hamano
2016-11-21 23:38 ` Jeff King
2016-11-22 16:09 ` Johannes Schindelin
2016-11-21 14:18 ` [PATCH 2/3] stripspace: respect repository config Johannes Schindelin
2016-11-22 10:10 ` Duy Nguyen
2016-11-22 16:13 ` Johannes Schindelin
2016-11-22 17:10 ` Junio C Hamano
2016-11-22 19:10 ` Junio C Hamano
2016-11-22 19:50 ` Jeff King
2016-11-22 20:24 ` Junio C Hamano [this message]
2016-11-22 21:19 ` Jeff King
2016-11-22 21:22 ` Junio C Hamano
2016-11-22 21:43 ` Jeff King
2016-11-22 21:55 ` Junio C Hamano
2016-11-23 0:12 ` Jeff King
2016-11-22 21:24 ` Jeff King
2016-11-21 14:18 ` [PATCH 3/3] rebase -i: handle core.commentChar=auto Johannes Schindelin
2016-11-21 18:26 ` Johannes Sixt
2016-11-21 18:40 ` Junio C Hamano
2016-11-21 18:58 ` Johannes Sixt
2016-11-21 19:07 ` Junio C Hamano
2016-11-21 19:14 ` Johannes Sixt
2016-11-22 16:04 ` Johannes Schindelin
2016-11-22 10:31 ` Duy Nguyen
2016-11-21 16:58 ` [PATCH 0/3] Fix problems with rebase -i when core.commentchar is defined Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqoa17p8k0.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=ralf.thielow@gmail.com \
--cc=taufiq.hoven@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).