Skip to content

Commit 714c9f2

Browse files
committed
Merge branch 'pb/bisect-helper-2' into pu
* pb/bisect-helper-2: t6030: make various test to pass GETTEXT_POISON tests bisect--helper: `bisect_start` shell function partially in C bisect--helper: `get_terms` & `bisect_terms` shell function in C bisect--helper: `bisect_next_check` shell function in C bisect--helper: `check_and_set_terms` shell function in C wrapper: move is_empty_file() and rename it as is_empty_or_missing_file() bisect--helper: `bisect_write` shell function in C bisect--helper: `bisect_reset` shell function in C
2 parents 35334b9 + 32dd45a commit 714c9f2

File tree

6 files changed

+665
-380
lines changed

6 files changed

+665
-380
lines changed

builtin/am.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,6 @@
3434
#include "packfile.h"
3535
#include "repository.h"
3636

37-
/**
38-
* Returns 1 if the file is empty or does not exist, 0 otherwise.
39-
*/
40-
static int is_empty_file(const char *filename)
41-
{
42-
struct stat st;
43-
44-
if (stat(filename, &st) < 0) {
45-
if (errno == ENOENT)
46-
return 1;
47-
die_errno(_("could not stat %s"), filename);
48-
}
49-
50-
return !st.st_size;
51-
}
52-
5337
/**
5438
* Returns the length of the first line of msg.
5539
*/
@@ -1268,7 +1252,7 @@ static int parse_mail(struct am_state *state, const char *mail)
12681252
goto finish;
12691253
}
12701254

1271-
if (is_empty_file(am_path(state, "patch"))) {
1255+
if (is_empty_or_missing_file(am_path(state, "patch"))) {
12721256
printf_ln(_("Patch is empty."));
12731257
die_user_resolve(state);
12741258
}
@@ -1850,7 +1834,7 @@ static void am_run(struct am_state *state, int resume)
18501834
resume = 0;
18511835
}
18521836

1853-
if (!is_empty_file(am_path(state, "rewritten"))) {
1837+
if (!is_empty_or_missing_file(am_path(state, "rewritten"))) {
18541838
assert(state->rebasing);
18551839
copy_notes_for_rebase(state);
18561840
run_post_rewrite_hook(state);

0 commit comments

Comments
 (0)