From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/2] SQUASH??? Undecided
Date: Thu, 15 Sep 2016 13:51:09 -0700 [thread overview]
Message-ID: <20160915205109.12240-3-gitster@pobox.com> (raw)
In-Reply-To: <20160915205109.12240-1-gitster@pobox.com>
If we were to follow the convention to leave an optional string
variable to NULL, we'd need to do this on top. I am not sure if it
is a good change, though.
---
builtin/ls-files.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 6e78c71..687e475 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -29,7 +29,7 @@ static int show_valid_bit;
static int line_terminator = '\n';
static int debug_mode;
static int show_eol;
-static const char *output_path_prefix = "";
+static const char *output_path_prefix;
static int recurse_submodules;
static const char *prefix;
@@ -78,7 +78,7 @@ static void write_name(const char *name)
* churn.
*/
static struct strbuf full_name = STRBUF_INIT;
- if (*output_path_prefix) {
+ if (output_path_prefix && *output_path_prefix) {
strbuf_reset(&full_name);
strbuf_addstr(&full_name, output_path_prefix);
strbuf_addstr(&full_name, name);
@@ -181,7 +181,8 @@ static void show_gitlink(const struct cache_entry *ce)
argv_array_push(&cp.args, "ls-files");
argv_array_push(&cp.args, "--recurse-submodules");
argv_array_pushf(&cp.args, "--output-path-prefix=%s%s/",
- output_path_prefix, ce->name);
+ output_path_prefix ? output_path_prefix : "",
+ ce->name);
cp.git_cmd = 1;
cp.dir = ce->name;
status = run_command(&cp);
--
2.10.0-458-g97b4043
next prev parent reply other threads:[~2016-09-15 20:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-09 21:53 [RFC/PATCH] ls-files: adding support for submodules Brandon Williams
2016-09-09 22:35 ` Jeff King
2016-09-09 22:40 ` Junio C Hamano
2016-09-09 23:01 ` Junio C Hamano
2016-09-09 23:47 ` Stefan Beller
2016-09-11 22:10 ` Junio C Hamano
2016-09-12 0:51 ` Jeff King
2016-09-12 0:52 ` Jeff King
2016-09-12 16:01 ` Junio C Hamano
[not found] ` <CAKoko1oSEac_Nr1SkRB=dM_r3Jnew1Et2ZKj716iU3JLyHe2GQ@mail.gmail.com>
2016-09-12 17:39 ` Brandon Williams
2016-09-12 1:47 ` Junio C Hamano
2016-09-13 0:33 ` [PATCH v2] " Brandon Williams
2016-09-13 3:35 ` Brandon Williams
2016-09-13 16:31 ` Junio C Hamano
2016-09-15 20:51 ` Junio C Hamano
2016-09-15 20:51 ` [PATCH 1/2] SQUASH??? Junio C Hamano
2016-09-15 20:51 ` Junio C Hamano [this message]
2016-09-15 21:12 ` [PATCH 2/2] SQUASH??? Undecided Stefan Beller
2016-09-15 21:37 ` Brandon Williams
2016-09-15 20:57 ` [PATCH v2] ls-files: adding support for submodules Junio C Hamano
2016-09-15 20:58 ` Junio C Hamano
2016-09-15 20:58 ` Junio C Hamano
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=20160915205109.12240-3-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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).