Merge branch 'maint'
* maint: index-pack: setup git repository Suppress some bash redirection error messages Fix a warning (on cygwin) to allow -Werror Fix "git log -i --grep"
This commit is contained in:
commit
0f7a8f2dba
@ -417,7 +417,8 @@ static void export_marks(char *file)
|
|||||||
for (i = 0; i < idnums.size; i++) {
|
for (i = 0; i < idnums.size; i++) {
|
||||||
if (deco->base && deco->base->type == 1) {
|
if (deco->base && deco->base->type == 1) {
|
||||||
mark = ptr_to_mark(deco->decoration);
|
mark = ptr_to_mark(deco->decoration);
|
||||||
fprintf(f, ":%u %s\n", mark, sha1_to_hex(deco->base->sha1));
|
fprintf(f, ":%"PRIu32" %s\n", mark,
|
||||||
|
sha1_to_hex(deco->base->sha1));
|
||||||
}
|
}
|
||||||
deco++;
|
deco++;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +645,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
|||||||
revs.diff)
|
revs.diff)
|
||||||
usage(rev_list_usage);
|
usage(rev_list_usage);
|
||||||
|
|
||||||
save_commit_buffer = revs.verbose_header || revs.grep_filter;
|
save_commit_buffer = revs.verbose_header ||
|
||||||
|
revs.grep_filter.pattern_list;
|
||||||
if (bisect_list)
|
if (bisect_list)
|
||||||
revs.limited = 1;
|
revs.limited = 1;
|
||||||
|
|
||||||
|
@ -876,7 +876,9 @@ int main(int argc, char **argv)
|
|||||||
char *index_name_buf = NULL, *keep_name_buf = NULL;
|
char *index_name_buf = NULL, *keep_name_buf = NULL;
|
||||||
struct pack_idx_entry **idx_objects;
|
struct pack_idx_entry **idx_objects;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
int nongit = 0;
|
||||||
|
|
||||||
|
setup_git_directory_gently(&nongit);
|
||||||
git_config(git_index_pack_config, NULL);
|
git_config(git_index_pack_config, NULL);
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
|
34
revision.c
34
revision.c
@ -782,6 +782,10 @@ void init_revisions(struct rev_info *revs, const char *prefix)
|
|||||||
|
|
||||||
revs->commit_format = CMIT_FMT_DEFAULT;
|
revs->commit_format = CMIT_FMT_DEFAULT;
|
||||||
|
|
||||||
|
revs->grep_filter.status_only = 1;
|
||||||
|
revs->grep_filter.pattern_tail = &(revs->grep_filter.pattern_list);
|
||||||
|
revs->grep_filter.regflags = REG_NEWLINE;
|
||||||
|
|
||||||
diff_setup(&revs->diffopt);
|
diff_setup(&revs->diffopt);
|
||||||
if (prefix && !revs->diffopt.prefix) {
|
if (prefix && !revs->diffopt.prefix) {
|
||||||
revs->diffopt.prefix = prefix;
|
revs->diffopt.prefix = prefix;
|
||||||
@ -946,15 +950,7 @@ void read_revisions_from_stdin(struct rev_info *revs)
|
|||||||
|
|
||||||
static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token what)
|
static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token what)
|
||||||
{
|
{
|
||||||
if (!revs->grep_filter) {
|
append_grep_pattern(&revs->grep_filter, ptn, "command line", 0, what);
|
||||||
struct grep_opt *opt = xcalloc(1, sizeof(*opt));
|
|
||||||
opt->status_only = 1;
|
|
||||||
opt->pattern_tail = &(opt->pattern_list);
|
|
||||||
opt->regflags = REG_NEWLINE;
|
|
||||||
revs->grep_filter = opt;
|
|
||||||
}
|
|
||||||
append_grep_pattern(revs->grep_filter, ptn,
|
|
||||||
"command line", 0, what);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_header_grep(struct rev_info *revs, const char *field, const char *pattern)
|
static void add_header_grep(struct rev_info *revs, const char *field, const char *pattern)
|
||||||
@ -1164,17 +1160,13 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
|||||||
} else if (!prefixcmp(arg, "--grep=")) {
|
} else if (!prefixcmp(arg, "--grep=")) {
|
||||||
add_message_grep(revs, arg+7);
|
add_message_grep(revs, arg+7);
|
||||||
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
|
} else if (!strcmp(arg, "--extended-regexp") || !strcmp(arg, "-E")) {
|
||||||
if (revs->grep_filter)
|
revs->grep_filter.regflags |= REG_EXTENDED;
|
||||||
revs->grep_filter->regflags |= REG_EXTENDED;
|
|
||||||
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
|
} else if (!strcmp(arg, "--regexp-ignore-case") || !strcmp(arg, "-i")) {
|
||||||
if (revs->grep_filter)
|
revs->grep_filter.regflags |= REG_ICASE;
|
||||||
revs->grep_filter->regflags |= REG_ICASE;
|
|
||||||
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
|
} else if (!strcmp(arg, "--fixed-strings") || !strcmp(arg, "-F")) {
|
||||||
if (revs->grep_filter)
|
revs->grep_filter.fixed = 1;
|
||||||
revs->grep_filter->fixed = 1;
|
|
||||||
} else if (!strcmp(arg, "--all-match")) {
|
} else if (!strcmp(arg, "--all-match")) {
|
||||||
if (revs->grep_filter)
|
revs->grep_filter.all_match = 1;
|
||||||
revs->grep_filter->all_match = 1;
|
|
||||||
} else if (!prefixcmp(arg, "--encoding=")) {
|
} else if (!prefixcmp(arg, "--encoding=")) {
|
||||||
arg += 11;
|
arg += 11;
|
||||||
if (strcmp(arg, "none"))
|
if (strcmp(arg, "none"))
|
||||||
@ -1349,9 +1341,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
|||||||
if (diff_setup_done(&revs->diffopt) < 0)
|
if (diff_setup_done(&revs->diffopt) < 0)
|
||||||
die("diff_setup_done failed");
|
die("diff_setup_done failed");
|
||||||
|
|
||||||
if (revs->grep_filter) {
|
compile_grep_patterns(&revs->grep_filter);
|
||||||
compile_grep_patterns(revs->grep_filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (revs->reverse && revs->reflog_info)
|
if (revs->reverse && revs->reflog_info)
|
||||||
die("cannot combine --reverse with --walk-reflogs");
|
die("cannot combine --reverse with --walk-reflogs");
|
||||||
@ -1492,9 +1482,9 @@ static int rewrite_parents(struct rev_info *revs, struct commit *commit)
|
|||||||
|
|
||||||
static int commit_match(struct commit *commit, struct rev_info *opt)
|
static int commit_match(struct commit *commit, struct rev_info *opt)
|
||||||
{
|
{
|
||||||
if (!opt->grep_filter)
|
if (!opt->grep_filter.pattern_list)
|
||||||
return 1;
|
return 1;
|
||||||
return grep_buffer(opt->grep_filter,
|
return grep_buffer(&opt->grep_filter,
|
||||||
NULL, /* we say nothing, not even filename */
|
NULL, /* we say nothing, not even filename */
|
||||||
commit->buffer, strlen(commit->buffer));
|
commit->buffer, strlen(commit->buffer));
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define REVISION_H
|
#define REVISION_H
|
||||||
|
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
#include "grep.h"
|
||||||
|
|
||||||
#define SEEN (1u<<0)
|
#define SEEN (1u<<0)
|
||||||
#define UNINTERESTING (1u<<1)
|
#define UNINTERESTING (1u<<1)
|
||||||
@ -92,7 +93,7 @@ struct rev_info {
|
|||||||
int show_log_size;
|
int show_log_size;
|
||||||
|
|
||||||
/* Filter by commit log message */
|
/* Filter by commit log message */
|
||||||
struct grep_opt *grep_filter;
|
struct grep_opt grep_filter;
|
||||||
|
|
||||||
/* Display history graph */
|
/* Display history graph */
|
||||||
struct git_graph *graph;
|
struct git_graph *graph;
|
||||||
|
@ -21,7 +21,7 @@ cat >"$p0" <<\EOF
|
|||||||
3. A quick brown fox jumps over the lazy cat, oops dog.
|
3. A quick brown fox jumps over the lazy cat, oops dog.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >"$p1" "$p0"
|
cat 2>/dev/null >"$p1" "$p0"
|
||||||
echo 'Foo Bar Baz' >"$p2"
|
echo 'Foo Bar Baz' >"$p2"
|
||||||
|
|
||||||
test -f "$p1" && cmp "$p0" "$p1" || {
|
test -f "$p1" && cmp "$p0" "$p1" || {
|
||||||
|
@ -7,12 +7,6 @@ test_description='quoted output'
|
|||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
P1='pathname with HT'
|
|
||||||
: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
|
|
||||||
echo >&2 'Filesystem does not support HT in names'
|
|
||||||
test_done
|
|
||||||
}
|
|
||||||
|
|
||||||
FN='濱野'
|
FN='濱野'
|
||||||
GN='純'
|
GN='純'
|
||||||
HT=' '
|
HT=' '
|
||||||
@ -20,7 +14,7 @@ LF='
|
|||||||
'
|
'
|
||||||
DQ='"'
|
DQ='"'
|
||||||
|
|
||||||
echo foo > "Name and an${HT}HT"
|
echo foo 2>/dev/null > "Name and an${HT}HT"
|
||||||
test -f "Name and an${HT}HT" || {
|
test -f "Name and an${HT}HT" || {
|
||||||
# since FAT/NTFS does not allow tabs in filenames, skip this test
|
# since FAT/NTFS does not allow tabs in filenames, skip this test
|
||||||
say 'Your filesystem does not allow tabs in filenames, test skipped.'
|
say 'Your filesystem does not allow tabs in filenames, test skipped.'
|
||||||
|
@ -13,8 +13,8 @@ P1='pathname with HT'
|
|||||||
P2='pathname with SP'
|
P2='pathname with SP'
|
||||||
P3='pathname
|
P3='pathname
|
||||||
with LF'
|
with LF'
|
||||||
: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
|
: 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
|
||||||
echo >&2 'Filesystem does not support tabs in names'
|
say 'Your filesystem does not allow tabs in filenames, test skipped.'
|
||||||
test_done
|
test_done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,29 @@ test_expect_success 'diff-filter=D' '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'setup case sensitivity tests' '
|
||||||
|
echo case >one &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -a -m Second
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'log --grep' '
|
||||||
|
echo second >expect &&
|
||||||
|
git log -1 --pretty="tformat:%s" --grep=sec >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'log -i --grep' '
|
||||||
|
echo Second >expect &&
|
||||||
|
git log -1 --pretty="tformat:%s" -i --grep=sec >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'log --grep -i' '
|
||||||
|
echo Second >expect &&
|
||||||
|
git log -1 --pretty="tformat:%s" --grep=sec -i >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user