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.0-rc1~11^2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a5c8a98ca7e978c334e956df7ae2165c75c494da;p=git.git 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 --cc Documentation/git-checkout.txt index 064394385,d82efc00d..fbdbadc74 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@@ -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 --cc fetch.c index fd57684d8,f7f890258..ae92d5212 --- 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; @@@ -212,42 -206,19 +210,41 @@@ int pull(char *target 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 --cc fetch.h index 0011548de,001a6b8e2..841bb1af9 --- 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;