Skip to content

Commit 09a9c1f

Browse files
committed
Merge branch 'tt/bisect-in-c'
More code in "git bisect" has been rewritten in C. * tt/bisect-in-c: 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 0fa3cc7 + 06f5608 commit 09a9c1f

File tree

6 files changed

+595
-320
lines changed

6 files changed

+595
-320
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
*/
@@ -1220,7 +1204,7 @@ static int parse_mail(struct am_state *state, const char *mail)
12201204
goto finish;
12211205
}
12221206

1223-
if (is_empty_file(am_path(state, "patch"))) {
1207+
if (is_empty_or_missing_file(am_path(state, "patch"))) {
12241208
printf_ln(_("Patch is empty."));
12251209
die_user_resolve(state);
12261210
}
@@ -1803,7 +1787,7 @@ static void am_run(struct am_state *state, int resume)
18031787
resume = 0;
18041788
}
18051789

1806-
if (!is_empty_file(am_path(state, "rewritten"))) {
1790+
if (!is_empty_or_missing_file(am_path(state, "rewritten"))) {
18071791
assert(state->rebasing);
18081792
copy_notes_for_rebase(state);
18091793
run_post_rewrite_hook(state);

0 commit comments

Comments
 (0)