diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-05-25 00:59:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-25 00:59:07 -0700 |
commit | ee969693c5e77e1b5ebda45bead569806d31b379 (patch) | |
tree | 25d803cd17cbe891a9937f3e3442a1d7863ae773 /builtin-apply.c | |
parent | 4c8d4c14c6de59bc14d6118724ffee949e8654a7 (diff) | |
parent | 9619ff14159ab3401636b9883a715b0f20b051df (diff) | |
download | git-ee969693c5e77e1b5ebda45bead569806d31b379.tar.gz git-ee969693c5e77e1b5ebda45bead569806d31b379.tar.xz |
Merge branch 'master' into sb/opt-filename
* master: (654 commits)
http-push.c::remove_locks(): fix use after free
t/t3400-rebase.sh: add more tests to help migrating git-rebase.sh to C
post-receive-email: hooks.showrev: show how to include both web link and patch
MinGW: Fix compiler warning in merge-recursive
MinGW: Add a simple getpass()
MinGW: use POSIX signature of waitpid()
MinGW: the path separator to split GITPERLLIB is ';' on Win32
MinGW: Scan for \r in addition to \n when reading shbang lines
gitweb: Sanitize title attribute in format_subject_html
Terminate argv with NULL before calling setup_revisions()
doc/git-rebase.txt: remove mention of multiple strategies
git-send-email: Handle quotes when parsing .mailrc files
git-svn: add --authors-prog option
git-svn: Set svn.authorsfile if it is passed to git svn clone
git-svn: Correctly report max revision when following deleted paths
git-svn: Fix for svn paths removed > log-window-size revisions ago
git-svn testsuite: use standard configuration for Subversion tools
grep: fix word-regexp colouring
completion: use git rev-parse to detect bare repos
Cope better with a _lot_ of packs
...
Diffstat (limited to 'builtin-apply.c')
-rw-r--r-- | builtin-apply.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/builtin-apply.c b/builtin-apply.c index 472865b7f..a40b98224 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -2394,7 +2394,7 @@ static int check_to_create_blob(const char *new_name, int ok_if_exists) * In such a case, path "new_name" does not exist as * far as git is concerned. */ - if (has_symlink_leading_path(strlen(new_name), new_name)) + if (has_symlink_leading_path(new_name, strlen(new_name))) return 0; return error("%s: already exists in working directory", new_name); @@ -2487,7 +2487,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s if ((st_mode ^ patch->old_mode) & S_IFMT) return error("%s: wrong type", old_name); if (st_mode != patch->old_mode) - fprintf(stderr, "warning: %s has type %o, expected %o\n", + warning("%s has type %o, expected %o", old_name, st_mode, patch->old_mode); if (!patch->new_mode && !patch->is_delete) patch->new_mode = st_mode; @@ -2781,7 +2781,7 @@ static void remove_file(struct patch *patch, int rmdir_empty) if (rmdir(patch->old_name)) warning("unable to remove submodule %s", patch->old_name); - } else if (!unlink(patch->old_name) && rmdir_empty) { + } else if (!unlink_or_warn(patch->old_name) && rmdir_empty) { remove_path(patch->old_name); } } @@ -2891,7 +2891,7 @@ static void create_one_file(char *path, unsigned mode, const char *buf, unsigned if (!try_create_file(newpath, mode, buf, size)) { if (!rename(newpath, path)) return; - unlink(newpath); + unlink_or_warn(newpath); break; } if (errno != EEXIST) @@ -2971,8 +2971,7 @@ static int write_out_one_reject(struct patch *patch) cnt = strlen(patch->new_name); if (ARRAY_SIZE(namebuf) <= cnt + 5) { cnt = ARRAY_SIZE(namebuf) - 5; - fprintf(stderr, - "warning: truncating .rej filename to %.*s.rej", + warning("truncating .rej filename to %.*s.rej", cnt - 1, patch->new_name); } memcpy(namebuf, patch->new_name, cnt); @@ -3263,10 +3262,10 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix) "ignore additions made by the patch"), OPT_BOOLEAN(0, "stat", &diffstat, "instead of applying the patch, output diffstat for the input"), - OPT_BOOLEAN(0, "allow-binary-replacement", &binary, - "now no-op"), - OPT_BOOLEAN(0, "binary", &binary, - "now no-op"), + { OPTION_BOOLEAN, 0, "allow-binary-replacement", &binary, + NULL, "old option, now no-op", PARSE_OPT_HIDDEN }, + { OPTION_BOOLEAN, 0, "binary", &binary, + NULL, "old option, now no-op", PARSE_OPT_HIDDEN }, OPT_BOOLEAN(0, "numstat", &numstat, "shows number of added and deleted lines in decimal notation"), OPT_BOOLEAN(0, "summary", &summary, @@ -3358,8 +3357,8 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix) squelch_whitespace_errors < whitespace_error) { int squelched = whitespace_error - squelch_whitespace_errors; - fprintf(stderr, "warning: squelched %d " - "whitespace error%s\n", + warning("squelched %d " + "whitespace error%s", squelched, squelched == 1 ? "" : "s"); } @@ -3369,12 +3368,12 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix) whitespace_error == 1 ? "" : "s", whitespace_error == 1 ? "s" : ""); if (applied_after_fixing_ws && apply) - fprintf(stderr, "warning: %d line%s applied after" - " fixing whitespace errors.\n", + warning("%d line%s applied after" + " fixing whitespace errors.", applied_after_fixing_ws, applied_after_fixing_ws == 1 ? "" : "s"); else if (whitespace_error) - fprintf(stderr, "warning: %d line%s add%s whitespace errors.\n", + warning("%d line%s add%s whitespace errors.", whitespace_error, whitespace_error == 1 ? "" : "s", whitespace_error == 1 ? "s" : ""); |