Browse Source
These used to be for manipulating the in-memory repo_tree structure, but nowadays they are convenience wrappers to handle a few git-vs-svn mismatches: 1. Git does not track empty directories but Subversion does. When looking up a path in git that Subversion thinks exists and finding nothing, we can safely assume that the path represents a directory. This is needed when a later Subversion revision modifies that directory. 2. Subversion allows deleting a file by copying. In Git fast-import we have to handle that more explicitly as a deletion. These are details of the tool's interaction with git fast-import. Move them to fast_export.c, where other such details are handled. This way the function names do not start with a repo_ prefix that would clash with the repository object introduced in v2.14.0-rc0~38^2~16 (repository: introduce the repository object, 2017-06-22) or an svn_ prefix that would clash with libsvn (in case someone wants to link this code with libsvn some day). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
Jonathan Nieder
8 years ago
committed by
Junio C Hamano
6 changed files with 39 additions and 55 deletions
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
/* |
||||
* Licensed under a two-clause BSD-style license. |
||||
* See LICENSE for details. |
||||
*/ |
||||
|
||||
#include "git-compat-util.h" |
||||
#include "strbuf.h" |
||||
#include "repo_tree.h" |
||||
#include "fast_export.h" |
||||
|
||||
const char *svn_repo_read_path(const char *path, uint32_t *mode_out) |
||||
{ |
||||
int err; |
||||
static struct strbuf buf = STRBUF_INIT; |
||||
|
||||
strbuf_reset(&buf); |
||||
err = fast_export_ls(path, mode_out, &buf); |
||||
if (err) { |
||||
if (errno != ENOENT) |
||||
die_errno("BUG: unexpected fast_export_ls error"); |
||||
/* Treat missing paths as directories. */ |
||||
*mode_out = S_IFDIR; |
||||
return NULL; |
||||
} |
||||
return buf.buf; |
||||
} |
||||
|
||||
void svn_repo_copy(uint32_t revision, const char *src, const char *dst) |
||||
{ |
||||
int err; |
||||
uint32_t mode; |
||||
static struct strbuf data = STRBUF_INIT; |
||||
|
||||
strbuf_reset(&data); |
||||
err = fast_export_ls_rev(revision, src, &mode, &data); |
||||
if (err) { |
||||
if (errno != ENOENT) |
||||
die_errno("BUG: unexpected fast_export_ls_rev error"); |
||||
fast_export_delete(dst); |
||||
return; |
||||
} |
||||
fast_export_modify(dst, mode, data.buf); |
||||
} |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
#ifndef REPO_TREE_H_ |
||||
#define REPO_TREE_H_ |
||||
|
||||
void svn_repo_copy(uint32_t revision, const char *src, const char *dst); |
||||
const char *svn_repo_read_path(const char *path, uint32_t *mode_out); |
||||
|
||||
#endif |
Loading…
Reference in new issue