From: Junio C Hamano Date: Sat, 23 Jan 2010 00:08:05 +0000 (-0800) Subject: Merge branch 'il/branch-set-upstream' X-Git-Tag: v1.7.0-rc0~23 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1a545d0b5fa56a7be88fe082cec7847715079a18?ds=inline;hp=-c Merge branch 'il/branch-set-upstream' * il/branch-set-upstream: branch: warn and refuse to set a branch as a tracking branch of itself. Add branch --set-upstream --- 1a545d0b5fa56a7be88fe082cec7847715079a18 diff --combined Documentation/git-branch.txt index 44144d5a0d,a0d6a7a649..6b6c3da2d9 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@@ -11,7 -11,7 +11,7 @@@ SYNOPSI 'git branch' [--color | --no-color] [-r | -a] [-v [--abbrev= | --no-abbrev]] [(--merged | --no-merged | --contains) []] - 'git branch' [--track | --no-track] [-l] [-f] [] + 'git branch' [--set-upstream | --track | --no-track] [-l] [-f] [] 'git branch' (-m | -M) [] 'git branch' (-d | -D) [-r] ... @@@ -38,7 -38,7 +38,7 @@@ working tree to it; use "git checkout < new branch. When a local branch is started off a remote branch, git sets up the -branch so that 'git-pull' will appropriately merge from +branch so that 'git pull' will appropriately merge from the remote branch. This behavior may be changed via the global `branch.autosetupmerge` configuration flag. That setting can be overridden by using the `--track` and `--no-track` options. @@@ -55,7 -55,7 +55,7 @@@ has a reflog then the reflog will also Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist -in the remote repository or if 'git-fetch' was configured not to fetch +in the remote repository or if 'git fetch' was configured not to fetch them again. See also the 'prune' subcommand of linkgit:git-remote[1] for a way to clean up all obsolete remote-tracking branches. @@@ -76,7 -76,7 +76,7 @@@ OPTION -f:: --force:: Reset to if exists - already. Without `-f` 'git-branch' refuses to change an existing branch. + already. Without `-f` 'git branch' refuses to change an existing branch. -m:: Move/rename a branch and the corresponding reflog. @@@ -129,6 -129,12 +129,12 @@@ start-point is either a local or remot Do not set up "upstream" configuration, even if the branch.autosetupmerge configuration variable is true. + --set-upstream:: + If specified branch does not exist yet or if '--force' has been + given, acts exactly like '--track'. Otherwise sets up configuration + like '--track' would when creating the branch, except that where + branch points to is not changed. + --contains :: Only list branches which contain the specified commit. diff --combined cache.h index 4b15042c08,e9ec537fed..7d5c21e3f1 --- a/cache.h +++ b/cache.h @@@ -288,7 -288,6 +288,7 @@@ static inline int ce_to_dtype(const str struct index_state { struct cache_entry **cache; unsigned int cache_nr, cache_alloc, cache_changed; + struct string_list *resolve_undo; struct cache_tree *cache_tree; struct cache_time timestamp; void *alloc; @@@ -343,9 -342,6 +343,9 @@@ static inline void remove_name_hash(str #define ce_modified(ce, st, options) ie_modified(&the_index, (ce), (st), (options)) #define cache_name_exists(name, namelen, igncase) index_name_exists(&the_index, (name), (namelen), (igncase)) #define cache_name_is_other(name, namelen) index_name_is_other(&the_index, (name), (namelen)) +#define resolve_undo_clear() resolve_undo_clear_index(&the_index) +#define unmerge_cache_entry_at(at) unmerge_index_entry_at(&the_index, at) +#define unmerge_cache(pathspec) unmerge_index(&the_index, pathspec) #endif enum object_type { @@@ -455,6 -451,7 +455,6 @@@ extern int index_name_pos(const struct #define ADD_CACHE_JUST_APPEND 8 /* Append only; tree.c::read_tree() */ #define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */ extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option); -extern struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really); extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name); extern int remove_index_entry_at(struct index_state *, int pos); extern void remove_marked_cache_entries(struct index_state *istate); @@@ -484,6 -481,9 +484,6 @@@ extern int index_fd(unsigned char *sha1 extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); -/* "careful lstat()" */ -extern int check_path(const char *path, int len, struct stat *st, int skiplen); - #define REFRESH_REALLY 0x0001 /* ignore_valid */ #define REFRESH_UNMERGED 0x0002 /* allow unmerged */ #define REFRESH_QUIET 0x0004 /* be quiet about it */ @@@ -553,6 -553,7 +553,7 @@@ enum branch_track BRANCH_TRACK_REMOTE, BRANCH_TRACK_ALWAYS, BRANCH_TRACK_EXPLICIT, + BRANCH_TRACK_OVERRIDE, }; enum rebase_setup_type { @@@ -627,6 -628,7 +628,6 @@@ static inline void hashclr(unsigned cha { memset(hash, 0, 20); } -extern int is_empty_blob_sha1(const unsigned char *sha1); #define EMPTY_TREE_SHA1_HEX \ "4b825dc642cb6eb9a060e54bf8d69288fbee4904" @@@ -696,6 -698,7 +697,6 @@@ extern int has_sha1_pack(const unsigne extern int has_sha1_file(const unsigned char *sha1); extern int has_loose_object_nonlocal(const unsigned char *sha1); -extern int has_pack_file(const unsigned char *sha1); extern int has_pack_index(const unsigned char *sha1); extern const signed char hexval_table[256]; @@@ -796,6 -799,8 +797,6 @@@ extern int has_symlink_leading_path(con extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); extern int has_symlink_or_noent_leading_path(const char *name, int len); extern int has_dirs_only_path(const char *name, int len, int prefix_len); -extern void invalidate_lstat_cache(const char *name, int len); -extern void clear_lstat_cache(void); extern void schedule_dir_for_removal(const char *name, int len); extern void remove_scheduled_dirs(void); @@@ -935,11 -940,7 +936,11 @@@ extern const char *config_exclusive_fil #define MAX_GITNAME (1000) extern char git_default_email[MAX_GITNAME]; extern char git_default_name[MAX_GITNAME]; +#define IDENT_NAME_GIVEN 01 +#define IDENT_MAIL_GIVEN 02 +#define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN) extern int user_ident_explicitly_given; +extern int user_ident_sufficiently_given(void); extern const char *git_commit_encoding; extern const char *git_log_output_encoding; @@@ -1007,7 -1008,6 +1008,7 @@@ extern int diff_auto_refresh_index /* match-trees.c */ void shift_tree(const unsigned char *, const unsigned char *, unsigned char *, int); +void shift_tree_by(const unsigned char *, const unsigned char *, unsigned char *, const char *); /* * whitespace rules.