{"thread":{"id":"7497","subject":"What's cooking in git.git (topics)","startedAt":"2007-04-03T05:41:16Z","lastAt":"2007-04-09T06:13:35Z","messageCount":7,"participants":["Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"38495","messageId":"7vwt0uypz7.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":null,"subject":"What's cooking in git.git (topics)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-03T05:41:16Z","receivedAt":"2007-04-03T05:41:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Being in the pre-release freeze, nothing should be cooking in\n'next' nor 'pu', and you should not be reading this ;-)\n\nIn any case, on the 'master' front there is only one fix since\nthe last -rc.  Will tag and declare 1.5.1 this Wednesday.  And\nafter that happens, here is a list of what will come.\n\nCommits prefixed with '-' are only in 'pu' while commits\nprefixed with '+' are in 'next'.  The topics list the commits in\nreverse chronological order.\n\n=======================================\n=== To merge immediately post 1.5.1 ===\n=======================================\n\n* lt/dirwalk (Fri Mar 30 20:39:30 2007 -0700) 1 commit\n + Optimize directory listing with pathspec limiter.\n\nThis is to help \"git add single-path\" in a huge directory that\ndoes not have .gitignore.\n\n* post1.5.1/tcltk (Fri Mar 30 00:59:43 2007 -0700) 5 commits\n + Optional Tck/Tk: ignore generated files.\n + Eliminate checks of user-specified Tcl/Tk interpreter.\n + Rewrite Tcl/Tk interpreter path for the GUI tools.\n + Add --with-tcltk and --without-tcltk to configure.\n + NO_TCLTK\n\n* post1.5.1/p4 (Thu Mar 29 14:07:47 2007 +0400) 4 commits\n + Added correct Python path to the RPM specfile.\n + Remove unused WITH_OWN_SUBPROCESS_PY from RPM spec\n + Added git-p4 package to the list of git RPMs.\n + Add the WITH_P4IMPORT knob to the Makefile.\n\nBuild tweaks.\n\n* post1.5.1/blame.el (Wed Mar 28 18:44:34 2007 +0200) 2 commits\n + git-blame.el: pick a set of random colors for each git-blame turn\n + git-blame.el: separate git-blame-mode to ease maintenance\n\nEmacs.\n\n* fl/doc (Mon Mar 26 23:45:23 2007 -0700) 3 commits\n + Documentation: unbreak user-manual.\n + Documentation: Add version information to man pages\n + Documentation: Replace @@GIT_VERSION@@ in documentation\n\nAdd autogenerated version stamp in documentation.\n\n* jc/bisect (Fri Mar 23 17:54:03 2007 -0700) 6 commits\n + make the previous optimization work also on path-limited rev-list\n   --bisect\n + rev-list --bisect: Fix \"halfway\" optimization.\n + t6004: add a bit more path optimization test.\n + git-rev-list --bisect: optimization\n + git-rev-list: add --bisect-vars option.\n + t6002: minor spelling fix.\n\nSpeeding up bisection between v2.6.18..v2.6.20 in the kernel\nrepository from 22 seconds down to 4 seconds.\n\n===============================\n=== Will cook a bit further ===\n===============================\n\n* jc/index-output (Sat Mar 31 23:27:41 2007 -0700) 2 commits\n - git-read-tree --index-output=<file>\n - _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative\n   index file.\n\nThis is to avoid an extra copy during index-jumping commit.\nWill merge to 'next' post 1.5.1, and hopefully 'master' soon.\n\n* fl/cvsserver (Sat Mar 31 15:57:47 2007 +0200) 6 commits\n + cvsserver: Use DBI->table_info instead of DBI->tables\n + cvsserver: Abort if connect to database fails\n + cvsserver: Make the database backend configurable\n + cvsserver: Allow to override the configuration per access method\n + cvsserver: Handle three part keys in git config correctly\n + cvsserver: Introduce new state variable 'method'\n\nI do think there is no need to rush this without positive\nreports by people who tested with backends other than SQLite.\n\n* jc/checkout (Thu Mar 29 01:23:12 2007 -0700) 4 commits\n - Use BASE index extension in git-commit and git-merge.\n - update-index --{set,get}-base\n - Add BASE index extension.\n - checkout -d: explicitly detach HEAD even when switching to the tip\n   of a branch\n\nThis lays the foundation to detect and warn cases where the tip\nof the current branch is modified underneath you.  Will merge to\n'next' post 1.5.1, but this has to wait for motivated people to \nthe cases the series currently does not record and/or check the\nbase where it should, before graduating to 'master'.\n\n* jc/read-tree-df (Thu Mar 15 23:25:22 2007 -0700) 6 commits\n - Fix switching to a branch with D/F when current branch has file D.\n - Fix twoway_merge that passed d/f conflict marker to\n   merged_entry().\n - Fix read-tree --prefix=dir/.\n - unpack-trees: get rid of *indpos parameter.\n - unpack_trees.c: pass unpack_trees_options structure to\n   keep_entry() as well.\n - add_cache_entry(): removal of file foo does not conflict with\n   foo/bar\n\nThis series is almost re-done since I sent the initial patch.\nThe code is much nicer, and I think it is safer.\n\n* jc/the-index (Sun Apr 1 23:26:07 2007 -0700) 7 commits\n - Make read-cache.c \"the_index\" free.\n - Move index-related variables into a structure.\n - Rename add_file_to_index() to add_file_to_cache()\n - Rename static variable write_index to update_index in builtin-\n   apply.c\n - Rename internal function \"add_file_to_cache\" in builtin-update-\n   index.c\n - Propagate cache error internal to refresh_cache() via parameter.\n - Fix bogus error message from merge-recursive error path\n\nThis defines a structure that bundles active_cache, active_nr,\nactive_cache_tree and friends, defines a single instance of such\nstructure \"the_index\".  All cache access/manipulation functions\nin read-cache.c are updated to take a pointer to this structure\nto specify which index to operate on.  The traditional functions\nare redefined as macros, e.g.\n\n    #define add_cache_entry(ce,opt) add_index_entry(&the_index, (ce), (opt))\n\nThis fell out by accident while I was working on jc/read-tree-df\ntopic.  The largest problem there was that we lose sight of what\nwas originally in the index, after replacing a set of paths\n(e.g. path/a path/b path/c) in the current index with a single\nparent path (e.g. \"path\" becomes a blob) from the other tree.\nTo solve this, I initially planned to modify unpack_trees() to\nread from the current index and build into a separate index, and\nthat is why I needed this conversion.\n\nBut it turns out that I can use a single index to solve that, so\nthis series is not needed.  But people into libification may\nfind it interesting.\n\n==========================\n=== not ready for next ===\n==========================\n\n* jc/blame (Tue Mar 27 01:58:01 2007 -0700) 3 commits\n - git-blame: optimize get_origin() from linear search to hash-\n   lookup.\n - git-blame: pass \"struct scoreboard *\" pointers around.\n - blame: lift structure definitions up\n\nI've been trying to optimize this on and off but haven't made\nmuch progress.\n\n* jc/pathattr (Thu Mar 1 01:20:21 2007 -0800) 5 commits\n - pathattr: allow piping to external program.\n - pathattr: read from git_config().\n - git-show: use pathattr to run \"display\"\n - pathattr: path based configuration of various attributes.\n + convert: add scaffolding for path based selection of conversion\n   routines.\n* js/fetch-progress (Sun Feb 25 13:13:17 2007 -0800) 1 commit\n + git-fetch: add --quiet\n* jc/merge-subtree (Thu Feb 15 16:32:45 2007 -0800) 1 commit\n - A new merge stragety 'subtree'.\n* jc/diff (Mon Dec 25 01:08:50 2006 -0800) 2 commits\n - test-para: combined diff between HEAD, index and working tree.\n - para-walk: walk n trees, index and working tree in parallel\n\nStalled.\n"},{"id":"38680","messageId":"7vhcrvti9i.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vwt0uypz7.fsf@assigned-by-dhcp.cox.net","subject":"What's cooking in git.git (topics)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-05T07:03:37Z","receivedAt":"2007-04-05T07:03:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Here are the topics that have been cooking.  Commits prefixed\nwith '-' are only in 'pu' while commits prefixed with '+' are\nin 'next'.  The topics list the commits in reverse chronological\norder.\n\n* cc/bisect (Thu Apr 5 05:33:53 2007 +0200) 2 commits\n + Documentation: bisect: \"start\" accepts one bad and many good\n   commits\n + Bisect: teach \"bisect start\" to optionally use one bad and many\n   good revs.\n\nThis allows \"git bisect start <bad> <good1> <good2>... -- <paths>\".\n\nBeing able to give more than one good commits upfront may not\nhappen very often, but when you are, this makes it unnecessary\nto avoid an extra whole-tree checkout that happens when you give\na new good commit every time.\n\nBeing able to bisect without any good commit is outside of the\nscope of this series, but I suspect that it probably is a simple\nmatter of making \"git bisect next\", after getting a <bad> commit\nbut before gettingt a <good> commit, not to barf but warn\n(because it would pick an ancient commit and wastes one checkout\nif done by mistake), ask confirmation if interactive, and drive\n\"git-rev-list --bisect\".\n\n* fp/make-j (Wed Apr 4 22:42:33 2007 +0200) 1 commit\n + Makefile: Add '+' to QUIET_SUBDIR0 to fix parallel make.\n\nThis makes our Makefile more dependent on GNU make, but I think\nit already is.\n\n* jc/index-output (Sat Mar 31 23:27:41 2007 -0700) 2 commits\n + git-read-tree --index-output=<file>\n + _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative\n   index file.\n\nThis is primarily to make index manipulation more efficient and\nsafer in the codepath to do \"git commit <paths>\".  Although I\ntested the results, I do not know if it breaks things for other\npeople in real life projects, as I almost never do this \"index\njumping\" commit myself.  Testing and feedback is appreciated.\n\nI think the above three series are ready for 'master'.\n\n* fl/cvsserver (Sat Mar 31 15:57:47 2007 +0200) 6 commits\n + cvsserver: Use DBI->table_info instead of DBI->tables\n + cvsserver: Abort if connect to database fails\n + cvsserver: Make the database backend configurable\n + cvsserver: Allow to override the configuration per access method\n + cvsserver: Handle three part keys in git config correctly\n + cvsserver: Introduce new state variable 'method'\n\nAlthough the code looked sane, I do not interact with git\nrepositories over CVS protocol in real life, so I haven't\npersonally tested it.  I cannot push this out to 'master'\nwithout positive feedbacks.  Testing needed.\n\n* jc/checkout (Thu Mar 29 01:23:12 2007 -0700) 4 commits\n + Use BASE index extension in git-commit and git-merge.\n + update-index --{set,get}-base\n + Add BASE index extension.\n + checkout: allow detaching to HEAD even when switching to the tip\n   of a branch\n\nI've rewritten the bottom commit not to require an explicit -d\noption when detaching.  You can say \"git checkout master^0\"\ninstead to get a detached head that is at the tip of master.  I\nmay make that one commit graduate to 'master' earlier than\nothers.\n\nThis series is primarily to make it safer when somebody else\nupdates the tip of the branch you have currently checked out.\nAs I said in previous messages, I think the series covers basic\noperations fine but there probably are gaps in the coverage.\nMotivated volunteers are needed to fill them.\n\n* jc/read-tree-df (Thu Mar 15 23:25:22 2007 -0700) 6 commits\n + Fix switching to a branch with D/F when current branch has file D.\n + Fix twoway_merge that passed d/f conflict marker to\n   merged_entry().\n + Fix read-tree --prefix=dir/.\n + unpack-trees: get rid of *indpos parameter.\n + unpack_trees.c: pass unpack_trees_options structure to\n   keep_entry() as well.\n + add_cache_entry(): removal of file foo does not conflict with\n   foo/bar\n\nI think this fixes the \"my branch has foo/bar and I cannot\nswitch to another branch that has foo as a file\" issue better\nthan the previous attempts.  Heavy testing and reporting is\nneeded until it graduates to 'master'.\n\n* jc/the-index (Sun Apr 1 23:26:07 2007 -0700) 2 commits\n - Make read-cache.c \"the_index\" free.\n - Move index-related variables into a structure.\n\nThis libifies the \"cache\" part of the system.  Parked in 'pu' as\nthere is no immediate need.\n\n* jc/blame (Tue Mar 27 01:58:01 2007 -0700) 3 commits\n - git-blame: optimize get_origin() from linear search to hash-\n   lookup.\n - git-blame: pass \"struct scoreboard *\" pointers around.\n - blame: lift structure definitions up\n* jc/pathattr (Thu Mar 1 01:20:21 2007 -0800) 5 commits\n - pathattr: allow piping to external program.\n - pathattr: read from git_config().\n - git-show: use pathattr to run \"display\"\n - pathattr: path based configuration of various attributes.\n + convert: add scaffolding for path based selection of conversion\n   routines.\n* js/fetch-progress (Sun Feb 25 13:13:17 2007 -0800) 1 commit\n + git-fetch: add --quiet\n* jc/merge-subtree (Thu Feb 15 16:32:45 2007 -0800) 1 commit\n - A new merge stragety 'subtree'.\n* jc/diff (Mon Dec 25 01:08:50 2006 -0800) 2 commits\n - test-para: combined diff between HEAD, index and working tree.\n - para-walk: walk n trees, index and working tree in parallel\n\nThese are stalled.\n"},{"id":"38919","messageId":"7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vhcrvti9i.fsf@assigned-by-dhcp.cox.net","subject":"The index is based on blah, however, the HEAD points at different commit.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T06:10:16Z","receivedAt":"2007-04-09T06:10:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> * jc/checkout (Thu Mar 29 01:23:12 2007 -0700) 4 commits\n>  + Use BASE index extension in git-commit and git-merge.\n>  + update-index --{set,get}-base\n>  + Add BASE index extension.\n>  + checkout: allow detaching to HEAD even when switching to the tip\n>    of a branch\n>\n> I've rewritten the bottom commit not to require an explicit -d\n> option when detaching.  You can say \"git checkout master^0\"\n> instead to get a detached head that is at the tip of master.  I\n> may make that one commit graduate to 'master' earlier than\n> others.\n>\n> This series is primarily to make it safer when somebody else\n> updates the tip of the branch you have currently checked out.\n> As I said in previous messages, I think the series covers basic\n> operations fine but there probably are gaps in the coverage.\n> Motivated volunteers are needed to fill them.\n\nRegarding this series, if you find a command sequence that does\nthis:\n\n (1) A command that is BASE aware (e.g. \"git commit\") is used to\n     point HEAD at a commit and records it in the index; and then,\n\n (2) A command that is not yet BASE aware moves the HEAD\n     (perhaps creating a commit) but does not cause the\n     previously recorded BASE in the index to be updated to\n     point at the new HEAD (e.g. \"git am\");\n\nyour next invocation of a command that is BASE aware would barf,\nsaying something like:\n\n  * The index is based on 'c053f05... My earlier commit made in (1).', however, the HEAD\n    points at different commit '4fc2da4... The last of commits made with (2).'\n\nWhen this happens, please first run \"git-runstatus\" [*1*] and\n\"git-diff HEAD\" to see if this is a false positive.  If the\noutput shows the differences from the HEAD you expect to see and\nyou are sure your index is derived from the current HEAD, and\nnot the error message indicates (in the above example, c053f05\nis such a wrong commit), that means you ran some command that\nneeds to be taught about the BASE.\n\nA work-around until that command is fixed is to run this:\n\n\t$ git update-index --set-base `git-rev-parse HEAD`\n\nThis corrects the base commit recorded in the index to match\nyour current HEAD commit to allows you to keep going.\n\nMotivated volunteers can help us further by doing two more\nthings.  One is obviously to report such a case and identify\nsuch a BASE unaware command, and even better, make it BASE\naware and send in patches.\n\nAnother thing is to make a habit of running 'git update-index\n--get-base' after doing any git operation to see if the index\ncorrectly records the base commit.  \n\nCurrently, when git-read-tree is used to update the index, the\nbase information is discarded, and 'git update-index --get-base'\nwill return empty.  Commands that are already BASE aware will\nnot trigger when the index does not record any base.  This is to\nprevent too many false positives while this safety feature is\nstill in development, but that means more false negatives.  We\nshould minimize this base clobbering so that we can use multiple\nwork trees tied to the same repository more safely.\n\nI'll follow-up this message with four patch series to make \"git am\"\nand \"git reset\" BASE aware.\n\n\n[Footnote]\n\n*1* We need to fix \"git status\" to be usable for this as well,\nbut currently it shares much of its code with \"git commit\" and\ntriggers the same false positive)\n"},{"id":"38920","messageId":"7v3b3a5b3m.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 1/4] Move check_base() shell function to git-sh-setup","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T06:13:33Z","receivedAt":"2007-04-09T06:13:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The scripts that attempt to make a commit on top of the current\nHEAD need to use the same logic in check_base() to make sure the\ncurrent index is based on the HEAD commit we are going to build\non top of.  Move this function from git-commit to git-sh-setup,\nso that it is available to everybody else.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n git-commit.sh   |   16 ----------------\n git-sh-setup.sh |   16 ++++++++++++++++\n 2 files changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 42f1c93..6b4c784 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -25,22 +25,6 @@ refuse_partial () {\n \texit 1\n }\n \n-check_base () {\n-\tquiet=\"$1\"\n-\tif HEAD=`git rev-parse --verify HEAD 2>/dev/null` &&\n-\t   BASE=`git update-index --get-base` &&\n-\t   test -n \"$BASE\" &&\n-\t   test \"$BASE\" != \"$HEAD\"\n-\tthen\n-\t\ttest -z \"$quiet\" || exit 1\n-\t\tours=`git show -s --pretty=oneline --abbrev-commit $BASE`\n-\t\ttheirs=`git show -s --pretty=oneline --abbrev-commit $HEAD`\n-\t\techo >&2 \"* The index is based on '$ours', however, the HEAD\"\n-\t\techo >&2 \"  points at different commit '$theirs'\"\n-\t\texit 1\n-\tfi\n-}\n-\n THIS_INDEX=\"$GIT_DIR/index\"\n NEXT_INDEX=\"$GIT_DIR/next-index$$\"\n rm -f \"$NEXT_INDEX\"\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex f24c7f2..0797acd 100755\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -28,6 +28,22 @@ set_reflog_action() {\n \tfi\n }\n \n+check_base () {\n+\tquiet=\"$1\"\n+\tif HEAD=`git rev-parse --verify HEAD 2>/dev/null` &&\n+\t   BASE=`git update-index --get-base` &&\n+\t   test -n \"$BASE\" &&\n+\t   test \"$BASE\" != \"$HEAD\"\n+\tthen\n+\t\ttest -z \"$quiet\" || exit 1\n+\t\tours=`git show -s --pretty=oneline --abbrev-commit $BASE`\n+\t\ttheirs=`git show -s --pretty=oneline --abbrev-commit $HEAD`\n+\t\techo >&2 \"* The index is based on '$ours', however, the HEAD\"\n+\t\techo >&2 \"  points at different commit '$theirs'\"\n+\t\texit 1\n+\tfi\n+}\n+\n is_bare_repository () {\n \tgit-config --bool --get core.bare ||\n \tcase \"$GIT_DIR\" in\n-- \n1.5.1.730.g0d43be\n"},{"id":"38922","messageId":"7vwt0m3wj6.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 2/4] Use BASE index extension in git-am.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T06:13:33Z","receivedAt":"2007-04-09T06:13:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This makes git-am to record the expected HEAD location after\nfinishing its operation in the index, so that subsequent BASE\ncheck would notice when somebody else updated your branch head\nwhile you are looking the other way.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n git-am.sh |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex e69ecbf..27912ce 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -13,6 +13,7 @@ git var GIT_COMMITTER_IDENT >/dev/null || exit\n \n stop_here () {\n     echo \"$1\" >\"$dotest/next\"\n+    git update-index --set-base $(git rev-parse --verify HEAD)\n     exit 1\n }\n \n@@ -157,6 +158,8 @@ do\n \tesac\n done\n \n+check_base || exit\n+\n # If the dotest directory exists, but we have finished applying all the\n # patches in them, clear it out.\n if test -d \"$dotest\" &&\n@@ -468,5 +471,6 @@ do\n \n \tgo_next\n done\n+git update-index --set-base $(git rev-parse --verify HEAD)\n \n rm -fr \"$dotest\"\n-- \n1.5.1.730.g0d43be\n"},{"id":"38921","messageId":"7vr6qu3wj5.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 3/4] git-read-tree --set-base=<commit>","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T06:13:34Z","receivedAt":"2007-04-09T06:13:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This allows the caller of read-tree to record the base commit\nobject in the index, so that later operations that build a new\ncommit based on the contents of the index can verify that the\nHEAD is still at the expected place, and notice cases where\nsomebody else updated the tip of the current branch while we are\nlooking the other way.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n Documentation/git-read-tree.txt |    6 +++++-\n builtin-read-tree.c             |   19 +++++++++++++++++++\n 2 files changed, 24 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt\nindex 0ff2890..ef731e2 100644\n--- a/Documentation/git-read-tree.txt\n+++ b/Documentation/git-read-tree.txt\n@@ -8,7 +8,7 @@ git-read-tree - Reads tree information into the index\n \n SYNOPSIS\n --------\n-'git-read-tree' (<tree-ish> | [[-m [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] <tree-ish1> [<tree-ish2> [<tree-ish3>]])\n+'git-read-tree' (<tree-ish> | [[-m [--aggressive] | --reset | --prefix=<prefix>] [-u | -i]] [--exclude-per-directory=<gitignore>] [--set-base=<commit>] <tree-ish1> [<tree-ish2> [<tree-ish3>]])\n \n \n DESCRIPTION\n@@ -86,6 +86,10 @@ OPTIONS\n \tfile (usually '.gitignore') and allows such an untracked\n \tbut explicitly ignored file to be overwritten.\n \n+--set-base=<commit>::\n+\tThis option records the commit object name in the index,\n+\tlater to be retrieved with the `git-update-index --get-base`.\n+\n <tree-ish#>::\n \tThe id of the tree object(s) to be read/merged.\n \ndiff --git a/builtin-read-tree.c b/builtin-read-tree.c\nindex 06c2912..d1c4489 100644\n--- a/builtin-read-tree.c\n+++ b/builtin-read-tree.c\n@@ -93,6 +93,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)\n {\n \tint i, newfd, stage = 0;\n \tunsigned char sha1[20];\n+\tunsigned char newbase[20];\n+\tint newbase_set = 0;\n \tstruct unpack_trees_options opts;\n \n \tmemset(&opts, 0, sizeof(opts));\n@@ -158,6 +160,15 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)\n \t\t\tcontinue;\n \t\t}\n \n+\t\tif (!prefixcmp(arg, \"--set-base=\")) {\n+\t\t\tif (get_sha1(arg+11, newbase) ||\n+\t\t\t    sha1_object_info(newbase, NULL) != OBJ_COMMIT)\n+\t\t\t\tdie(\"Specified base is not a valid commit object name '%s'\",\n+\t\t\t\t    arg);\n+\t\t\tnewbase_set = 1;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\tif (!strcmp(arg, \"--trivial\")) {\n \t\t\topts.trivial_merges_only = 1;\n \t\t\tcontinue;\n@@ -261,12 +272,20 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)\n \t * \"-m ent\" or \"--reset ent\" form), we can obtain a fully\n \t * valid cache-tree because the index must match exactly\n \t * what came from the tree.\n+\t *\n+\t * Also when we read from a single commit with --reset, the\n+\t * index will be used to build a commit on top of it.\n \t */\n \tif (trees && trees->item && !opts.prefix && (!opts.merge || (stage == 2))) {\n \t\tcache_tree_free(&active_cache_tree);\n \t\tprime_cache_tree();\n \t}\n \n+\tif (newbase_set) {\n+\t\tactive_cache_base_valid = 1;\n+\t\thashcpy(active_cache_base, newbase);\n+\t}\n+\n \tif (write_cache(newfd, active_cache, active_nr) ||\n \t    close(newfd) || commit_lock_file(&lock_file))\n \t\tdie(\"unable to write new index file\");\n-- \n1.5.1.730.g0d43be\n"},{"id":"38923","messageId":"7vlkh23wj4.fsf@assigned-by-dhcp.cox.net","threadId":"7497","inReplyTo":"7vps6e5b93.fsf_-_@assigned-by-dhcp.cox.net","subject":"[PATCH 4/4] Teach git-reset to use index BASE extension.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T06:13:35Z","receivedAt":"2007-04-09T06:13:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"After resetting the HEAD to point at a different commit, the\nuser obviously intends to make the next commit a child of the\nupdated HEAD commit.  Record it in the index so that we can\ndetect the case where somebody else updates the tip of the\ncurrent branch while we are looking the other way.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n git-reset.sh |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/git-reset.sh b/git-reset.sh\nindex fee6d98..982c726 100755\n--- a/git-reset.sh\n+++ b/git-reset.sh\n@@ -71,7 +71,7 @@ then\n \t\tdie \"Cannot do a soft reset in the middle of a merge.\"\n \tfi\n else\n-\tgit-read-tree --reset $update \"$rev\" || exit\n+\tgit-read-tree --reset $update --set-base=\"$rev\" \"$rev\" || exit\n fi\n \n # Any resets update HEAD to the head being switched to.\n@@ -93,10 +93,11 @@ case \"$reset_type\" in\n \t}\n \t;;\n --soft )\n-\t;; # Nothing else to do\n+\tgit-update-index --set-base \"$rev\"\n+\t;;\n --mixed )\n \t# Report what has not been updated.\n-\tgit-update-index --refresh\n+\tgit-update-index --set-base \"$rev\" --refresh\n \t;;\n esac\n \n-- \n1.5.1.730.g0d43be\n"}]}