#include "strbuf.h"
#include "utf8.h"
#include "parse-options.h"
-#include "path-list.h"
+#include "string-list.h"
+#include "rerere.h"
#include "unpack-trees.h"
static const char * const builtin_commit_usage[] = {
- "git-commit [options] [--] <filepattern>...",
+ "git commit [options] [--] <filepattern>...",
NULL
};
static const char * const builtin_status_usage[] = {
- "git-status [options] [--] <filepattern>...",
+ "git status [options] [--] <filepattern>...",
NULL
};
static char *cleanup_arg;
static int use_editor = 1, initial_commit, in_merge;
-const char *only_include_assumed;
-struct strbuf message;
+static const char *only_include_assumed;
+static struct strbuf message;
static int opt_parse_m(const struct option *opt, const char *arg, int unset)
{
strbuf_setlen(buf, 0);
else {
strbuf_addstr(buf, arg);
- strbuf_addch(buf, '\n');
- strbuf_addch(buf, '\n');
+ strbuf_addstr(buf, "\n\n");
}
return 0;
}
* Take a union of paths in the index and the named tree (typically, "HEAD"),
* and return the paths that match the given pattern in list.
*/
-static int list_paths(struct path_list *list, const char *with_tree,
+static int list_paths(struct string_list *list, const char *with_tree,
const char *prefix, const char **pattern)
{
int i;
continue;
if (!pathspec_match(pattern, m, ce->name, 0))
continue;
- path_list_insert(ce->name, list);
+ string_list_insert(ce->name, list);
}
return report_path_error(m, pattern, prefix ? strlen(prefix) : 0);
}
-static void add_remove_files(struct path_list *list)
+static void add_remove_files(struct string_list *list)
{
int i;
for (i = 0; i < list->nr; i++) {
struct stat st;
- struct path_list_item *p = &(list->items[i]);
+ struct string_list_item *p = &(list->items[i]);
- if (!lstat(p->path, &st)) {
- if (add_to_cache(p->path, &st, 0))
+ if (!lstat(p->string, &st)) {
+ if (add_to_cache(p->string, &st, 0))
die("updating files failed");
} else
- remove_file_from_cache(p->path);
+ remove_file_from_cache(p->string);
}
}
static char *prepare_index(int argc, const char **argv, const char *prefix)
{
int fd;
- struct path_list partial;
+ struct string_list partial;
const char **pathspec = NULL;
if (interactive) {
die("cannot do a partial commit during a merge.");
memset(&partial, 0, sizeof(partial));
- partial.strdup_paths = 1;
+ partial.strdup_strings = 1;
if (list_paths(&partial, initial_commit ? NULL : "HEAD", prefix, pathspec))
exit(1);
char index[PATH_MAX];
const char *env[2] = { index, NULL };
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
- launch_editor(git_path(commit_editmsg), NULL, env);
+ if (launch_editor(git_path(commit_editmsg), NULL, env)) {
+ fprintf(stderr,
+ "Please supply the message using either -m or -F option.\n");
+ exit(1);
+ }
}
if (!no_verify &&
}
}
-int git_commit_config(const char *k, const char *v, void *cb)
+static int git_commit_config(const char *k, const char *v, void *cb)
{
if (!strcmp(k, "commit.template"))
return git_config_string(&template_file, k, v);