From: Junio C Hamano Date: Tue, 23 May 2006 22:07:47 +0000 (-0700) Subject: Merge branch 'sp/reflog' into next X-Git-Tag: v1.4.1-rc1~66 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/dcaad49c928f047d5ffa1c5a1753aff6e87f16b5?hp=-c Merge branch 'sp/reflog' into next * sp/reflog: Enable ref log creation in git checkout -b. Create/delete branch ref logs. Include ref log detail in commit, reset, etc. Change order of -m option to update-ref. Correct force_write bug in refs.c Change 'master@noon' syntax to 'master@{noon}'. Log ref updates made by fetch. Force writing ref if it doesn't exist. Added logs/ directory to repository layout. General ref log reading improvements. Fix ref log parsing so it works properly. Support 'master@2 hours ago' syntax Log ref updates to logs/refs/ Convert update-ref to use ref_lock API. Improve abstraction of ref lock/write. --- dcaad49c928f047d5ffa1c5a1753aff6e87f16b5 diff --combined Documentation/git-branch.txt index 0b37e2bfc8,a7bec3c101..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,7 -23,8 +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 @@@ -34,6 -35,11 +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. @@@ -43,9 -49,6 +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 d82efc00d4,0643943854..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,11 -35,13 +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 f11d5e7dcf,f01ca436e6..d530af97cc --- a/cache.h +++ b/cache.h @@@ -114,7 -114,6 +114,7 @@@ static inline unsigned int create_ce_mo extern struct cache_entry **active_cache; extern unsigned int active_nr, active_alloc, active_cache_changed; +extern struct cache_tree *active_cache_tree; #define GIT_DIR_ENVIRONMENT "GIT_DIR" #define DEFAULT_GIT_DIR_ENVIRONMENT ".git" @@@ -143,7 -142,6 +143,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 */ @@@ -156,17 -154,10 +156,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]; @@@ -179,6 -170,7 +179,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 git-am.sh index 97ec2d0c7d,25c95c24fd..4232e27411 --- a/git-am.sh +++ b/git-am.sh @@@ -59,12 -59,46 +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" && @@@ -413,7 -447,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 6785826fef,a4b0a90740..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,17 -134,13 +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"; @@@ -207,7 -203,6 +207,7 @@@ verbose signoff= force_author= only_include_assumed= +untracked_files= while case "$#" in 0) break;; esac do case "$1" in @@@ -345,12 -340,6 +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 @@@ -687,7 -676,8 +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 diff --combined http-fetch.c index 178f1ee311,cc7bd1f367..661c909152 --- a/http-fetch.c +++ b/http-fetch.c @@@ -1223,6 -1223,7 +1223,7 @@@ int main(int argc, char **argv int rc = 0; setup_git_directory(); + git_config(git_default_config); while (arg < argc && argv[arg][0] == '-') { if (argv[arg][1] == 't') { @@@ -1249,6 -1250,7 +1250,7 @@@ } commit_id = argv[arg]; url = argv[arg + 1]; + write_ref_log_details = url; http_init(); @@@ -1269,10 -1271,10 +1271,10 @@@ if (pull(commit_id)) rc = 1; - curl_slist_free_all(no_pragma_header); - http_cleanup(); + curl_slist_free_all(no_pragma_header); + if (corrupt_object_found) { fprintf(stderr, "Some loose object were found to be corrupt, but they might be just\n"