Skip to content

Commit b0b3a24

Browse files
committed
Merge branch 'maint-1.6.1' into maint
* maint-1.6.1: textconv: stop leaking file descriptors commit: --cleanup is a message option git count-objects: handle packs bigger than 4G t7102: make the test fail if one of its check fails Conflicts: builtin-commit.c diff.c
2 parents f5e025a + 70d7099 commit b0b3a24

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

builtin-commit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
8686
static struct option builtin_commit_options[] = {
8787
OPT__QUIET(&quiet),
8888
OPT__VERBOSE(&verbose),
89-
OPT_GROUP("Commit message options"),
9089

90+
OPT_GROUP("Commit message options"),
9191
OPT_FILENAME('F', "file", &logfile, "read log from file"),
9292
OPT_STRING(0, "author", &force_author, "AUTHOR", "override author for commit"),
9393
OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m),
@@ -97,6 +97,8 @@ static struct option builtin_commit_options[] = {
9797
OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
9898
OPT_FILENAME('t', "template", &template_file, "use specified template file"),
9999
OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
100+
OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
101+
/* end commit message options */
100102

101103
OPT_GROUP("Commit contents options"),
102104
OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
@@ -108,7 +110,7 @@ static struct option builtin_commit_options[] = {
108110
OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
109111
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
110112
OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"),
111-
OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
113+
/* end commit contents options */
112114

113115
OPT_END()
114116
};

builtin-count-objects.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
static void count_objects(DIR *d, char *path, int len, int verbose,
1313
unsigned long *loose,
14-
unsigned long *loose_size,
14+
off_t *loose_size,
1515
unsigned long *packed_loose,
1616
unsigned long *garbage)
1717
{
@@ -77,7 +77,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
7777
int len = strlen(objdir);
7878
char *path = xmalloc(len + 50);
7979
unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
80-
unsigned long loose_size = 0;
80+
off_t loose_size = 0;
8181
struct option opts[] = {
8282
OPT__VERBOSE(&verbose),
8383
OPT_END(),
@@ -103,7 +103,7 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
103103
if (verbose) {
104104
struct packed_git *p;
105105
unsigned long num_pack = 0;
106-
unsigned long size_pack = 0;
106+
off_t size_pack = 0;
107107
if (!packed_git)
108108
prepare_packed_git();
109109
for (p = packed_git; p; p = p->next) {
@@ -116,15 +116,15 @@ int cmd_count_objects(int argc, const char **argv, const char *prefix)
116116
num_pack++;
117117
}
118118
printf("count: %lu\n", loose);
119-
printf("size: %lu\n", loose_size / 1024);
119+
printf("size: %lu\n", (unsigned long) (loose_size / 1024));
120120
printf("in-pack: %lu\n", packed);
121121
printf("packs: %lu\n", num_pack);
122-
printf("size-pack: %lu\n", size_pack / 1024);
122+
printf("size-pack: %lu\n", (unsigned long) (size_pack / 1024));
123123
printf("prune-packable: %lu\n", packed_loose);
124124
printf("garbage: %lu\n", garbage);
125125
}
126126
else
127127
printf("%lu objects, %lu kilobytes\n",
128-
loose, loose_size / 1024);
128+
loose, (unsigned long) (loose_size / 1024));
129129
return 0;
130130
}

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3776,11 +3776,13 @@ static char *run_textconv(const char *pgm, struct diff_filespec *spec,
37763776
if (start_command(&child) != 0 ||
37773777
strbuf_read(&buf, child.out, 0) < 0 ||
37783778
finish_command(&child) != 0) {
3779+
close(child.out);
37793780
strbuf_release(&buf);
37803781
remove_tempfile();
37813782
error("error running textconv command '%s'", pgm);
37823783
return NULL;
37833784
}
3785+
close(child.out);
37843786
remove_tempfile();
37853787

37863788
return strbuf_detach(&buf, outsize);

t/t7102-reset.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@ test_expect_success \
139139
test_expect_success \
140140
'resetting to HEAD with no changes should succeed and do nothing' '
141141
git reset --hard &&
142-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
142+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
143143
git reset --hard HEAD &&
144-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
144+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
145145
git reset --soft &&
146-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
146+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
147147
git reset --soft HEAD &&
148-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
148+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
149149
git reset --mixed &&
150-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
150+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
151151
git reset --mixed HEAD &&
152-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
152+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
153153
git reset &&
154-
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
154+
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
155155
git reset HEAD &&
156156
check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
157157
'

0 commit comments

Comments
 (0)