From: Junio C Hamano Date: Wed, 24 May 2006 23:49:24 +0000 (-0700) Subject: Merge branch 'master' into sp/reflog X-Git-Tag: v1.4.1-rc1~62^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a5c8a98ca7e978c334e956df7ae2165c75c494da?ds=inline;hp=-c Merge branch 'master' into sp/reflog * master: (90 commits) fetch.c: remove an unused variable and dead code. Clean up sha1 file writing Builtin git-cat-file builtin format-patch: squelch content-type for 7-bit ASCII CMIT_FMT_EMAIL: Q-encode Subject: and display-name part of From: fields. add more informative error messages to git-mktag remove the artificial restriction tagsize < 8kb git-rebase: use canonical A..B syntax to format-patch git-format-patch: now built-in. fmt-patch: Support --attach fmt-patch: understand old notation Teach fmt-patch about --keep-subject Teach fmt-patch about --numbered fmt-patch: implement -o fmt-patch: output file names to stdout Teach fmt-patch to write individual files. built-in tar-tree and remote tar-tree Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree. Builtin git-show-branch. Builtin git-apply. ... --- a5c8a98ca7e978c334e956df7ae2165c75c494da diff --combined Documentation/git-branch.txt index a7bec3c101,0b37e2bfc8..d43ef1dec4 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@@ -9,7 -9,7 +9,7 @@@ SYNOPSI -------- [verse] 'git-branch' [-r] -'git-branch' [-f] [] +'git-branch' [-l] [-f] [] 'git-branch' (-d | -D) ... DESCRIPTION @@@ -23,8 -23,7 +23,8 @@@ If no is given, the branc equal to that of the currently checked out branch. With a `-d` or `-D` option, `` will be deleted. You may -specify more than one branch for deletion. +specify more than one branch for deletion. If the branch currently +has a ref log then the ref log will also be deleted. OPTIONS @@@ -35,11 -34,6 +35,11 @@@ -D:: Delete a branch irrespective of its index status. +-l:: + Create the branch's ref log. This activates recording of + all changes to made the branch ref, enabling use of date + based sha1 expressions such as "@{yesterday}". + -f:: Force the creation of a new branch even if it means deleting a branch that already exists with the same name. @@@ -49,6 -43,9 +49,9 @@@ :: The name of the branch to create or delete. + The new branch name must pass all checks defined by + gitlink:git-check-ref-format[1]. Some of these checks + may restrict the characters allowed in a branch name. :: The new branch will be created with a HEAD equal to this. It may diff --combined Documentation/git-checkout.txt index 0643943854,d82efc00d4..fbdbadc74f --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@@ -8,7 -8,7 +8,7 @@@ git-checkout - Checkout and switch to SYNOPSIS -------- [verse] -'git-checkout' [-f] [-b ] [-m] [] +'git-checkout' [-f] [-b [-l]] [-m] [] 'git-checkout' [-m] [] ... DESCRIPTION @@@ -35,13 -35,11 +35,16 @@@ OPTION Force a re-read of everything. -b:: - Create a new branch and start it at . + Create a new branch named and start it at + . The new branch name must pass all checks defined + by gitlink:git-check-ref-format[1]. Some of these checks + may restrict the characters allowed in a branch name. +-l:: + Create the new branch's ref log. This activates recording of + all changes to made the branch ref, enabling use of date + based sha1 expressions such as "@{yesterday}". + -m:: If you have local modifications to one or more files that are different between the current branch and the branch to diff --combined cache.h index f01ca436e6,3a46fb97bc..07212b62d1 --- a/cache.h +++ b/cache.h @@@ -142,6 -142,7 +142,7 @@@ extern void verify_non_filename(const c /* Initialize and use the cache information */ extern int read_cache(void); extern int write_cache(int newfd, struct cache_entry **cache, int entries); + extern int verify_path(const char *path); extern int cache_name_pos(const char *name, int namelen); #define ADD_CACHE_OK_TO_ADD 1 /* Ok to add */ #define ADD_CACHE_OK_TO_REPLACE 2 /* Ok to replace file/directory */ @@@ -154,10 -155,17 +155,17 @@@ extern int ce_match_stat(struct cache_e extern int ce_modified(struct cache_entry *ce, struct stat *st, int); extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type); + extern int read_pipe(int fd, char** return_buf, unsigned long* return_size); extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object); 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); + #define REFRESH_REALLY 0x0001 /* ignore_valid */ + #define REFRESH_UNMERGED 0x0002 /* allow unmerged */ + #define REFRESH_QUIET 0x0004 /* be quiet about it */ + #define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */ + extern int refresh_cache(unsigned int flags); + struct cache_file { struct cache_file *next; char lockfile[PATH_MAX]; @@@ -170,7 -178,6 +178,7 @@@ extern void rollback_index_file(struct extern int trust_executable_bit; extern int assume_unchanged; extern int prefer_symlink_refs; +extern int log_all_ref_updates; extern int warn_ambiguous_refs; extern int diff_rename_limit_default; extern int shared_repository; diff --combined fetch.c index fd57684d8f,f7f8902580..ae92d5212e --- a/fetch.c +++ b/fetch.c @@@ -8,10 -8,7 +8,8 @@@ #include "refs.h" const char *write_ref = NULL; +const char *write_ref_log_details = NULL; - const unsigned char *current_ref = NULL; - int get_tree = 0; int get_history = 0; int get_all = 0; @@@ -205,49 -202,23 +203,48 @@@ static int mark_complete(const char *pa int pull(char *target) { + struct ref_lock *lock; unsigned char sha1[20]; + char *msg; + int ret; save_commit_buffer = 0; track_object_refs = 0; + if (write_ref) { - lock = lock_ref_sha1(write_ref, current_ref, 1); ++ lock = lock_ref_sha1(write_ref, NULL, 0); + if (!lock) { + error("Can't lock ref %s", write_ref); + return -1; + } + } - if (!get_recover) { + if (!get_recover) for_each_ref(mark_complete); - } - if (interpret_target(target, sha1)) - return error("Could not interpret %s as something to pull", - target); - if (process(lookup_unknown_object(sha1))) + if (interpret_target(target, sha1)) { + error("Could not interpret %s as something to pull", target); + unlock_ref(lock); return -1; - if (loop()) + } + if (process(lookup_unknown_object(sha1))) { + unlock_ref(lock); return -1; - - if (write_ref) - write_ref_sha1_unlocked(write_ref, sha1); + } + if (loop()) { + unlock_ref(lock); + return -1; + } + + if (write_ref) { + if (write_ref_log_details) { + msg = xmalloc(strlen(write_ref_log_details) + 12); + sprintf(msg, "fetch from %s", write_ref_log_details); + } else + msg = NULL; + ret = write_ref_sha1(lock, sha1, msg ? msg : "fetch (unknown)"); + if (msg) + free(msg); + return ret; + } return 0; } diff --combined fetch.h index 0011548de8,001a6b8e2d..841bb1af9c --- a/fetch.h +++ b/fetch.h @@@ -25,12 -25,6 +25,9 @@@ extern int fetch_ref(char *ref, unsigne /* If set, the ref filename to write the target value to. */ extern const char *write_ref; +/* If set additional text will appear in the ref log. */ +extern const char *write_ref_log_details; + - /* If set, the hash that the current value of write_ref must be. */ - extern const unsigned char *current_ref; - /* Set to fetch the target tree. */ extern int get_tree; diff --combined git-am.sh index 25c95c24fd,97ec2d0c7d..4232e27411 --- a/git-am.sh +++ b/git-am.sh @@@ -59,46 -59,12 +59,12 @@@ fall_back_3way () GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \ git-write-tree >"$dotest/patch-merge-base+" && # index has the base tree now. - ( - cd "$dotest/patch-merge-tmp-dir" && - GIT_INDEX_FILE="../patch-merge-tmp-index" \ - GIT_OBJECT_DIRECTORY="$O_OBJECT" \ - git-apply $binary --index <../patch - ) + GIT_INDEX_FILE="$dotest/patch-merge-tmp-index" \ + git-apply $binary --cached <"$dotest/patch" then echo Using index info to reconstruct a base tree... mv "$dotest/patch-merge-base+" "$dotest/patch-merge-base" mv "$dotest/patch-merge-tmp-index" "$dotest/patch-merge-index" - else - # Otherwise, try nearby trees that can be used to apply the - # patch. - ( - N=10 - - # Hoping the patch is against our recent commits... - git-rev-list --max-count=$N HEAD - - # or hoping the patch is against known tags... - git-ls-remote --tags . - ) | - while read base junk - do - # See if we have it as a tree... - git-cat-file tree "$base" >/dev/null 2>&1 || continue - - rm -fr "$dotest"/patch-merge-* && - mkdir "$dotest/patch-merge-tmp-dir" || break - ( - cd "$dotest/patch-merge-tmp-dir" && - GIT_INDEX_FILE=../patch-merge-tmp-index && - GIT_OBJECT_DIRECTORY="$O_OBJECT" && - export GIT_INDEX_FILE GIT_OBJECT_DIRECTORY && - git-read-tree "$base" && - git-apply $binary --index && - mv ../patch-merge-tmp-index ../patch-merge-index && - echo "$base" >../patch-merge-base - ) <"$dotest/patch" 2>/dev/null && break - done fi test -f "$dotest/patch-merge-index" && @@@ -447,7 -413,7 +413,7 @@@ d parent=$(git-rev-parse --verify HEAD) && commit=$(git-commit-tree $tree -p $parent <"$dotest/final-commit") && echo Committed: $commit && - git-update-ref HEAD $commit $parent || + git-update-ref -m "am: $SUBJECT" HEAD $commit $parent || stop_here $this if test -x "$GIT_DIR"/hooks/post-applypatch diff --combined git-commit.sh index a4b0a90740,6785826fef..0a01a0b96a --- a/git-commit.sh +++ b/git-commit.sh @@@ -3,7 -3,7 +3,7 @@@ # Copyright (c) 2005 Linus Torvalds # Copyright (c) 2006 Junio C Hamano - USAGE='[-a] [-s] [-v] [--no-verify] [-m | -F | (-C|-c) ) [--amend] [-e] [--author ] [[-i | -o] ...]' + USAGE='[-a] [-s] [-v] [--no-verify] [-m | -F | (-C|-c) ] [-u] [--amend] [-e] [--author ] [[-i | -o] ...]' SUBDIRECTORY_OK=Yes . git-sh-setup @@@ -134,13 -134,17 +134,17 @@@ run_status () report "Changed but not updated" \ "use git-update-index to mark for commit" + option="" + if test -z "$untracked_files"; then + option="--directory --no-empty-directory" + fi if test -f "$GIT_DIR/info/exclude" then - git-ls-files -z --others --directory \ + git-ls-files -z --others $option \ --exclude-from="$GIT_DIR/info/exclude" \ --exclude-per-directory=.gitignore else - git-ls-files -z --others --directory \ + git-ls-files -z --others $option \ --exclude-per-directory=.gitignore fi | perl -e '$/ = "\0"; @@@ -203,6 -207,7 +207,7 @@@ verbose signoff= force_author= only_include_assumed= + untracked_files= while case "$#" in 0) break;; esac do case "$1" in @@@ -340,6 -345,12 +345,12 @@@ verbose=t shift ;; + -u|--u|--un|--unt|--untr|--untra|--untrac|--untrack|--untracke|--untracked|\ + --untracked-|--untracked-f|--untracked-fi|--untracked-fil|--untracked-file|\ + --untracked-files) + untracked_files=t + shift + ;; --) shift break @@@ -676,8 -687,7 +687,8 @@@ the rm -f "$TMP_INDEX" fi && commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) && - git-update-ref HEAD $commit $current && + rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) && + git-update-ref -m "commit: $rlogm" HEAD $commit $current && rm -f -- "$GIT_DIR/MERGE_HEAD" && if test -f "$NEXT_INDEX" then