mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
![Junio C Hamano](/assets/img/avatar_default.png)
The plumbing output is sacred as it is an API. We _could_ change it if it is broken in such a way that it cannot convey necessary information fully, but we just do not _reword_ for the sake of rewording. If somebody does not like it, s/he is complaining too late. S/he should have been here in early May 2005 and make the language used by the API closer to what humans read. S/he wasn't here. Too bad, and it is too late. And people who complain should look at a bigger picture. Look at what was suggested by one of them and think for five seconds: $ git checkout mytopic -fatal: Entry 'frotz' not uptodate. Cannot merge. +fatal: Entry 'frotz' has local changes. Cannot merge. If you do not see something wrong with this output, your brain has already been rotten with use of git for too long a time. Nobody asked us to "merge" but why are we talking about "Cannot merge"? This patch introduces a mechanism to allow Porcelains to specify messages that are different from the ones that is given by the underlying plumbing implementation of read-tree, so that we can reword the message Porcelains give without disrupting the output from the plumbing. $ git-checkout pu error: You have local changes to 'Makefile'; cannot switch branches. There are other places that ask unpack_trees() to n-way merge, detect issues and let it issue error message on its own, but I did this as a demonstration and replaced only one message. Yes I know about C99 structure initializers. I'd love to use them but we try to be nice to compilers without it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
#ifndef UNPACK_TREES_H
|
|
#define UNPACK_TREES_H
|
|
|
|
#define MAX_UNPACK_TREES 8
|
|
|
|
struct unpack_trees_options;
|
|
|
|
typedef int (*merge_fn_t)(struct cache_entry **src,
|
|
struct unpack_trees_options *options);
|
|
|
|
struct unpack_trees_error_msgs {
|
|
const char *would_overwrite;
|
|
const char *not_uptodate_file;
|
|
const char *not_uptodate_dir;
|
|
const char *would_lose_untracked;
|
|
const char *bind_overlap;
|
|
};
|
|
|
|
struct unpack_trees_options {
|
|
unsigned int reset:1,
|
|
merge:1,
|
|
update:1,
|
|
index_only:1,
|
|
nontrivial_merge:1,
|
|
trivial_merges_only:1,
|
|
verbose_update:1,
|
|
aggressive:1,
|
|
skip_unmerged:1,
|
|
gently:1;
|
|
const char *prefix;
|
|
int pos;
|
|
struct dir_struct *dir;
|
|
merge_fn_t fn;
|
|
struct unpack_trees_error_msgs msgs;
|
|
|
|
int head_idx;
|
|
int merge_size;
|
|
|
|
struct cache_entry *df_conflict_entry;
|
|
void *unpack_data;
|
|
|
|
struct index_state *dst_index;
|
|
struct index_state *src_index;
|
|
struct index_state result;
|
|
};
|
|
|
|
extern int unpack_trees(unsigned n, struct tree_desc *t,
|
|
struct unpack_trees_options *options);
|
|
|
|
int threeway_merge(struct cache_entry **stages, struct unpack_trees_options *o);
|
|
int twoway_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
|
int bind_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
|
int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o);
|
|
|
|
#endif
|