Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-07 09:05:22 +0300
committerJunio C Hamano <gitster@pobox.com>2019-02-07 09:05:22 +0300
commit09a9c1f427c110f1281eea55c48596c8c8701a13 (patch)
tree06c8f6685e4ca005aa2367d9b4ae95368d2eb170 /builtin/am.c
parent0fa3cc77ee9fb3b6bb53c73688c9b7500f996b83 (diff)
parent06f5608c14e6972748b84649d5b8ffd335bbd209 (diff)
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
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 6d1c6d3da9a..0cc39972920 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -35,22 +35,6 @@
#include "repository.h"
/**
- * Returns 1 if the file is empty or does not exist, 0 otherwise.
- */
-static int is_empty_file(const char *filename)
-{
- struct stat st;
-
- if (stat(filename, &st) < 0) {
- if (errno == ENOENT)
- return 1;
- die_errno(_("could not stat %s"), filename);
- }
-
- return !st.st_size;
-}
-
-/**
* Returns the length of the first line of msg.
*/
static int linelen(const char *msg)
@@ -1220,7 +1204,7 @@ static int parse_mail(struct am_state *state, const char *mail)
goto finish;
}
- if (is_empty_file(am_path(state, "patch"))) {
+ if (is_empty_or_missing_file(am_path(state, "patch"))) {
printf_ln(_("Patch is empty."));
die_user_resolve(state);
}
@@ -1803,7 +1787,7 @@ next:
resume = 0;
}
- if (!is_empty_file(am_path(state, "rewritten"))) {
+ if (!is_empty_or_missing_file(am_path(state, "rewritten"))) {
assert(state->rebasing);
copy_notes_for_rebase(state);
run_post_rewrite_hook(state);