Merge branch 'rs/maint-archive-prefix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 9 Oct 2009 23:27:16 +0000 (16:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Oct 2009 23:27:16 +0000 (16:27 -0700)
* rs/maint-archive-prefix:
Git archive and trailing "/" in prefix

1  2 
archive.c
diff --combined archive.c
index 73b8e8a56db460dbbd2fb32ae2f4bf297c93dc67,57ac65e5ca078a974233126ef9480b2008a84946..0cc79d2a240ac260fec66e6c30e28b438bcb5948
+++ b/archive.c
@@@ -115,6 -115,7 +115,7 @@@ static int write_archive_entry(const un
  
        strbuf_reset(&path);
        strbuf_grow(&path, PATH_MAX);
+       strbuf_add(&path, args->base, args->baselen);
        strbuf_add(&path, base, baselen);
        strbuf_addstr(&path, filename);
        path_without_prefix = path.buf + args->baselen;
@@@ -187,8 -188,8 +188,8 @@@ int write_archive_entries(struct archiv
                git_attr_set_direction(GIT_ATTR_INDEX, &the_index);
        }
  
-       err =  read_tree_recursive(args->tree, args->base, args->baselen, 0,
-                       args->pathspec, write_archive_entry, &context);
+       err = read_tree_recursive(args->tree, "", 0, 0, args->pathspec,
+                                 write_archive_entry, &context);
        if (err == READ_TREE_RECURSIVE)
                err = 0;
        return err;
@@@ -211,7 -212,7 +212,7 @@@ static const struct archiver *lookup_ar
  static void parse_pathspec_arg(const char **pathspec,
                struct archiver_args *ar_args)
  {
-       ar_args->pathspec = get_pathspec(ar_args->base, pathspec);
+       ar_args->pathspec = get_pathspec("", pathspec);
  }
  
  static void parse_treeish_arg(const char **argv,
@@@ -283,7 -284,7 +284,7 @@@ static int parse_archive_args(int argc
                OPT_STRING(0, "format", &format, "fmt", "archive format"),
                OPT_STRING(0, "prefix", &base, "prefix",
                        "prepend prefix to each pathname in the archive"),
 -              OPT_STRING(0, "output", &output, "file",
 +              OPT_STRING('o', "output", &output, "file",
                        "write the archive to this file"),
                OPT_BOOLEAN(0, "worktree-attributes", &worktree_attributes,
                        "read .gitattributes in working directory"),