Staging
v0.8.1
Revision f2d0df7148a1b9ee69bd69a365ffcd1965872451 authored by Shawn Bohrer on 15 April 2008, 03:14:09 UTC, committed by Junio C Hamano on 15 April 2008, 06:14:58 UTC
When git clean is run from a subdirectory it should follow the normal
policy and only remove directories if they are passed in as a pathspec,
or -d is specified.

The fix is to send len which could be shorter than ent->len because we
have stripped the trailing '/' that read_directory adds. Additionaly
match_one() was modified to allow a name[] that is not NUL terminated.
This allows us to check if the name matched the pathspec exactly
instead of recursively.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f669ac0
Raw File
builtin-diff-files.c
/*
 * GIT - The information manager from hell
 *
 * Copyright (C) Linus Torvalds, 2005
 */
#include "cache.h"
#include "diff.h"
#include "commit.h"
#include "revision.h"
#include "builtin.h"

static const char diff_files_usage[] =
"git-diff-files [-q] [-0/-1/2/3 |-c|--cc|--no-index] [<common diff options>] [<path>...]"
COMMON_DIFF_OPTIONS_HELP;

int cmd_diff_files(int argc, const char **argv, const char *prefix)
{
	struct rev_info rev;
	int nongit;
	int result;

	prefix = setup_git_directory_gently(&nongit);
	init_revisions(&rev, prefix);
	git_config(git_diff_basic_config); /* no "diff" UI options */
	rev.abbrev = 0;

	if (!setup_diff_no_index(&rev, argc, argv, nongit, prefix))
		argc = 0;
	else
		argc = setup_revisions(argc, argv, &rev, NULL);
	if (!rev.diffopt.output_format)
		rev.diffopt.output_format = DIFF_FORMAT_RAW;
	result = run_diff_files_cmd(&rev, argc, argv);
	return diff_result_code(&rev.diffopt, result);
}
back to top