Skip to content

Commit

Permalink
Merge 'update/virtual-file-system'
Browse files Browse the repository at this point in the history
Update the virtualfilesystem support to specify it needs to be run from
the root of the git work tree. This enables the hook to be found even if
the current working directory is not the root of the repo (like when
running 'git diff' with Beyond Compare configured as the diff tool).

Also simplify how argv[] parameter is created to match the model
currently accepted in master.
  • Loading branch information
dscho committed Nov 21, 2018
2 parents b6a592b + 424ba3b commit 8c25aba
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions virtualfilesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,14 @@ static int vfs_hashmap_cmp(const void *unused_cmp_data,
static void get_virtual_filesystem_data(struct strbuf *vfs_data)
{
struct child_process cp = CHILD_PROCESS_INIT;
char ver[64];
const char *argv[3];
int err;

strbuf_init(vfs_data, 0);

snprintf(ver, sizeof(ver), "%d", HOOK_INTERFACE_VERSION);
argv[0] = core_virtualfilesystem;
argv[1] = ver;
argv[2] = NULL;
cp.argv = argv;
argv_array_push(&cp.args, core_virtualfilesystem);
argv_array_pushf(&cp.args, "%d", HOOK_INTERFACE_VERSION);
cp.use_shell = 1;
cp.dir = get_git_work_tree();

err = capture_command(&cp, vfs_data, 1024);
if (err)
Expand Down

0 comments on commit 8c25aba

Please sign in to comment.