From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <junkio@cox.net>
Cc: Andy Parkins <andyparkins@gmail.com>,
git@vger.kernel.org, Nick Williams <njw@jarb.freeserve.co.uk>
Subject: Re: [PATCH] git-archive: document CWD effect
Date: Wed, 11 Apr 2007 22:36:16 +0200 [thread overview]
Message-ID: <461D46C0.6080702@lsrfire.ath.cx> (raw)
In-Reply-To: <7v8xczvr13.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano schrieb:
> And I think most people find it natural if you give them the whole
> tree no matter where they start from.
Well, I can't argue against that, as I don't have any numbers. But I
can understand this expectation a bit ("archive HEAD!" -- "here is an
ear" might be confusing ;).
> You could:
>
> $ git archive HEAD -- t/howto
>
> to have a narrowed tarball, and even if you make:
>
> $ cd t/howto $ git archive HEAD
>
> to produce the whole tree, the user can still do:
>
> $ cd t/howto $ git archive HEAD -- .
>
> to get the narrowed tree if the command understands the prefix it
> receives from git_setup_directory().
>
> So while I understand when you say this is "another input method",
> letting people in a deep directory to abbreviate their cwd with "."
> would equally a good input method, and probably better than the
> current implementation, which leaves people without a single way to
> say "I want the whole tree" without cd'ing up.
Hmm, switching the feature's default mode around instead of cutting it
off completely might be a good idea. Something like this? Unlike the
current implementation, it always writes the full path from the repo
root for each file.
René
diff --git a/builtin-archive.c b/builtin-archive.c
index 7f4e409..efa8679 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -128,18 +128,6 @@ void parse_treeish_arg(const char **argv, struct archiver_args *ar_args,
if (tree == NULL)
die("not a tree object");
- if (prefix) {
- unsigned char tree_sha1[20];
- unsigned int mode;
- int err;
-
- err = get_tree_entry(tree->object.sha1, prefix,
- tree_sha1, &mode);
- if (err || !S_ISDIR(mode))
- die("current working directory is untracked");
-
- tree = parse_tree_indirect(tree_sha1);
- }
ar_args->tree = tree;
ar_args->commit_sha1 = commit_sha1;
ar_args->time = archive_time;
@@ -241,6 +229,7 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
struct archiver ar;
int tree_idx;
const char *remote = NULL;
+ const char **pathspec;
remote = extract_remote_arg(&argc, argv);
if (remote)
@@ -255,7 +244,11 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
argv += tree_idx;
parse_treeish_arg(argv, &ar.args, prefix);
- parse_pathspec_arg(argv + 1, &ar.args);
+
+ pathspec = argv + 1;
+ if (*pathspec && prefix)
+ pathspec = get_pathspec(prefix, pathspec);
+ parse_pathspec_arg(pathspec, &ar.args);
return ar.write_archive(&ar.args);
}
prev parent reply other threads:[~2007-04-11 20:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-03 16:07 bug in git-archive? Nick Williams
2007-03-03 16:09 ` Johannes Schindelin
2007-04-08 12:28 ` [PATCH] git-archive: document CWD effect René Scharfe
2007-04-08 23:21 ` Junio C Hamano
2007-04-09 15:04 ` René Scharfe
2007-04-09 20:00 ` Junio C Hamano
2007-04-09 20:37 ` Andy Parkins
2007-04-10 14:24 ` René Scharfe
2007-04-10 21:49 ` Junio C Hamano
2007-04-11 20:36 ` René Scharfe [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=461D46C0.6080702@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=njw@jarb.freeserve.co.uk \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.